Context
On a provided Linux-server without root access I am bound to preinstalled Python-packages (e.g. cannot upgrade them).
However, I am able to install a package directly from a wheel (.whl
) by using pip3 install /path/package_name --user
which will install the package to a site-package-folder preserved to my user.
In my special case I want to upgrade the scikit-learn
-package. This package is already preinstalled and I cannot upgrade it (root access missing), however, I can install the newer version in the --user
-folder.
In the filesystem I can see that both installations are now present in their respective folders.
Both paths are known to python (checked by using sys.path
).
Question/Problem
When I import scikit-learn via import sklearn
and print the version (sklearn.__version__
), I'll always end up with the preinstalled version and not the new one I installed in my --user
-directory.
Given two installations of the same module with a differing version: How can I define in Python during the import which module/version to load?
The premise is that I cannot disable/uninstall the old version (root access again..).