python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.85k stars 2.28k forks source link

Could not find a matching version of package #9874

Closed alexkiro closed 2 days ago

alexkiro commented 2 days ago

Description

Poetry doesn't seem to be able to find version 1.0.8 of this package, only 1.0.7:

kiro@kiro-desktop:/tmp$ poetry --version
Poetry (version 1.8.4)
kiro@kiro-desktop:/tmp$ poetry new poetry-demo
Created package poetry_demo in poetry-demo
kiro@kiro-desktop:/tmp$ cd poetry-demo/
kiro@kiro-desktop:/tmp/poetry-demo$ ls -la
total 44
drwxrwxr-x  4 kiro kiro  4096 nov 25 14:44 .
drwxrwxrwt 51 root root 24576 nov 25 14:44 ..
drwxrwxr-x  2 kiro kiro  4096 nov 25 14:44 poetry_demo
-rw-rw-r--  1 kiro kiro   289 nov 25 14:44 pyproject.toml
-rw-rw-r--  1 kiro kiro     0 nov 25 14:44 README.md
drwxrwxr-x  2 kiro kiro  4096 nov 25 14:44 tests
kiro@kiro-desktop:/tmp/poetry-demo$ poetry add django-3-jet==1.0.8
Creating virtualenv poetry-demo-ucelmlD--py3.10 in /home/kiro/.cache/pypoetry/virtualenvs

Could not find a matching version of package django-3-jet

Installing it directly from pip does work with no issues:

kiro@kiro-desktop:/tmp/poetry-demo$ pip install django-3-jet==1.0.8
Defaulting to user installation because normal site-packages is not writeable
Collecting django-3-jet==1.0.8
  Downloading django-3-jet-1.0.8.tar.gz (824 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 824.9/824.9 KB 1.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting Django
  Downloading Django-5.1.3-py3-none-any.whl (8.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.3/8.3 MB 5.0 MB/s eta 0:00:00
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from django-3-jet==1.0.8) (1.16.0)
Collecting asgiref<4,>=3.8.1
  Downloading asgiref-3.8.1-py3-none-any.whl (23 kB)
Collecting sqlparse>=0.3.1
  Downloading sqlparse-0.5.2-py3-none-any.whl (44 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.4/44.4 KB 3.5 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions>=4 in /home/kiro/.local/lib/python3.10/site-packages (from asgiref<4,>=3.8.1->Django->django-3-jet==1.0.8) (4.12.2)
Building wheels for collected packages: django-3-jet
  Building wheel for django-3-jet (setup.py) ... done
  Created wheel for django-3-jet: filename=django_3_jet-1.0.8-py3-none-any.whl size=1079519 sha256=94da9fc445942f939a6b97a1648b29ece6a53964c4ef1261dbc0dd36788e7126
  Stored in directory: /home/kiro/.cache/pip/wheels/40/ee/20/387118c0722f6a87562be1c4fdd2b635e5d29684fe7e57c7c9
Successfully built django-3-jet
Installing collected packages: sqlparse, asgiref, Django, django-3-jet
Successfully installed Django-5.1.3 asgiref-3.8.1 django-3-jet-1.0.8 sqlparse-0.5.2

Workarounds

None that I could find

Poetry Installation Method

pip

Operating System

Ubuntu 22.04.5 LTS

Poetry Version

1.8.4

Poetry Configuration

kiro@kiro-desktop:/tmp/poetry-demo$ poetry config --list
cache-dir = "/home/kiro/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
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"  # /home/kiro/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

kiro@kiro-desktop:/tmp/poetry-demo$ poetry add -vvv django-3-jet==1.0.8
Loading configuration file /home/kiro/.config/pypoetry/config.toml
Using virtualenv: /home/kiro/.cache/pypoetry/virtualenvs/poetry-demo-ucelmlD--py3.10
Checking if keyring is available
[keyring:keyring.backend] Loading KWallet
[keyring:keyring.backend] Loading SecretService
[keyring:keyring.backend] Loading Windows
[keyring:keyring.backend] Loading chainer
[keyring:keyring.backend] Loading libsecret
[keyring:keyring.backend] Loading macOS
Using keyring backend 'chainer ChainerBackend'
Creating new session for pypi.org
Skipping url (https://files.pythonhosted.org/packages/7d/0c/2ea0347d7179d2ffaafb2380fc0cfeb01d9e2469fad8c4d5ea1a421c49c1/django-3-jet-1.0.7.tar.gz) due to invalid version (None)
Skipping url (https://files.pythonhosted.org/packages/e0/c1/4075f1596781ff8ad90bcd6b7b09add0f2601a6c8483865bd8a05c7e86aa/django-3-jet-1.0.8.tar.gz) due to invalid version (None)
Source (PyPI): 0 packages found for django-3-jet 1.0.8

  Stack trace:

  9  ~/.local/lib/python3.10/site-packages/cleo/application.py:327 in run
      325│ 
      326│             try:
    → 327│                 exit_code = self._run(io)
      328│             except BrokenPipeError:
      329│                 # If we are piped to another process, it may close early and send a

  8  ~/.local/lib/python3.10/site-packages/poetry/console/application.py:190 in _run
      188│         self._load_plugins(io)
      189│ 
    → 190│         exit_code: int = super()._run(io)
      191│         return exit_code
      192│ 

  7  ~/.local/lib/python3.10/site-packages/cleo/application.py:431 in _run
      429│             io.input.interactive(interactive)
      430│ 
    → 431│         exit_code = self._run_command(command, io)
      432│         self._running_command = None
      433│ 

  6  ~/.local/lib/python3.10/site-packages/cleo/application.py:473 in _run_command
      471│ 
      472│         if error is not None:
    → 473│             raise error
      474│ 
      475│         return terminate_event.exit_code

  5  ~/.local/lib/python3.10/site-packages/cleo/application.py:457 in _run_command
      455│ 
      456│             if command_event.command_should_run():
    → 457│                 exit_code = command.run(io)
      458│             else:
      459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  4  ~/.local/lib/python3.10/site-packages/cleo/commands/base_command.py:117 in run
      115│         io.input.validate()
      116│ 
    → 117│         return self.execute(io) or 0
      118│ 
      119│     def merge_application_definition(self, merge_args: bool = True) -> None:

  3  ~/.local/lib/python3.10/site-packages/cleo/commands/command.py:61 in execute
       59│ 
       60│         try:
    →  61│             return self.handle()
       62│         except KeyboardInterrupt:
       63│             return 1

  2  ~/.local/lib/python3.10/site-packages/poetry/console/commands/add.py:164 in handle
      162│             return 0
      163│ 
    → 164│         requirements = self._determine_requirements(
      165│             packages,
      166│             allow_prereleases=self.option("allow-prereleases"),

  1  ~/.local/lib/python3.10/site-packages/poetry/console/commands/init.py:393 in _determine_requirements
      391│                 # check that the specified version/constraint exists
      392│                 # before we proceed
    → 393│                 name, _ = self._find_best_version_for_package(
      394│                     requirement["name"],
      395│                     requirement["version"],

  ValueError

  Could not find a matching version of package django-3-jet

  at ~/.local/lib/python3.10/site-packages/poetry/console/commands/init.py:422 in _find_best_version_for_package
      418│         )
      419│ 
      420│         if not package:
      421│             # TODO: find similar
    → 422│             raise ValueError(f"Could not find a matching version of package {name}")
      423│ 
      424│         return package.pretty_name, f"^{package.version.to_string()}"
      425│ 
      426│     def _parse_requirements(self, requirements: list[str]) -> list[dict[str, Any]]:
dimbleby commented 2 days ago

Duplicate #6996 etc, the sdist is misnamed - and this is already fixed on the main branch.

Please close