0

I have been having an issue where pip and python seem to be ignoring the fact that they are in a virtualenv. I found the following:

pip command in virtualenv ignored in favour of system pip command

pip not pointing to virtual enviroment, in virtual enviroment

But neither seem to answer my issue.

The key issue seems to be when pip is trying to install modules it is detecting the module at the system level and then thinking it is already there, tries to uninstall it then fails because it isn't in the same environment.

For example, I need to update Wernzeug, so I try:

[venv] me@somemachine: pip install werkzeug

which results in:

Requirement already satisfied: werkzeug in /python/3.7.2/rh60_64/modules (0.15.2)

The weird bit starts if I run an uninstall:

[venv] me@somemachine: pip uninstall werkzeug

When I get:

Not uninstalling werkzeug at /python/3.7.2/rh60_64/modules, outside environment /venv Can't uninstall 'Werkzeug'. No files were found to uninstall.

Here's the kicker, due to the way the server is built I'm having to use the 'sw' command to get python (in this case 3.7.2). I'm wondering if this has something to do with the venv getting confused with where it is supposed to be looking. I do not have root access to the server, nor am I likely to get it, so I can't mess with the system installed modules.

Other useful info: The base system is REHL 6.6 pip -V output:

pip 22.0.4 from /venv/lib/python3.7/site-packages/pip (python 3.7)

Any pointers or ideas that might help this are more than welcome.

Graeme T
  • 23
  • 1
  • 1
  • 6

0 Answers0