0

I'm using Linux AMI on Amazon EC2 and I would like to install numpy and scipy. In theory, it should be quite straightforward, but I'm runnign into problems.

Here are my steps:

> sudo alternatives --set python /usr/bin/python3.4
> sudo virtualenv -p python3.4 my_env
> sudo chmod -R 777 my_env
> . my_env/bin/activate
> pip install numpy

Installing numpy returns:

Collecting numpy
  Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy
  Running setup.py install for numpy
Successfully installed numpy

But it does not seems to work, because running pip freeze and pip list does not show any trace of numpy. The fact that I'm missing the package is obvious when I try to run pip install scipy:

Collecting scipy
  Using cached scipy-0.16.1.tar.gz
Collecting numpy>=1.6.2 (from scipy)
  Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy, scipy
  Running setup.py install for numpy
 ImportError: No module named 'numpy'  Running setup.py install for scipy
    Complete output from command /usr/lib/python3.4/my_env/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-wq1cn43p/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mjftl3bs-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/lib/python3.4/my_env/include/site/python3.4/scipy:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 253, in <module>
        setup_package()
      File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 241, in setup_package
        from numpy.distutils.core import setup
    ImportError: No module named 'numpy'

I have the lastest pip version, 7.1.2.

1 Answer 1

2

When you set up your virtualenv to use python3 you also have to use pip3

virtualenv -p python3.4 env
source env/bin/activate
pip3 install numpy
Sign up to request clarification or add additional context in comments.

2 Comments

Ah, I did not know about this connection. Actually I got the same error when I tried to use pip3. But knowing this, and knowing that I do not have to use 3.4, I opted for Python 2.7 and pip. Now everything installs as expected.
Still a bit strange, it should work with pip3. I can test it when I get home

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.