pdm install fails to create editable package
See original GitHub issueSince yesterday I have encountered this problem. We can’t build the editable package (–no-editable is a workaround).
My teammate tells me that it works on his machine (he’s on Manjaro). I am on Ubuntu 22.04. We both have reproduced the problem on a python-debian container:
Dockerfile:
FROM python:3.10.4-slim-buster
RUN pip install pdm
VOLUME /code
WORKDIR /code
pyproject.toml:
[project]
authors = [
{name = "Tommy"},
]
dependencies = []
description = "Bug project"
name = "bug-project"
readme = "README.md"
requires-python = ">=3.10"
dynamic = ["version"]
license = {text = "Proprietary"}
[project.optional-dependencies]
[build-sytem]
build-backend = "pdm.pep517.api"
requires = ["pdm-pep517"]
[tool.pdm]
version = {use_scm = true}
How to run:
docker build -t pdm-test .
docker run -it --rm -v $(pwd):/code pdm-test pdm install -v
Result:
Installing the project as an editable package...
Preparing isolated env for PEP 517 build...
Building wheel for file:///code#egg=bug-project
Collecting wheel
Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=40.8.0
Downloading setuptools-62.2.0-py3-none-any.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 10.3 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools
Successfully installed setuptools-62.2.0 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting setuptools_pep660
Downloading setuptools_pep660-0.1.3-py3-none-any.whl (4.1 kB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting setuptools<61,>=42
Downloading setuptools-60.10.0-py3-none-any.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 6.6 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools, setuptools_pep660
Successfully installed setuptools-62.2.0 setuptools_pep660-0.1.3 wheel-0.37.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.parse_configuration` became deprecated.
For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.
warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp_ya6l2qu', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py", line 283, in build_editable
return hook(wheel_directory, config_settings, metadata_directory)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools_pep660/__init__.py", line 11, in build_editable
return setuptools.build_meta._BACKEND._build_with_temp_dir(
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 229, in _build_with_temp_dir
self.run_setup()
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 28, in <module>
setup(**setup_kwargs)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 135, in setup
ok = dist.parse_command_line()
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 484, in parse_command_line
args = self._parse_command_opts(parser, args)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/dist.py", line 1070, in _parse_command_opts
nargs = _Distribution._parse_command_opts(self, parser, args)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 540, in _parse_command_opts
cmd_class = self.get_command_class(command)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/dist.py", line 916, in get_command_class
self._install_dependencies(ep)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/dist.py", line 882, in _install_dependencies
self.fetch_build_egg(pkg_resources.Requirement(str(req)))
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/dist.py", line 907, in fetch_build_egg
return fetch_build_egg(self, req)
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp_ya6l2qu', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
Install bug-project 0.0.0 failed
Traceback (most recent call last):
File "/usr/local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 233, in main
return Core().main(args)
File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 168, in main
raise cast(Exception, err).with_traceback(traceback)
File "/usr/local/lib/python3.10/site-packages/pdm/core.py", line 163, in main
f(options.project, options)
File "/usr/local/lib/python3.10/site-packages/pdm/cli/commands/install.py", line 49, in handle
actions.do_sync(
File "/usr/local/lib/python3.10/site-packages/pdm/cli/actions.py", line 209, in do_sync
handler.synchronize()
File "/usr/local/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 389, in synchronize
self.install_candidate(self_key)
File "/usr/local/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 207, in install_candidate
self.manager.install(can)
File "/usr/local/lib/python3.10/site-packages/pdm/installers/manager.py", line 39, in install
installer(prepared.build(), self.environment, prepared.direct_url())
File "/usr/local/lib/python3.10/site-packages/pdm/models/candidates.py", line 331, in build
self.wheel = builder.build(build_dir, metadata_directory=self._metadata_dir)
File "/usr/local/lib/python3.10/site-packages/pdm/builders/editable.py", line 57, in build
return self.build(out_dir, config_settings, metadata_directory)
File "/usr/local/lib/python3.10/site-packages/pdm/builders/editable.py", line 52, in build
filename = self._hook.build_editable(
File "/usr/local/lib/python3.10/site-packages/pep517/wrappers.py", line 261, in build_editable
return self._call_hook('build_editable', {
File "/usr/local/lib/python3.10/site-packages/pep517/wrappers.py", line 322, in _call_hook
self._subprocess_runner(
File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 238, in subprocess_runner
return log_subprocessor(cmd, cwd, extra_environ=env)
File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 86, in log_subprocessor
raise BuildError(
pdm.exceptions.BuildError: Call command ['/usr/local/bin/python', '/usr/local/lib/python3.10/site-packages/pep517/in_process/_in_process.py', 'build_editable', '/tmp/tmplq5e_c0n'] return non-zero status(1).
We suspect the problem comes from not finding pip:
warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
/usr/local/bin/python: No module named pip
Traceback (most recent call last):
File "/tmp/pdm-build-env-3x_k6j72-shared/lib/python3.10/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp_ya6l2qu', '--quiet', 'setuptools<61,>=42']' returned non-zero exit status 1.
We verified that we have pip:
/usr/local/bin/python -m pip --version
pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Broken editable install of the project itself? · Issue #649 - GitHub
At this point I tried everything: reinstalling PDM, switching the feature.install_cache on and off, deleting PDM's cache, reinstalling all ...
Read more >Manage Dependencies - PDM
Editable installs are only allowed in the dev dependency group. Other groups, including the default, will fail with a [PdmUsageError] .
Read more >pdm-pep517 - PyPI
A PEP 517 backend for PDM that supports PEP 621 metadata. ... [tool.pdm.build] # Specify where the Python packages live. package-dir = "src"...
Read more >Installing Private Python Packages - Read the Docs
Read the Docs uses pip to install your Python packages. If you have private dependencies, you can install them from a private Git...
Read more >Installing local package with "pip install -e ." does not update ...
My guess is that you need to uninstall the package, since you first installed it in non-editable mode, before installing it again in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh, there is a typo in your
pyproject.tomlShould be
[build-system]BTW, I didn’t reproduce with the dockerfile your provided
Yeah I can confirm fixing the typo fixed the problem… shame on me 😛 !
Thank you for the time and sorry for the disturbance!
I would suggest adding a warning when the
[build-system]table is not found 😃