Results 1 to 2 of 2

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

  1. #1

    Default << 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:
    Code:
    export PYTHONPATH=/software/cif2cell/lib/python2.7/site-packages/:$PYTHONPATH
    export PYTHONHOME=/usr
    Some outputs from python checks:

    Code:
    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

    Code:
    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

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,827
    Blog Entries
    1

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

    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
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •