Joshua
Joshua

Reputation: 762

pip install numpy - fails to install although there are no errors

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.

Upvotes: 0

Views: 1077

Answers (1)

JDurstberger
JDurstberger

Reputation: 4255

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

Upvotes: 2

Related Questions