Open
Description
setuptools version
75.1.0
Python version
Python 3.11
OS
RHEL 8.8
Additional environment information
Virtual Environment
venv is typically executed by sudoing to a specific user and running the venv/bin/python
or venv/bin/pip
Main user is "dan", other user is "python" (for simplicity)
Description
I have a few editables installed in a virtual environment.
When I try to install a new editable via pip by running the following command sudo -u python /opt/venv/bin/pip install /opt/new-editable
I typically get a "Permission Denied".
If I cd to a directory where "python" has permission to write first ("/tmp" for example), the install will typically succeed.
Expected behavior
Installation of the editable to succeed regardless of the directory the pre-sudo user is in.
How to Reproduce
- Create a second user for running the venv ("python")
- Create the venv with the user (
sudo -u python \
which python3.11` -m venv /opt/venv/venv`) - Create 2 editable packages
- Install the 2 packages, one at a time, into the venv as the user (
sudo -u python /opt/venv/venv/bin/pip install -e /opt/venv/second_editable/
)
Output
[dan@dev ~]$ sudo -u python `which python3.11` -m venv /opt/venv/venv
[dan@dev ~]$ sudo -u python /opt/venv/venv/bin/pip install -e /opt/venv/first_editable/
Obtaining file:///opt/venv/first_editable
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: first_editable
Building editable for first_editable (pyproject.toml) ... done
Created wheel for first_editable: filename=first_editable-0.0.1-0.editable-py3-none-any.whl size=2833 sha256=589ba39d2e2953e1df8df4a1005b462b0f3d356b81e0c7761295bb9b7dcdd6ae
Stored in directory: /tmp/pip-ephem-wheel-cache-0cjmayom/wheels/f2/c7/26/b1d532a00a1d34a5be737c43ae10a72f8f38aa0715ab6c88b3
Successfully built first_editable
Installing collected packages: first_editable
Successfully installed first_editable-0.0.1
[notice] A new release of pip available: 22.3.1 -> 24.2
[notice] To update, run: python3.11 -m pip install --upgrade pip
[dan@dev ~]$ sudo -u python /opt/venv/venv/bin/pip install -e /opt/venv/second_editable/
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '__editable__.first_editable-0.0.1.finder.__path_hook__'
Check the permissions.
[notice] A new release of pip available: 22.3.1 -> 24.2
[notice] To update, run: python3.11 -m pip install --upgrade pip