(NB: see this other post for why I am not using dpkg/apt-get/etc. for this installation.)
I can install numpy in a virtualenv on Debian with, e.g., pip:
(base)[1778]% pip -v install numpy
Downloading/unpacking numpy
...
<output omitted>
...
Successfully installed numpy
Cleaning up...
Removing temporary dir /home/jones/.virtualenvs/base/build...
But immediately after this:
(base)[1779]% python
Python 2.7.1 (r271:86832, Jun 22 2011, 15:39:05)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> ^D
Any ideas?
OK, I found the problem. It turns out that, even though my virtualenv is active (see the (base)
prefix to the command-line prompts in the screen interaction snippets above), I still need to tell pip to use it. E.g. after running something like
pip -E /path/to/virtualenv install numpy
then importing numpy within an interactive python session succeeds (whether the imported module is functional, I don't know yet).
This is absurd: my virtualenv is active, and the pip executable I'm running is the one installed in that virtualenv:
(base)[1801] which pip
/home/jones/.virtualenvs/base/bin/pip
So what's the point of having a virtualenv if pip will not use it by default???