pdm
pdm copied to clipboard
pdm install won't install local development package
- [x] I have searched the issue tracker and believe that this is not a duplicate.
Make sure you run commands with -v
flag before pasting the output.
Steps to reproduce
I wanted to create a small package for future projects and so I created this pyproject.toml:
[project]
name = "sql-commander"
version = "0.1.0"
description = "SQL Script verifier"
authors = [
{name = "Foo Bar",email = "[email protected]"},
]
dependencies = [
"attrs>=22.2.0",
"tomlkit>=0.11.6",
]
requires-python = ">=3.6"
readme = "README.md"
license = {text = "propietary"}
[project.optional-dependencies]
dev = [
"setuptools>=59.6.0",
"wheel>=0.37.1",
]
[build-system]
requires = ["setuptools>=59"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
package-dir = { '' = 'src' }
include-package-data = true
[tool.setuptools.packages.find]
where = ['src']
include = ['sql_commander']
namespaces = false
[tool.pdm]
distribution = true
[tool.pdm.build]
package-dir = 'src'
Actual behavior
Running pdm install -v
fails with this error message at the end:
✖ Install sql_commander 0.1.0 failed
Traceback (most recent call last):
File "/home/user/.local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/core.py", line 288, in main
return Core().main(args or sys.argv[1:])
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/core.py", line 208, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/core.py", line 203, in main
self.handle(project, options)
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/core.py", line 157, in handle
command.handle(project, options)
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/cli/commands/install.py", line 100, in handle
actions.do_sync(
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/cli/actions.py", line 237, in do_sync
synchronizer.synchronize()
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 465, in synchronize
self.install_candidate(self_key, progress)
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 286, in install_candidate
self.manager.install(can)
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/installers/manager.py", line 34, in install
dist_info = installer(str(prepared.build()), self.environment, prepared.direct_url())
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/installers/installers.py", line 201, in install_wheel
scheme_dict=environment.get_paths(_get_dist_name(wheel)),
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/installers/installers.py", line 54, in _get_dist_name
return parse_wheel_filename(os.path.basename(wheel_path))[0]
File "/home/user/.local/share/pdm/venv/lib/python3.8/site-packages/packaging/utils.py", line 128, in parse_wheel_filename
raise InvalidWheelFilename(
packaging.utils.InvalidWheelFilename: Invalid wheel filename (invalid version): sql-commander-0.1.0-ed.py3-none-any
I'm concerned about the version 0.1.0-ed which I never specified, however it is there.
Expected behavior
Well, of course the package should be installed in editable mode. :)
Environment Information
# Paste the output of `pdm info && pdm info --env` below:
PDM version:
2.12.3
Python Interpreter:
/home/user/path_to/sql/.venv/bin/python (3.6)
Project Root:
/home/user/path_to/sql
Local Packages:
{
"implementation_name": "cpython",
"implementation_version": "3.6.15",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_release": "5.15.0-94-generic",
"platform_system": "Linux",
"platform_version": "#104~20.04.1-Ubuntu SMP Tue Jan 16 13:34:09 UTC 2024",
"python_full_version": "3.6.15",
"platform_python_implementation": "CPython",
"python_version": "3.6",
"sys_platform": "linux"
}
Yes, I know, I'm using Python 3.6 for my project, but this is because of system limitations (old Linux environment, to be upgraded soon). However I never had a problem before.
Solved this issue for the moment by using ./.venv/bin/python -m ensurepip && ./.venv/bin/python -m pip install -U pip && ./.venv/bin/python -m pip install -e .
It looks like requires-python = ">=3.6"
is preventing the build system to use recent version of setuptools
and wheel
. Upgrading it to requires-python = ">=3.7"
seems to fix the issue. Your build requirements actually require Python >= 3.8, so I'd recommend using that.
This behavior was explained by the numerous warnings printed to the console:
PackageWarning: Skipping [email protected] because it requires Python>=3.8 but the project claims to work with Python>=3.6. Instead, another
version of setuptools that supports Python>=3.6 will be used.
If you want to install [email protected], narrow down the `requires-python` range to include this version. For example, ">=3.8" should work.
...
PackageWarning: Skipping [email protected] because it requires Python>=3.7 but the project claims to work with Python>=3.6. Instead, another version
of wheel that supports Python>=3.6 will be used.
If you want to install [email protected], narrow down the `requires-python` range to include this version. For example, ">=3.7" should work.
...
(but maybe you had the quiet
option turned on)
Or maybe something clashes between your build requirements and your optional dependencies. Why do you list setuptools and wheel in a dev
optional group? This would only be useful if you wanted to build your package in non-isolated mode.
Well, I'm going to verify the case if Python 3.6 might be the bad guy.
It's just a behavior to install setuptools
and wheel
as part of the dev dependencies.
@pawamoy is right, the bad file name is generated by the backend setuptools
, which installs a problematic version on Python 3.6. Not a bug of PDM. I am closing it now.