ubuntu-in-termux
ubuntu-in-termux copied to clipboard
Cannot build python packages under a non-root user
I have ubuntu-in-termux
installed in Termux app (from F-DROID).
I've created a new user (yaraslau
) and am using proot ... /bin/login -f yaraslau
to login directly into the user's bash
shell.
My user is also in the sudoers
: yaraslau ALL=(ALL:ALL) ALL
.
I have python3.10
installed.
I also have a virtual environment created and activated with virtualenvwrapper
:
$ pip -V
pip 22.1.2 from /home/yaraslau/.virtualenvs/scribe/lib/python3.10/site-packages/pip (python 3.10)
Whenever I try to install packages that have wheels with pip install {package_name}
, everything works fine.
But when I try the same for packages that require building I get the same permission denied
error for all any of them:
pip install pyrsistent --verbose
Using pip 22.1.2 from /home/yaraslau/.virtualenvs/scribe/lib/python3.10/site-packages/pip (python 3.10)
Looking in indexes: https://pypi.org/simple, https://pypi.fury.io/DjpJLqHt9rGdNcsq56zc/dialogue/
Collecting pyrsistent
Using cached pyrsistent-0.18.1.tar.gz (100 kB)
Running command pip subprocess to install build dependencies
Looking in indexes: https://pypi.org/simple, https://pypi.fury.io/DjpJLqHt9rGdNcsq56zc/dialogue/, https://pypi.fury.io/DjpJLqHt9rGdNcsq56zc/dialogue/
Collecting setuptools>=42
Using cached setuptools-62.4.0-py3-none-any.whl (1.2 MB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-62.4.0 wheel-0.37.1
Installing build dependencies ... done
Running command Getting requirements to build wheel
running egg_info
writing pyrsistent.egg-info/PKG-INFO
writing dependency_links to pyrsistent.egg-info/dependency_links.txt
writing top-level names to pyrsistent.egg-info/top_level.txt
reading manifest file 'pyrsistent.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.mit'
writing manifest file 'pyrsistent.egg-info/SOURCES.txt'
Getting requirements to build wheel ... done
Running command Preparing metadata (pyproject.toml)
running dist_info
creating /tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info
writing /tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/top_level.txt
writing manifest file '/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.mit'
writing manifest file '/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/SOURCES.txt'
creating '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info'
error: [('/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/dependency_links.txt', '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info/dependency_links.txt', "[Errno 13] Permission denied: '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info/dependency_links.txt'"), ('/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info/top_level.txt', '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info/top_level.txt', "[Errno 13] Permission denied: '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info/top_level.txt'"), ('/tmp/pip-modern-metadata-435gcno0/pyrsistent.egg-info', '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info', "[Errno 13] Permission denied: '/tmp/pip-modern-metadata-435gcno0/pyrsistent-0.18.1.dist-info'")]
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /home/yaraslau/.virtualenvs/scribe/bin/python /home/yaraslau/.virtualenvs/scribe/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxke1ce1r
cwd: /tmp/pip-install-okufrse0/pyrsistent_b5271438419d4d49a7471bfc8360e0cf
Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The permissions on the /tmp
directory seem to be in order:
drwxrwxrwt. 2 yaraslau yaraslau 3452 Jun 16 11:45 tmp/
...except for this suspecious selinux-like .
🤨
drwxrwxrwt. 2 yaraslau yaraslau u:object_r:app_data_file:s0:c176,c257,c512,c768 3452 Jun 16 11:45 tmp/
Running sudo pip install
works correctly but installs the package globally.
Runing the virtualenv version with sudo
also works as expected:
$ sudo /home/yaraslau/.virtualenvs/scribe/bin/pip install pyrsistent
Collecting pyrsistent
Downloading pyrsistent-0.18.1.tar.gz (100 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.5/100.5 kB 2.1 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyrsistent
Building wheel for pyrsistent (pyproject.toml) ... done
Created wheel for pyrsistent: filename=pyrsistent-0.18.1-cp310-cp310-linux_aarch64.whl size=106247 sha256=2584f363dd7c7ca7121c4d0728eeda998894f6722d57863d3abc1477252cd126
Stored in directory: /root/.cache/pip/wheels/42/cf/03/ae35459d6c32fce920e7eb28fa325fdeced7a39fb9b98c56f0
Successfully built pyrsistent
Installing collected packages: pyrsistent
Successfully installed pyrsistent-0.18.1
What can possibly be wrong with my user's permissions? 🤔
Just in case, all the dependencies install fine on the "generic" Ubuntu on the laptop.