setuptools: [BUG] Permission denied error to install pkg editable and user mode
setuptools version
60.5.0
Python version
3.10.1
OS
Archlinux
Additional environment information
No response
Description
When I install a custom package with pip in user mode and editable, it produces permission denied error:
$ pip install --user --no-deps --no-use-pep517 -e .
Obtaining file:///home/jinserk/public/c2tk
Preparing metadata (setup.py) ... done
Installing collected packages: c2tk
Running setup.py develop for c2tk
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jinserk/public/c2tk/setup.py'"'"'; __file__='"'"'/home/jinserk/public/c2tk/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
cwd: /home/jinserk/public/c2tk/
Complete output (7 lines):
running develop
/home/jinserk/.local/lib/python3.10/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/home/jinserk/.local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running egg_info
error: [Errno 13] Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jinserk/public/c2tk/setup.py'"'"'; __file__='"'"'/home/jinserk/public/c2tk/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.
Expected behavior
Install the package into $HOME/.local/lib/python3.10/site-packages
How to Reproduce
- Check you’re using python 3.10.1
- upgrade all the build env
pip install -U pip setuptools wheel
- clone the repo:
git clone https://github.com/jinserk/c2tk.git
- Install it with pip, editable and user mode
cd c2tk
pip install --user --no-deps --no-use-pep517 -e .
Output
$ pip install --user --no-deps --no-use-pep517 -e .
Obtaining file:///home/jinserk/public/c2tk
Preparing metadata (setup.py) ... done
Installing collected packages: c2tk
Running setup.py develop for c2tk
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jinserk/public/c2tk/setup.py'"'"'; __file__='"'"'/home/jinserk/public/c2tk/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
cwd: /home/jinserk/public/c2tk/
Complete output (7 lines):
running develop
/home/jinserk/.local/lib/python3.10/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/home/jinserk/.local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running egg_info
error: [Errno 13] Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/jinserk/public/c2tk/setup.py'"'"'; __file__='"'"'/home/jinserk/public/c2tk/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix= Check the logs for full command output.
Code of Conduct
- I agree to follow the PSF Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 19 (17 by maintainers)
Links to this issue
Commits related to this issue
- CodeQL: Use venv A bug in pip or possibly setuptools broke editable installs into the per-user directory for packages that have pyproject.toml See https://github.com/pypa/setuptools/issues/3019 — committed to hexagonrecursion/borg by hexagonrecursion 2 years ago
- Fix editable --user installs with build isolation https://github.com/pypa/setuptools/issues/3019 — committed to hexagonrecursion/setuptools by hexagonrecursion 2 years ago
- Fix editable --user installs with build isolation https://github.com/pypa/setuptools/issues/3019 — committed to hexagonrecursion/setuptools by hexagonrecursion 2 years ago
- Fix editable --user installs with build isolation https://github.com/pypa/setuptools/issues/3019 — committed to hexagonrecursion/setuptools by hexagonrecursion 2 years ago
- setuptools base version >=62.* Can use pyproject.toml to install in editable mode for this version of setuptools (https://github.com/pypa/setuptools/issues/3019#issuecomment-1264613828) — committed to sbillinge/diffpy.utils by Sparks29032 4 months ago
What PR? I’ll open one once I have figured out how to fix it. For now I only know how to hack around the issue and even then I am not sure that my hack works properly. I am, havever, making progress towards uncovering the root cause.
https://github.com/pypa/setuptools/blob/00fbad0f93ffdba0a4d5c3f2012fd7c3de9af04d/setuptools/command/easy_install.py#L272-L277
Ref: https://github.com/pypa/pip/blob/6d1c027ec877f9a52bd7e7d3ff53e3a4ca7e9cea/src/pip/_internal/operations/install/editable_legacy.py