niess / python-appimage

AppImage distributions of Python
https://python-appimage.readthedocs.io/en/latest/
GNU General Public License v3.0
170 stars 24 forks source link

Set rpath also to $ORIGIN/../lib #64

Closed probonopd closed 1 year ago

probonopd commented 1 year ago

Hello @niess, when one uses python3 -m virtualenv --copies venv, then the python* and pip* executables get copied into the virtual environment at venv/bin.

One needs to manually copy libraries to venv/lib, which is doable.

But it would be nice if python-appimage would add $ORIGIN/../lib to the rpath in addition to the path that it currently sets. This way, the libraries would be recognized from there.

What do you think?

(My use case)

niess commented 1 year ago

Hello @probonopd,

that's fine to me. It should be done now, in the latest released Python AppImages.

Concerning your use case, in fix2, I suspect that the following line

./python3/opt/python3.9/bin/python3.9 -m virtualenv --copies venv

might actually call the host virtualenv package (located under $HOME/.local), since it is not packaged in the AppImage (venv is, but not virtualenv). This might not be an issue. But, in order to isolate from the host, one could instead do

./python3/usr/bin/python3.9 -I -m pip install virtualenv
./python3/opt/python3.9/bin/python3.9 -I -m virtualenv --copies venv

The first line should install virtualenv to the extracted AppImage (i.e. ./python3). The -I option ensures that host packages are not visible / used.

probonopd commented 1 year ago

Thank you very much @niess. This project is incredibly helpful.