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!

  • 1
    There might be a mismatch amongst which Python you're running on the command line and which Python has SciPy installed. Your Python command outputs show that you're running the non-Anaconda Python already installed on your Mac. Find where Anaconda installed Python (and therefore SciPy), and put that in your path ahead of the in-built version :-) – Ambidextrous Apr 3 '15 at 1:39
  • @Ambidextrous care to make that a answer? – Ruskes Apr 3 '15 at 2:24
  • @Ambidextrous: So then, SciPy is associated with a particular instance of python, and is not usable by python as a whole? These are the last few lines of my .bash_profile: # added by Anaconda 2.2.0 installer export PATH="/Users/username/anaconda/bin:$PATH" # Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH – fyzx92 Apr 3 '15 at 3:37
  • 1
    There's no such thing as 'Python as a whole' - there are different Pythons :-) @Buscar - yes, I'll expand that into a proper answer and provide examples. – Ambidextrous Apr 4 '15 at 17:34
  • If you have both Homebrew and Macports you have problems (they can run together but if you could understand how to do this you would not be asking this question). You need to delete at least one - and if you are installing Anaconda or python.org python this conflicts with Homebrew in /usr/local Basically stick to one thing and use that as your installer – Mark Apr 4 '15 at 18:13

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.

  • I got some help from a professor, and Anaconda can now help to install visualpython using the command conda install -c https://conda.binstar.org/mwcraig vpython. After entering which python, I get /Users/username/anaconda/bin/python. When I run python on a provided test program, I get the error This program needs access to the screen.\n Please run with a Framework build of python, and only when you are\n logged in on the main display of your Mac. – fyzx92 Apr 9 '15 at 15:25
  • @fyzx92 that is a separate question but it looks like Anaconda can't run graphics programs. If this is coursework as someone to show a working setup and ask them what they installed not just how do I install X – Mark Apr 9 '15 at 19:44
  • Hm. Anaconda can plot graphics just fine with matplotlib, but I've never used VPython. Wonder by the way how you're logged in/ where you're typing those commands? It's certainly not a remote login? – Ambidextrous Apr 10 '15 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .