21

I'm completely new to Python and want to use it for data analysis. I just installed Python 2.7 on my mac running OSX 10.8. I need the NumPy, SciPy, matplotlib and csv packages. I read that I could simply install the Anaconda package and get all in one. So I went ahead and downloaded/installed Anaconda 1.7.

However, when I type in: import numpy as np

I get an error telling me that there is no such module. I assume this has to do with the location of the installation, but I can't figure out how to: A. Check that everything is actually installed properly B. Check the location of the installation.

Any pointers would be greatly appreciated!

Thanks

marc
  • 1,883
  • 8
  • 19
  • 29

4 Answers4

21

You can determine which version of python you are running when you get the error by looking at the results of which python from the commandline. It is likely that you are running the system version (although recent versions Mac OS X include numpy in its system python), rather than Anaconda's python distribution. If this is the case, you need to modify your PATH as suggested by Anaconda at the end of the install process. Assuming it was installed in ~/anaconda, you would need to add something like:

export PATH=$HOME/anaconda/bin:$PATH

to your .bash_profile

JoshAdel
  • 57,369
  • 23
  • 130
  • 131
  • 2
    Could you walk me through the steps? anaconda is installed in ~/User/myname/anaconda. So does that mean that in the bash command line I have to enter > $ echo "export PATH=User/myname/anaconda/bin:$PATH" >> ~/.bash_profile – marc Sep 26 '13 at 15:29
  • Note that the Anaconda installer usually does this for you, unless you explicitly tell it not to. At any rate, enter the line exactly as it's written here (with `$HOME`). That will be better than writing out the full path to your home directory. – asmeurer Sep 27 '13 at 02:37
1

Though the question is not relevant to Windows environment, FYI for windows. In order to use anaconda modules outside spyder or in cmd prompt, try to update the PYTHONPATH & PATH with C:\Users\username\Anaconda3\lib\site-packages.

Finally, restart the command prompt.

Additionally, sublime has a plugin 'anaconda' which can be used for sublime to work with anaconda modules.

0

I don't think the existing answer answers your specific question (about installing packages within Anaconda). When I install a new package via conda install <PACKAGE>, I then run conda list to ensure the package is now within my list of Anaconda packages.

Dhruv Ghulati
  • 2,664
  • 2
  • 26
  • 46
0

you might want to try this:

for anaconda 2 :

export PATH=~/anaconda2/bin:$PATH

for anaconda 3 :

export PATH=~/anaconda3/bin:$PATH

for anaconda 4 :

Use the Anaconda Prompt

and then

conda --version

to confirm that it worked.

Akash Kandpal
  • 2,074
  • 20
  • 23