How do I make sure packages installed using pip
don't install dependancies already installed using apt-get
?
For example, on Ubuntu you can install the package Numpy using apt-get install python-numpy
. Which gets installed to:
usr/local/lib/python2.7/dist-packages
I've noticed that when I install a package that requires numpy using pip
for example, pip install scipy
instead of skipping the numpy dependancy it installs again to a different location.
/usr/lib/python2.7/dist-packages
What pip should do is skip any python packages installed globally, right?
In key here is to prevent multiple package managers to install into the same directories.
One strategy is to create a virtualenv
that is aware of the package of its parent interpreter. This can be done by using the --system-site-packages
option.
virtualenv -p /usr/bin/python --system-site-packages py27
source py27/bin/activate
This environment will not be empty by default. You may want to compare /usr/bin/python -m pip list
and python -m pip list
.
See also this question
For many (scientific) packages there are also wheels available on pypi. Wheels are already binary and thus need no further compilation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With