How to make "pip install" not remove other versions?

I manage several modules on HPC and want to set some tool requirements with pip.

I will not use virtualenv because they do not work well with our modular system. I want to install modular local versions of packages and install correctly PYTHONPATHwhen the module loads, and this works fine when the packages I install are also not installed in the python environment by default.

What I don't want to do is remove the default python packages by default while I install local versions of the module.

For example, one package is required numpy==1.6, and the default version installed using python I use 1.8.0. When I

pip install --install-option="--prefix=$RE_PYTHON" numpy==1.6

where it RE_PYTHONpoints to the top of the module-local site-packages directory, it numpy==1.6installs fine, then pip continues and starts removing the 1.8.0python that I use from the tree (why it wants to remove a newer version goes beyond me, but I want to avoid this, even if I perform a local installation, for example numpy==1.10.1).

How can I prevent this? This is really annoying, and I could not find a solution that is not related to virtualenv.

+4
source share
1 answer

You must explicitly indicate to pipignore the currently installed package by specifying a parameter -I(or --ignore-installed). Therefore you should use:

PYTHONUSERBASE=$RE_PYTHON pip install -I --user numpy==1.6

Ian Bicking.

+3

Source: https://habr.com/ru/post/1615080/


All Articles