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

Poetry failed to load dependencies on some sdist #9272

Closed
isra17 opened this issue Apr 4, 2024 · 6 comments
Closed

Poetry failed to load dependencies on some sdist #9272

isra17 opened this issue Apr 4, 2024 · 6 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@isra17
Copy link

isra17 commented Apr 4, 2024

Description

Using a custom Pypi repository (Codeartifact) I stumbled into a dependency errors while moving to Pants. As it turns out, Poetry wasn't installing one of our package (opentelemetry-api) proper dependencies. I was able to reproduce with Pypi, by using a custom repository with Pypi legacy API (https://pypi.org/simple).

When installing opentelemetry-api using the custom repository without the JSON API, none of its dependencies are installed:

$ poetry install -vvv
Adding repository pyro (https://pypi.org/simple) and setting it as the default one
Deactivating the PyPI repository
Using virtualenv: /Users/israelhalle/Library/Caches/pypoetry/virtualenvs/repro-poetry-bug-t4OIZuze-py3.11
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 1 install, 0 updates, 0 removals

  • Installing opentelemetry-api (1.24.0): Pending...
Creating new session for pypi.org
  • Installing opentelemetry-api (1.24.0): Installing...
  • Installing opentelemetry-api (1.24.0)

Running poetry lock shows similar issue:

$ poetry lock -vvv
Adding repository pyro (https://pypi.org/simple) and setting it as the default one
Deactivating the PyPI repository
Using virtualenv: /Users/israelhalle/Library/Caches/pypoetry/virtualenvs/repro-poetry-bug-t4OIZuze-py3.11
Updating dependencies
Resolving dependencies...
   1: fact: repro-poetry-bug is 0.1.0
   1: derived: repro-poetry-bug
   1: fact: repro-poetry-bug depends on opentelemetry-api (^1.24.0)
   1: selecting repro-poetry-bug (0.1.0)
   1: derived: opentelemetry-api (>=1.24.0,<2.0.0)
Creating new session for pypi.org
Source (pyro): 1 packages found for opentelemetry-api >=1.24.0,<2.0.0
   1: selecting opentelemetry-api (1.24.0)
   1: Version solving took 0.035 seconds.
   1: Tried 1 solutions.

Workarounds

I suppose I can manually add each dependency. I was able to catch one package having this issue, but how many of them have the same issue?

Poetry Installation Method

pip

Operating System

MacOS

Poetry Version

Poetry (version 1.5.1)

Poetry Configuration

cache-dir = "/Users/XXX/Library/Caches/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
repositories.pyro.url = "https://pypi.org/simple/"
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/XXX/Library/Caches/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"

Python Sysconfig

No response

Example pyproject.toml

[tool.poetry]
name = "repro_poetry_bug"
version = "0.1.0"

[tool.poetry.dependencies]
python = "3.11.3"
opentelemetry-api = "^1.24.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[[tool.poetry.source]]
name = "pyro"
url = "https://pypi.org/simple/"
priority = "default"

Poetry Runtime Logs

$ poetry install -vvv
Adding repository pyro (https://pypi.org/simple) and setting it as the default one
Deactivating the PyPI repository
Using virtualenv: /Users/israelhalle/Library/Caches/pypoetry/virtualenvs/repro-poetry-bug-t4OIZuze-py3.11
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 1 install, 0 updates, 0 removals

  • Installing opentelemetry-api (1.24.0): Pending...
Creating new session for pypi.org
  • Installing opentelemetry-api (1.24.0): Installing...
  • Installing opentelemetry-api (1.24.0)
@isra17 isra17 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Apr 4, 2024
@dimbleby
Copy link
Contributor

dimbleby commented Apr 4, 2024

presumably duplicate #9191, #9266, etc: please close

@isra17
Copy link
Author

isra17 commented Apr 4, 2024

Hum, I did run the command refered and upgraded my poetry instance and I still have the same issue:

$ poetry self show
argon2-cffi          23.1.0    Argon2 for Python
argon2-cffi-bindings 21.2.0    Low-level CFFI bindings for Argon2
build                1.2.1     A simple, correct Python build frontend
cachecontrol         0.14.0    httplib2 caching for requests
certifi              2024.2.2  Python package for providing Mozilla's CA Bundle.
cffi                 1.16.0    Foreign Function Interface for Python calling C code.
charset-normalizer   3.3.2     The Real First Universal Charset Detector. Open, modern and actively m...
cleo                 2.1.0     Cleo allows you to create beautiful and testable command-line interfaces.
crashtest            0.4.1     Manage Python errors with ease
distlib              0.3.8     Distribution utilities
dulwich              0.21.7    Python Git Library
fastjsonschema       2.19.1    Fastest Python implementation of JSON schema
filelock             3.13.3    A platform independent file lock.
idna                 3.6       Internationalized Domain Names in Applications (IDNA)
importlib-metadata   7.1.0     Read metadata from Python packages
installer            0.7.0     A library for installing Python wheels.
jaraco-classes       3.4.0     Utility functions for Python class constructs
keyring              24.3.1    Store and access your passwords safely.
keyrings-cryptfile   1.3.9     Encrypted file keyring backend
more-itertools       10.2.0    More routines for operating on iterables, beyond itertools
msgpack              1.0.8     MessagePack serializer
packaging            24.0      Core utilities for Python packages
pexpect              4.9.0     Pexpect allows easy control of interactive console applications.
pkginfo              1.10.0    Query metadata from sdists / bdists / installed packages.
platformdirs         3.11.0    A small Python package for determining appropriate platform-specific d...
poetry               1.8.2     Python dependency management and packaging made easy.
poetry-core          1.9.0     Poetry PEP 517 Build Backend
poetry-plugin-export 1.7.1     Poetry plugin to export the dependencies to various formats
ptyprocess           0.7.0     Run a subprocess in a pseudo terminal
pycparser            2.22      C parser in Python
pycryptodome         3.20.0    Cryptographic library for Python
pyproject-hooks      1.0.0     Wrappers to call pyproject.toml-based build backend hooks.
rapidfuzz            3.7.0     rapid fuzzy string matching
requests             2.31.0    Python HTTP for Humans.
requests-toolbelt    1.0.0     A utility belt for advanced users of python-requests
shellingham          1.5.4     Tool to Detect Surrounding Shell
tomlkit              0.12.4    Style preserving TOML library
trove-classifiers    2024.3.25 Canonical source for classifiers on PyPI (pypi.org).
urllib3              1.26.18   HTTP library with thread-safe connection pooling, file post, and more.
virtualenv           20.25.1   Virtual Python Environment builder
xattr                1.1.0     Python wrapper for extended filesystem attributes
zipp                 3.18.1    Backport of pathlib-compatible object wrapper for zip files

@dimbleby
Copy link
Contributor

dimbleby commented Apr 4, 2024

I expect you did not clear your cache

@isra17
Copy link
Author

isra17 commented Apr 4, 2024

I did clear my poetry cache. Let me try in a docker container to make sure.

@isra17
Copy link
Author

isra17 commented Apr 4, 2024

Deleted the wrong cache. This fixed it. Thanks!

Copy link

github-actions bot commented May 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants