Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDM fails automatic self-install with a DistlibException: path must end with .egg-info or .egg #307

Closed
1 task done
ElijahSink opened this issue Mar 16, 2021 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@ElijahSink
Copy link
Contributor

ElijahSink commented Mar 16, 2021

  • 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 have a package with a pyproject.toml:

[project]
name = "my-package"
version = "2.5.0"
description = "My package description"
authors = [
    {name = "Elijah Sink", email = "ejsink@domain.com"},
]
dependencies = [
    "aiohttp",
    "asyncpg",
    "dateparser",
    "pycryptodome",
    "pynacl",
    "selenium",
    "pyvirtualdisplay",
    "toolset[myextra] @ git+ssh://private/git/url/toolset.git@1.0.0-staging",
]
dev-dependencies = [
    "python-dotenv",
    "boto3",
    "pytest",
    "pytest-asyncio",
]
requires-python = ">=3.9"
dynamic = ["classifiers"]
license = {text = ""}

[project.urls]
homepage = ""

[tool]
[tool.pdm]
[tool.pdm.scripts]
_.env_file = '.env'
test = 'pytest my-package -v'
download-test-data = "python -m my-package.test.data.Download"
generate-test-data = "python -m my-package.test.data.Generate"
publish-test-data = "python -m my-package.test.data.Publish"
unpublish-test-data = "python -m my-package.test.data.Unpublish"


[[tool.pdm.source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true


[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"

Actual behavior

❯ pdm install -d -v
Synchronizing working set with lock file: 14 to add, 0 to update, 0 to remove

  Install iniconfig 1.1.1 successful
  Install pyparsing 2.4.7 successful
  Install pluggy 0.13.1 successful
  Install jmespath 0.10.0 successful
  Install packaging 20.9 successful
  Install pytest-asyncio 0.14.0 successful
  Install python-dotenv 0.15.0 successful
  Install toml 0.10.2 successful
  Install py 1.10.0 successful
  Install s3transfer 0.3.4 successful
  Install boto3 1.17.28 successful
  Install pytest 6.2.2 successful
  Install botocore 1.20.28 successful
Installing the project as an editable package...
Using cached wheel link: file:///home/ejsink/.cache/pdm/wheels/86/83/d6/2beff4da4a3954de09a366c5f60b5fead9afd31c82f4225b91/my_package-2.5.0-py3-none-any.whl
  Install my-package 2.5.0 failed
Traceback (most recent call last):
  File "/home/ejsink/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 76, in __call__
    return self.main(*args, **kwargs)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 131, in main
    raise err.with_traceback(traceback)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 127, in main
    f(options.project, options)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/commands/install.py", line 39, in handle
    actions.do_sync(
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 130, in do_sync
    handler.synchronize(clean=clean, dry_run=dry_run)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 336, in synchronize
    handlers[install_self[0]](install_self[1])
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 146, in install_candidate
    installer.install(can)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/installers.py", line 44, in install
    candidate.get_metadata(allow_all_wheels=False)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 156, in get_metadata
    sdist = get_sdist(built)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 28, in get_sdist
    return EggInfoDistribution(egg_info) if egg_info else None
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/distlib/database.py", line 878, in __init__
    metadata = self._get_metadata(path)
  File "/home/ejsink/.local/pipx/venvs/pdm/lib/python3.9/site-packages/distlib/database.py", line 960, in _get_metadata
    raise DistlibException('path must end with .egg-info or .egg, '
distlib.DistlibException: path must end with .egg-info or .egg, got '/home/ejsink/.cache/pdm/wheels/my_package-2.5.0-py3-none-any.whl'

Expected behavior

I expect to be able to install dependencies successfully.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
❯ pdm info && pdm info --env
PDM version:        1.3.5.dev19+ge2d5400
Python Interpreter: /usr/bin/python (3.9.1)
Project Root:       /home/ejsink/my-package
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.1",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "4.19.128-microsoft-standard",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Tue Jun 23 12:58:10 UTC 2020",
  "python_full_version": "3.9.1",
  "platform_python_implementaiton": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}

I solved the issue by running rm -rf ~/.cache/pdm, but I think that pdm should detect the cache invalidity and remove it automatically. The issue seems to be that the cache was invalid due to the package having been built differently in the past.

@ElijahSink ElijahSink added the 🐛 bug Something isn't working label Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant