Skip to main content

hi u2python's guru,

I run a problem to adress 4 different python on the same machine. 

1/ from bash /usr/bin/python (2.6.6) 

sys.prefix='/usr'
sys.path=['', '/usr/lib/python2.6/site-packages/'........., '/usr/lib64/python2.6', '.....]

2/ from bash /usr/local/bin/python3 (3.6.4)

 sys.prefix = '/usr/local'
 sys.path=['', '/usr/local/lib/python36.zip', 
'/usr/local/lib/python3.6', 
'/usr/local/lib/python3.6/lib-dynload', 
'/usr/local/lib/python3.6/site-packages']

3/ from bash /data/uvdb/uv/python/bin/python3 (3.4.5)

sys.prefix='/usr'
sys.path = ['', '/usr/lib64/python34.zip', 
'/usr/lib64/python3.4', 
'/usr/lib64/python3.4/plat-linux', 
'/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages', 
'/usr/lib/python3.4/site-packages']

4/ from uvshell /data/uvdb/uv/bin/uv > python 

sys.version='3.4.1 (default, Feb 18 2015, 13:36:51) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
sys.prefix='/data/uvdb/uv/python'
sys.path=['/data/uvdb/uv/python/lib/python34.zip', 
'/data/uvdb/uv/python/lib/python3.4', 
'/data/uvdb/uv/python/lib/python3.4/plat-linux', 
'/data/uvdb/uv/python/lib/python3.4/lib-dynload', 
'/data/uvdb/uv/python/lib/python3.4/site-packages', 
'/data/uvdbsb55/SB553/ININCLUDE', '/data/uvdb/uv/bin']

cat /data/uvdb/uv/.pyconfig

PYHOME=/data/uvdb/uv/python
PYLIB=/data/uvdb/uv/python/lib/libpython3.4m.so

Now, my problem.

How to setup my bash environment to receive external modules into '/data/uvdb/uv/python/lib/python3.4/site-packages'when I execute pip ?

Actually, if I run (python3 (or /data/uvdb/uv/python/bin/python3) -m ) pip install module ... all is installed into /usr/lib/python3.4/site-packages which are not addressed by uv>python !

I do not understand how to execute pip with uv>python environment ....

I hope you can help me.

with kind regards

manu 

hi u2python's guru,

I run a problem to adress 4 different python on the same machine. 

1/ from bash /usr/bin/python (2.6.6) 

sys.prefix='/usr'
sys.path=['', '/usr/lib/python2.6/site-packages/'........., '/usr/lib64/python2.6', '.....]

2/ from bash /usr/local/bin/python3 (3.6.4)

 sys.prefix = '/usr/local'
 sys.path=['', '/usr/local/lib/python36.zip', 
'/usr/local/lib/python3.6', 
'/usr/local/lib/python3.6/lib-dynload', 
'/usr/local/lib/python3.6/site-packages']

3/ from bash /data/uvdb/uv/python/bin/python3 (3.4.5)

sys.prefix='/usr'
sys.path = ['', '/usr/lib64/python34.zip', 
'/usr/lib64/python3.4', 
'/usr/lib64/python3.4/plat-linux', 
'/usr/lib64/python3.4/lib-dynload', '/usr/lib64/python3.4/site-packages', 
'/usr/lib/python3.4/site-packages']

4/ from uvshell /data/uvdb/uv/bin/uv > python 

sys.version='3.4.1 (default, Feb 18 2015, 13:36:51) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
sys.prefix='/data/uvdb/uv/python'
sys.path=['/data/uvdb/uv/python/lib/python34.zip', 
'/data/uvdb/uv/python/lib/python3.4', 
'/data/uvdb/uv/python/lib/python3.4/plat-linux', 
'/data/uvdb/uv/python/lib/python3.4/lib-dynload', 
'/data/uvdb/uv/python/lib/python3.4/site-packages', 
'/data/uvdbsb55/SB553/ININCLUDE', '/data/uvdb/uv/bin']

cat /data/uvdb/uv/.pyconfig

PYHOME=/data/uvdb/uv/python
PYLIB=/data/uvdb/uv/python/lib/libpython3.4m.so

Now, my problem.

How to setup my bash environment to receive external modules into '/data/uvdb/uv/python/lib/python3.4/site-packages'when I execute pip ?

Actually, if I run (python3 (or /data/uvdb/uv/python/bin/python3) -m ) pip install module ... all is installed into /usr/lib/python3.4/site-packages which are not addressed by uv>python !

I do not understand how to execute pip with uv>python environment ....

I hope you can help me.

with kind regards

manu 

@Manu Fernandes,

The environment variable PYTHONUSERBASE can be used to control where python modules are installed, so you could set this prior to running pip commands.

The danger is that you need to be running the UV-installed python & pip commands to ensure the packages you install are compatible with the uv python version.

In the forum discussion "U2PE, Python and virtual environments" the topic of correctly running the UV python interpreter outside of a uv shell is covered, including creating a shell script to launch the proper python interpreter.

With such a script in place, a linux command such as "uvpython -m pip {pip command options}" will ensure that yor installed modules end up in the proper directories for uv's python.