<< Python problem: ImportError: No module named site >>

Hello,

I had program called CIF2CELL running well.

After updating my system (OpenSUSE Tumbleweed) I am getting the subject error:
ImportError: No module named site

I removed the CIF2CELL folder and did a clean install.

Some infos:

In my .bashrc:


export PYTHONPATH=/software/cif2cell/lib/python2.7/site-packages/:$PYTHONPATH
export PYTHONHOME=/usr

Some outputs from python checks:


python -i
>>> import site; site.getsitepackages()
'/usr/lib64/python2.7/site-packages', '/usr/lib64/site-python', '/usr/lib/python2.7/site-packages', '/usr/lib/site-python']


and


python -m site
sys.path = 
    '/home/icamps',
    '/software/cif2cell/lib/python2.7/site-packages',
    '/usr/lib/python27.zip',
    '/usr/lib64/python2.7',
    '/usr/lib64/python2.7/plat-linux2',
    '/usr/lib64/python2.7/lib-tk',
    '/usr/lib64/python2.7/lib-old',
    '/usr/lib64/python2.7/lib-dynload',
    '/usr/lib64/python2.7/site-packages',
    '/usr/lib64/python2.7/site-packages/PIL',
    '/usr/local/lib64/python2.7/site-packages',
    '/usr/local/lib/python2.7/site-packages',
    '/usr/lib64/python2.7/site-packages/gtk-2.0',
    '/usr/lib/python2.7/site-packages',
    '/usr/local/lib64/python2.7/site-packages',
    '/usr/local/lib/python2.7/site-packages',
]
USER_BASE: '/home/hatuey/.local' (exists)
USER_SITE: '/home/hatuey/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

I appreciate any help solving this issue.

Regards,

Hatuey

I suspect that you installed your site library as a subdirectory of your $HOME folder.
When you do that, it can be found by your Python app only when you’re logged in as that User or using sudo to elevate permissions…
If you instead open a root console with “su” your $HOME path will point to /root/ instead of your current home directory…

Or the scenarios I described above can be reversed.

It’s why (besides security implications) I don’t recommend the common practice of installing libraries in your $HOME folder, instead recommending a root subdirectory like /opt/.

Speculating,
TSU