Install with flatpak-builder build --force-clean --install --user org.test.test.yaml
Running and importing dill library failed.
kevin@localhost:~/Desktop/test_pip3> flatpak run --command=bash org.test.test
[📦 org.test.test test_pip3]$ pip3 install dill
Defaulting to user installation because normal site-packages is not writeable
Collecting dill
Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Installing collected packages: dill
Successfully installed dill-0.3.6
[📦 org.test.test test_pip3]$ python3
Python 3.10.11 (main, Nov 10 2011, 15:00:00) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
FileNotFoundError: [Errno 2] No such file or directory: '/etc/pythonstart'
>>> import dill
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dill'
pip3 also does not see dill that it just installed
[📦 org.test.test test_pip3]$ pip3 list
Package Version
---------- -------
Cython 0.29.35
Mako 1.2.4
Markdown 3.4.3
MarkupSafe 2.1.2
meson 0.63.3
pip 23.1.2
Pygments 2.15.1
setuptools 67.8.0
six 1.16.0
wheel 0.38.4
After some digging it seems like there have something to do with sys.path.
An attempt to add path to sys.path with PYTHONPATH env does not work.
[📦 org.test.test test_pip3]$ export PYTHONPATH=/home/kevin/.local/lib/python3.10/site-packages:$PYTHONPATH
[📦 org.test.test test_pip3]$ python
Python 3.10.11 (main, Nov 10 2011, 15:00:00) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
FileNotFoundError: [Errno 2] No such file or directory: '/etc/pythonstart'
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/app/lib/python3.10/site-packages', '/usr/lib/python3.10/site-packages']
>>>
I don’t know Python therefore I can’t help much. But the package was found with pip list --path <site-package PATH>, maybe it helps in finding a workaround.