pypa / pypa/setuptools

[BUG] --editable Permission Denied

Open
#4,667 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Waiting User Feedback
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

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
  1. Create a second user for running the venv ("python")
  2. Create the venv with the user (sudo -u python \which python3.11` -m venv /opt/venv/venv`)
  3. Create 2 editable packages
  4. 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two editable installs with the sudo user and an unwritable working directory, then trace the editable-install path that creates the editable.first_editable finder entry. Done means the second editable installation succeeds in that environment and a regression test covers the permission-denied case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.