MacOS – How to install SciPy and VisualPython on OSX Mavericks

installmacospython

I am attempting to download and install both SciPy and VisualPython so that I can get them to work with each other. I've looked at the release notes for SciPy 0.14.0 and 0.15, and they appear to be compatible with Visual Python, which requires Python 2.7.9. After downloading this version I checked (using python -V) that my computer uses this version.

I downloaded Anaconda and Visual Python, but upon running two test files provided by my professor, each returned the following error:

    $ python elect.py
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'elect.py': [Errno 2] No such file or directory

I tried running these programs while in the parent directory, where I got this error:

    $ python elect.py
Traceback (most recent call last):
  File "elect.py", line 2, in <module>
    from scipy import *
ImportError: No module named scipy

I have MacPorts and Homebrew installed (though MacPorts is not updating libgcc, but that's another question) if you think those will help. I would have linked to the release notes too, but I haven't got enough reputation. A search for SciPy release notes 0.x should yield the correct site. Thank You!

Best Answer

When you install Anaconda, it installs a different version of Python, which has SciPy, NumPy, pandas, matplotlib, and whole lot of goodness bundled with it. However, those libraries won't automatically become usable by your other Python version that comes pre-installed on your computer (or any other Python version that you installed yourself).

From the command line, try which python - this will tell you which Python you're using on the command line right now. If what is printed has the word 'Anaconda' in it, you are fine, and you should be able to use scipy. If not, then that is not the right Python associated with scipy.

In your shell configuration file (typically .bashrc or .bash_profile) Anaconda makes the required change to make sure that you start using the Anaconda version of Python. From your output, it seems that it didn't get your username right. In the path, the username should be your actual username on the computer. Try to make that change, restart your terminal or a shell session, and try again. It might also simply be that you never restarted your terminal. Let us know what you find.