4

I'm using python 3.4.2, and I believe I downloaded it from python.org. I'm running this on a Mac with El Capitan.

I tried downloading scipy using the anaconda's graphic installation interface. After running the installer, I opened IDLE and tried:

>>> import scipy

But got the error:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import scipy
ImportError: No module named 'scipy'

I tried the same thing with numpy, but got the same error.

I then tried installing matplotlib, but this time I figured I should try using pip on the command line. First I tried:

dhcp-wifi-8021x-155-41-121-77:~ theMAN$ pip install matplotlib
Requirement already satisfied: matplotlib in 
./anaconda/lib/python3.6/site-packages
Requirement already satisfied: numpy>=1.7.1 in 
./anaconda/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: six>=1.10 in 
./anaconda/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: python-dateutil in 
./anaconda/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pytz in ./anaconda/lib/python3.6/site-
packages (from matplotlib)
Requirement already satisfied: cycler>=0.10 in 
./anaconda/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 
in ./anaconda/lib/python3.6/site-packages (from matplotlib)

But trying to import scipy, numpy, and matplotlib still returned the same errors. I also tried uninstalling and reinstalling scipy with pip, but that didn't change anything.

Are the modules not installing properly? Are they installed but I'm not importing them right?

2
  • what is the output when you try pip install scipy... This package is known to be somewhat tricky. That's why some people use conda instead of pip Commented Jul 25, 2017 at 20:35
  • I just tried it, no luck :( Commented Jul 25, 2017 at 20:50

3 Answers 3

1

Tiarnán de Burca's comment helped but just one more step afterwards.

When you find the path python2.7 expects the install you can install directly to this directory with pip.

sudo pip install scipy -t <path-to-directory>

Beware I'm working over a vpn on a raspberry pi and the download took eons be patient open a screen if you have a similar situation but this solved my problem finally.

Update: I jumped the gun the build failed though it looked like it was working. This worked. https://github.com/scipy/scipy/blob/master/INSTALL.rst.txt#installing-scipy

For ubuntu/debian run these first if you don't have them installed already:

sudo apt-get install libatlas-base-dev
pip install cython

I've also read miniconda is a workaround that does not require compiling.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't think there's enough there to answer the question fully, but at a guess I suspect the issue's with your path, or possibly some ambiguity about which python you're running.

Do you get the same result if you run python from the terminal?

(Open terminal, type python, then in that interpreter import scipy)

In the IDLE interpreter if you run:

import sys sys.path

Does it include where you'd expect scipy/matplotlib to be installed?

1 Comment

When I run python in the terminal I can import scipy and numpy properly and run some basic functions. I get that sys.path = ['', '/Users/theMAN/anaconda/lib/python36.zip', '/Users/theMAN/anaconda/lib/python3.6', '/Users/theMAN/anaconda/lib/python3.6/lib-dynload', '/Users/theMAN/anaconda/lib/python3.6/site-packages', '/Users/theMAN/anaconda/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg', '/Users/theMAN/anaconda/lib/python3.6/site-packages/aeosa', '/Users/theMAN/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg']
0

The issue is the packages are not installed globally, they are available to you within Anaconda. So first thing is to make sure you are using the python package within the Anaconda version. Try this

which python

you should see anaconda/bin/python. If not you need either change the python version you are using to use Anaconda on your machine or you can try this below.

This should list all the packages available to you through Anaconda.

conda list

Also, try creating an application using

conda create --name <name of the application> python=<version>

Activate your application

source activate <name of the application>

Now open the application and try importing numpy, and scipy and see if it works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.