Skip to content

system packages hide appimages one #26

@niess

Description

@niess

Let say that we generate a conda image with numpy packaged inside, e.g. as:

export CONDA_CHANNEL=anaconda
export CONDA_PACKAGES=numpy
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin conda -i numpy.png -d numpy.desktop --output appimage

Then if there is a system install of numpy, in /usr/local/lib/python3.7/site-packages/ it will be loaded instead of the AppImage one. You can check this by running:

sudo pip3.7 install numpy
./numpy-x86_64.AppImage -c "import numpy; print(numpy)"
sudo pip3.7 uninstall numpy
./numpy-x86_64.AppImage -c "import numpy; print(numpy)"

The reason is that at its init Python thinks it is running from a system install and as so it adds this fixed location to is search path before the AppImage site packages. You can see this by running:

./numpy-x86_64.AppImage -c "import sys; print(sys.path)"

The last item is the AppImage site packages. It is preceded by the fixed /usr/local/lib/python3.7/site-packages/ search path.

Possible solution: remove this /usr/local/lib/python3.7/site-packages/ at Python's init by adding a sitecustomize.py file to the AppImage site packages. For example as here. Note that it might happen that someone explicitly requests this location by adding it to PYTHONPATH. In this case it should not be removed from the search path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions