Search code examples
pythonenthoughtcanopy

cannot import matplot after installing enthought canopy from terminal


I wanted some numeric modules of python. I installed canopy from enthought that is supposed to have all the necessary modules I need. e.g.: matplotlib.pyplot and scipy. After installation, I tried to import the module, I get the following error. I have python2.7 running in my mac OS X. should I have to change my pythonPath or something to have this work, I searched around the web, but could not find a clear answer.

import matplotlib.pyplot as plt
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib.pyplot
import scipy
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named scipy

Thanks


Solution

  • If you don't choose at installation to make Canopy your default python, you will need to add its executable on the path if you want it to be invoked when you start python or ipython as opposed to your system python. The python executable in Canopy should be at ~/Library/Enthought/Canopy_**bit/User/bin/python where ** is 32 or 64 depending on the architecture you chose.

    You can modify your .bash_profile and add ~/Library/Enthought/Canopy_**bit/User/bin/ first on your PATH or run the following from your terminal:

    source ~/Library/Enthought/Canopy_**bit/User/bin/activate
    

    for this to be true until you close your terminal.

    HTH,