guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PYTHONPATH woes


From: Ricardo Wurmus
Subject: Re: PYTHONPATH woes
Date: Thu, 22 Feb 2018 16:30:04 +0100
User-agent: mu4e 1.0; emacs 25.3.1

Hi Hartmut,

I was hoping for you to show up and give your input.  Thank you!  I
appreciate you taking the time.

> re 1): This is extremely curious: Why is the older package imported,
> where the newer one is expected to be first in path?
>
> To analyze this in detail, please make a copy of the resp. wrapper
> script and change the last command into:
>
> exec -a "$0" python3 -m site
>
> and run the changed wrapper. This should show all paths defined in the
> wrapper first.

Since this is Python 2 I used this line:

    exec -a "$0" /gnu/store/0n8ni2l…-python-2.7.13/bin/python -m site

The full wrapper looks like this:

--8<---------------cut here---------------start------------->8---
#!/gnu/store/f8k940vy9gck66m9r4id5m098w3hxgka-bash-minimal-4.4.12/bin/bash
export 
PYTHONPATH="/gnu/store/bz9l68hwlvwbp21msm2v002y7s8qfdd3-ribodiff-0.2.2/lib/python2.7/site-packages:/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/site-packages:/gnu/store/95xlp80dp36m6nllaifndvc1vspnxwb2-python2-mock-1.0.1/lib/python2.7/site-packages:/gnu/store/8dgqb88wabnqscri4brwhasar7i1an1h-python2-nose-1.3.7/lib/python2.7/site-packages:/gnu/store/xd796qc9kjaslw85jk7f81fxkql021x0-python2-numpy-1.12.0/lib/python2.7/site-packages:/gnu/store/l1gdwsx4gr23gzy8zw6n588icdhhw8z4-python2-matplotlib-2.0.2/lib/python2.7/site-packages:/gnu/store/prvq91x42x7wpxbjgx83y78n23jx3jd5-python2-scipy-0.19.1/lib/python2.7/site-packages:/gnu/store/ng6srvhfmkz9i6g2ilbg6zksbh0v9yik-python2-statsmodels-0.8.0/lib/python2.7/site-packages:/gnu/store/vls5bci2wk15sz080g6wgycj6fmm44w9-python2-cairocffi-0.8.0/lib/python2.7/site-packages:/gnu/store/lfnzcj977hldqhkcpivag1hwqqqzk4gr-python2-six-1.10.0/lib/python2.7/site-packages:/gnu/store/vcs6yjy3851zn350gc90ipw2if3rg2vj-python2-pytz-2017.3/lib/python2.7/site-packages:/gnu/store/5w9r2c3dcz353n9rp56pcwvbks8s2hva-python2-pillow-3.3.3/lib/python2.7/site-packages:/gnu/store/hl1ly62q6gsiwd287gqy354dbgrq5sxk-python2-dateutil-2.6.0/lib/python2.7/site-packages:/gnu/store/8jwxgbcym5i1accf88bq7i8fgzg2z68q-python2-pyparsing-2.2.0/lib/python2.7/site-packages:/gnu/store/ikx5his9njw7r7df06gkwlayhgl2780a-python2-cycler-0.10.0/lib/python2.7/site-packages:/gnu/store/jknf4w4s9w5w71ampcymgn4d14hfwx3h-python-2.7.13-tk/lib/python2.7/site-packages:/gnu/store/gdgy38ylfm4jaz4cmq6c6650i8iga21l-python2-subprocess32-3.2.7/lib/python2.7/site-packages:/gnu/store/pdlc7mwmm1vfrkgcpscps5kj0p1gwa14-python2-pygobject-2.28.6/lib/python2.7/site-packages:/gnu/store/s8sn8r41jyn35aginp63z2232sw9g23a-python2-functools32-3.2.3-2/lib/python2.7/site-packages:/gnu/store/bj4jlrnai5qlic1arjijyp47isvipca7-python2-pycairo-1.10.0/lib/python2.7/site-packages:/gnu/store/rhc5rpihy35ss7i9fvc0knqa798br9yj-python2-patsy-0.4.1/lib/python2.7/site-packages:/gnu/store/mrm8hn8rv04hm80sl63c1w33xs5gg147-python2-pandas-0.19.2/lib/python2.7/site-packages:/gnu/store/q977dgwlvmak15qn0w2kjk3q322mbrwi-python2-xcffib-0.5.1/lib/python2.7/site-packages:/gnu/store/gmdlgpm3jyfi608fyjmj6g7svpp5y8lc-python2-cffi-1.11.2/lib/python2.7/site-packages:/gnu/store/7fziyn0m8wjc98j0g056bms4yv94mi5q-python2-pycparser-2.17/lib/python2.7/site-packages${PYTHONPATH:+:}$PYTHONPATH"
#exec -a "$0" 
"/gnu/store/bz9l68hwlvwbp21msm2v002y7s8qfdd3-ribodiff-0.2.2/bin/.TE.py-real" 
"$@"
exec -a "$0" 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/bin/python -m site
--8<---------------cut here---------------end--------------->8---

While PYTHONPATH is set this prints *nothing* at all.  Only after “unset
PYTHONPATH” I get this:

--8<---------------cut here---------------start------------->8---
sys.path = [
    '/home/uzinnal',
    
'/gnu/store/bz9l68hwlvwbp21msm2v002y7s8qfdd3-ribodiff-0.2.2/lib/python2.7/site-packages',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/site-packages',
    
'/gnu/store/95xlp80dp36m6nllaifndvc1vspnxwb2-python2-mock-1.0.1/lib/python2.7/site-packages',
    
'/gnu/store/8dgqb88wabnqscri4brwhasar7i1an1h-python2-nose-1.3.7/lib/python2.7/site-packages',
    
'/gnu/store/xd796qc9kjaslw85jk7f81fxkql021x0-python2-numpy-1.12.0/lib/python2.7/site-packages',
    
'/gnu/store/l1gdwsx4gr23gzy8zw6n588icdhhw8z4-python2-matplotlib-2.0.2/lib/python2.7/site-packages',
    
'/gnu/store/prvq91x42x7wpxbjgx83y78n23jx3jd5-python2-scipy-0.19.1/lib/python2.7/site-packages',
    
'/gnu/store/ng6srvhfmkz9i6g2ilbg6zksbh0v9yik-python2-statsmodels-0.8.0/lib/python2.7/site-packages',
    
'/gnu/store/vls5bci2wk15sz080g6wgycj6fmm44w9-python2-cairocffi-0.8.0/lib/python2.7/site-packages',
    
'/gnu/store/lfnzcj977hldqhkcpivag1hwqqqzk4gr-python2-six-1.10.0/lib/python2.7/site-packages',
    
'/gnu/store/vcs6yjy3851zn350gc90ipw2if3rg2vj-python2-pytz-2017.3/lib/python2.7/site-packages',
    
'/gnu/store/5w9r2c3dcz353n9rp56pcwvbks8s2hva-python2-pillow-3.3.3/lib/python2.7/site-packages',
    
'/gnu/store/hl1ly62q6gsiwd287gqy354dbgrq5sxk-python2-dateutil-2.6.0/lib/python2.7/site-packages',
    
'/gnu/store/8jwxgbcym5i1accf88bq7i8fgzg2z68q-python2-pyparsing-2.2.0/lib/python2.7/site-packages',
    
'/gnu/store/ikx5his9njw7r7df06gkwlayhgl2780a-python2-cycler-0.10.0/lib/python2.7/site-packages',
    
'/gnu/store/jknf4w4s9w5w71ampcymgn4d14hfwx3h-python-2.7.13-tk/lib/python2.7/site-packages',
    
'/gnu/store/gdgy38ylfm4jaz4cmq6c6650i8iga21l-python2-subprocess32-3.2.7/lib/python2.7/site-packages',
    
'/gnu/store/pdlc7mwmm1vfrkgcpscps5kj0p1gwa14-python2-pygobject-2.28.6/lib/python2.7/site-packages',
    
'/gnu/store/s8sn8r41jyn35aginp63z2232sw9g23a-python2-functools32-3.2.3-2/lib/python2.7/site-packages',
    
'/gnu/store/bj4jlrnai5qlic1arjijyp47isvipca7-python2-pycairo-1.10.0/lib/python2.7/site-packages',
    
'/gnu/store/rhc5rpihy35ss7i9fvc0knqa798br9yj-python2-patsy-0.4.1/lib/python2.7/site-packages',
    
'/gnu/store/mrm8hn8rv04hm80sl63c1w33xs5gg147-python2-pandas-0.19.2/lib/python2.7/site-packages',
    
'/gnu/store/q977dgwlvmak15qn0w2kjk3q322mbrwi-python2-xcffib-0.5.1/lib/python2.7/site-packages',
    
'/gnu/store/gmdlgpm3jyfi608fyjmj6g7svpp5y8lc-python2-cffi-1.11.2/lib/python2.7/site-packages',
    
'/gnu/store/7fziyn0m8wjc98j0g056bms4yv94mi5q-python2-pycparser-2.17/lib/python2.7/site-packages',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python27.zip',
    '/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/plat-linux2',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/lib-tk',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/lib-old',
    
'/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/lib-dynload',
    
'/gnu/store/pdlc7mwmm1vfrkgcpscps5kj0p1gwa14-python2-pygobject-2.28.6/lib/python2.7/site-packages/gtk-2.0',
]
USER_BASE: '/home/uzinnal/.local' (exists)
USER_SITE: '/home/uzinnal/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
--8<---------------cut here---------------end--------------->8---


> If this does not give any insight, change it into
>
> exec -a "$0" python3 -v -c "import statsmodels"

Again with “python3” replaced as “/gnu/store/…-python-2.7.13/bin/python”
I ran this and wasn’t prepared for the deluge of output.  The first time
statsmodels is mentioned is when the prompt appears and “import
statsmodels” is executed.  Interestingly it goes straight to the old
statsmodels-0.6.1 instead of the newer one (0.8.0) which the wrapper
added to PYTHONPATH.

--8<---------------cut here---------------start------------->8---
…
Python 2.7.13 (default, Jan  1 1970, 00:00:01)
[GCC 5.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import statsmodels # directory 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels
# 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.pyc
 matches 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.py
import statsmodels # precompiled from 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/__future__.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/__future__.py
import __future__ # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/__future__.pyc
import numpy # directory 
/gnu/store/xd796qc9kjaslw85jk7f81fxkql021x0-python2-numpy-1.12.0/lib/python2.7/site-packages/numpy
…
--8<---------------cut here---------------end--------------->8---

Here’s what happens before the prompt appears:

--8<---------------cut here---------------start------------->8---
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
import site # from 
/home/uzinnal/.guix-profile/lib/python3.4/site-packages/site.py
# can't create /home/uzinnal/.guix-profile/lib/python3.4/site-packages/site.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/os.pyc 
matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/os.py
import os # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/os.pyc
import errno # builtin
import posix # builtin
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/posixpath.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/posixpath.py
import posixpath # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/posixpath.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/stat.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/stat.py
import stat # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/stat.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/genericpath.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/genericpath.py
import genericpath # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/genericpath.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/warnings.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/warnings.py
import warnings # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/warnings.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/linecache.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/linecache.py
import linecache # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/linecache.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/types.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/types.py
import types # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/types.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/UserDict.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/UserDict.py
import UserDict # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/UserDict.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_abcoll.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_abcoll.py
import _abcoll # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_abcoll.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/abc.pyc 
matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/abc.py
import abc # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/abc.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_weakrefset.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_weakrefset.py
import _weakrefset # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_weakrefset.pyc
import _weakref # builtin
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/copy_reg.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/copy_reg.py
import copy_reg # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/copy_reg.pyc
import imp # builtin
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/site.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/site.py
import site # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/site.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/traceback.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/traceback.py
import traceback # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/traceback.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sysconfig.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sysconfig.py
import sysconfig # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sysconfig.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/re.pyc 
matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/re.py
import re # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/re.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_compile.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_compile.py
import sre_compile # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_compile.pyc
import _sre # builtin
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_parse.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_parse.py
import sre_parse # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_parse.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_constants.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_constants.py
import sre_constants # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/sre_constants.pyc
dlopen("/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/lib-dynload/_locale.so",
 2);
import _locale # dynamically loaded from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/lib-dynload/_locale.so
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_sysconfigdata.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_sysconfigdata.py
import _sysconfigdata # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/_sysconfigdata.pyc
# zipimport: found 32 names in 
/home/uzinnal/.guix-profile/lib/python3.4/site-packages/cairocffi-0.6-py3.4.egg
# zipimport: found 609 names in 
/gnu/store/jjx8l3mxszklsq80hdpjv08yd9j14hc8-python-pytz-2016.3/lib/python3.4/site-packages/pytz-2016.3-py3.4.egg
# zipimport: found 31 names in 
/gnu/store/sdddqkk41g9x895kmsd28v1mniiccwpi-python-dateutil-2.5.2/lib/python3.4/site-packages/python_dateutil-2.5.2-py3.4.egg
# zipimport: found 32 names in 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/cairocffi-0.6-py2.7.egg
# zipimport: found 31 names in 
/gnu/store/xdmyyznc45vcfgrygrq50lbk0z89321k-python2-dateutil-2.5.2/lib/python2.7/site-packages/python_dateutil-2.5.2-py2.7.egg
import encodings # directory 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/__init__.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/__init__.py
import encodings # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/__init__.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/codecs.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/codecs.py
import codecs # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/codecs.pyc
import _codecs # builtin
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/aliases.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/aliases.py
import encodings.aliases # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/aliases.pyc
# 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/utf_8.pyc
 matches 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/utf_8.py
import encodings.utf_8 # precompiled from 
/gnu/store/0n8ni2ldvyz5yd488cidzi3via7jk7pw-python-2.7.13/lib/python2.7/encodings/utf_8.pyc
--8<---------------cut here---------------end--------------->8---

Note that “import site” is satisfied by Python 3, but the behaviour is
the same when I only keep Python 2 things on the PYTHONPATH.

With “-vvvv” I see that the directory containing statsmodels-0.8.0 is in
fact accessed multiple times for
“{site,os,posixpath,stat,genericpath,warnings}.{so,py,pyc}” and many
more; but when the time comes to “import statsmodels” it loads it
from the 0.6.1 directory; it does not look it up in the 0.8.0 directory.

--8<---------------cut here---------------start------------->8---
Python 2.7.13 (default, Jan  1 1970, 00:00:01)
[GCC 5.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
# trying statsmodels.so
# trying statsmodelsmodule.so
# trying statsmodels.py
# trying statsmodels.pyc
# trying 
/gnu/store/b0qkrrkiw0gszw6hdxcbyly6nr9ln7n3-python2-cffi-1.4.2/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.so
# trying 
/gnu/store/b0qkrrkiw0gszw6hdxcbyly6nr9ln7n3-python2-cffi-1.4.2/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodelsmodule.so
# trying 
/gnu/store/b0qkrrkiw0gszw6hdxcbyly6nr9ln7n3-python2-cffi-1.4.2/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.py
# trying 
/gnu/store/b0qkrrkiw0gszw6hdxcbyly6nr9ln7n3-python2-cffi-1.4.2/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.pyc
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodelsmodule.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.py
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/cffi-1.4.2-py2.7-linux-x86_64.egg/statsmodels.pyc
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/statsmodels.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/statsmodelsmodule.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/statsmodels.py
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/statsmodels.pyc
# trying 
/gnu/store/8707rsnrfi3f747pj1jvxr7bwb0kk982-python2-nose-1.3.7/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/statsmodels.so
# trying 
/gnu/store/8707rsnrfi3f747pj1jvxr7bwb0kk982-python2-nose-1.3.7/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/statsmodelsmodule.so
# trying 
/gnu/store/8707rsnrfi3f747pj1jvxr7bwb0kk982-python2-nose-1.3.7/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/statsmodels.py
# trying 
/gnu/store/8707rsnrfi3f747pj1jvxr7bwb0kk982-python2-nose-1.3.7/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/statsmodels.pyc
# trying 
/gnu/store/g6pi1k1py80ah53ig7g34pgp0gr2kr74-python2-six-1.10.0/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.so
# trying 
/gnu/store/g6pi1k1py80ah53ig7g34pgp0gr2kr74-python2-six-1.10.0/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodelsmodule.so
# trying 
/gnu/store/g6pi1k1py80ah53ig7g34pgp0gr2kr74-python2-six-1.10.0/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.py
# trying 
/gnu/store/g6pi1k1py80ah53ig7g34pgp0gr2kr74-python2-six-1.10.0/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.pyc
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/pandas-0.18.1-py2.7-linux-x86_64.egg/statsmodels.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/pandas-0.18.1-py2.7-linux-x86_64.egg/statsmodelsmodule.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/pandas-0.18.1-py2.7-linux-x86_64.egg/statsmodels.py
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/pandas-0.18.1-py2.7-linux-x86_64.egg/statsmodels.pyc
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodelsmodule.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.py
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/six-1.10.0-py2.7.egg/statsmodels.pyc
import statsmodels # directory 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__module.so
# trying 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.py
# 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.pyc
 matches 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.py
import statsmodels # precompiled from 
/home/uzinnal/.guix-profile/lib/python2.7/site-packages/statsmodels-0.6.1-py2.7-linux-x86_64.egg/statsmodels/__init__.pyc
--8<---------------cut here---------------end--------------->8---

Note that lib/python2.7/site-packages (which is on the user’s
PYTHONPATH) contains a file “python2-statsmodels-0.6.1.pth”.  Does this
play a role here?

> exec -a "$0" python3 -v -c "import ribodiff.estimatedisp"
>
> and try to find some insight there.

Unfortunately, this didn’t tell me much more than the previous command.
After numpy is loaded, the old statsmodels is loaded.


> re 2): As soon as Python2 and Python3 are installed in the same profile,
> we put both site-packages for both versions into PYTHONPATH, which
> obviously is wrong.
>
> $ PYTHONPATH= guix environment --ad-hoc address@hidden python
> […]
> [guix] $ echo $PYTHONPATH
> /gnu/store/jkwp041kjy6li85n66ymxkfrr0hr2psj-profile/lib/python2.7/site-packages:/gnu/store/jkwp041kjy6li85n66ymxkfrr0hr2psj-profile/lib/python3.5/site-packages:
>
> A simple work-around would be to make the profile a (pseudo) virtual
> environment, which is a easy as creating a file
> "/gnu/store/…-profile/pyvenv.cfg". This will trigger a mechanism in
> site.py to insert /gnu/store/…-profile/lib/pythonX.Y/site-packages" into
> sys.path - for the current python version only!

This is very good to know.  I haven’t tested this (as I’m not editing
the store by hand), but I suppose we could create an empty pyvenv.cfg in
a profile hook when Python packages are installed.

(This wouldn’t help us much for wrapper scripts, though.)

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]