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

Fail to add package where the latest release contains no installable wheel #4046

Closed
3 tasks done
FranzForstmayr opened this issue May 6, 2021 · 13 comments
Closed
3 tasks done
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@FranzForstmayr
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • Ubuntu 20.04.2 LTS:
  • 1.1.6:
  • New Project:

Issue

When I create a new project, I'm unable to add the package kaleido. (0.2.1.post currently)

franz@desktop:~$ poetry new start
Created package start in start

franz@desktop:~$ poetry add kaleido
Creating virtualenv start in /home/franz/start/.venv
Using version ^0.2.1 for kaleido

Updating dependencies
Resolving dependencies... (0.9s)

Writing lock file

Package operations: 9 installs, 0 updates, 0 removals

  • Installing pyparsing (2.4.7)
  • Installing attrs (21.1.0)
  • Installing more-itertools (8.7.0)
  • Installing packaging (20.9)
  • Installing pluggy (0.13.1)
  • Installing py (1.10.0)
  • Installing wcwidth (0.2.5)
  • Installing kaleido (0.2.1.post1): Failed

  RuntimeError

  Unable to find installation candidates for kaleido (0.2.1.post1)

  at ~/.poetry/lib/poetry/installation/chooser.py:72 in choose_for
       68│ 
       69│             links.append(link)
       70│ 
       71│         if not links:
    →  72│             raise RuntimeError(
       73│                 "Unable to find installation candidates for {}".format(package)
       74│             )
       75│ 
       76│         # Get the best link

  • Installing pytest (5.4.3)

Failed to add packages, reverting the pyproject.toml file to its original content.

franz@desktop:~$ poetry add kaleido -vvv
Using virtualenv: /home/franz/start/.venv
PyPI: 9 packages found for kaleido *
Using version ^0.2.1 for kaleido

Updating dependencies
Resolving dependencies...
   1: fact: start is 0.1.0
   1: derived: start
   1: fact: start depends on kaleido (^0.2.1)
   1: fact: start depends on pytest (^5.2)
   1: fact: start depends on pytest (^5.2)
   1: selecting start (0.1.0)
   1: derived: pytest (>=5.2,<6.0)
   1: derived: kaleido (>=0.2.1,<0.3.0)
   1: fact: pytest (5.4.3) depends on py (>=1.5.0)
   1: fact: pytest (5.4.3) depends on packaging (*)
   1: fact: pytest (5.4.3) depends on attrs (>=17.4.0)
   1: fact: pytest (5.4.3) depends on more-itertools (>=4.0.0)
   1: fact: pytest (5.4.3) depends on pluggy (>=0.12,<1.0)
   1: fact: pytest (5.4.3) depends on wcwidth (*)
   1: fact: pytest (5.4.3) depends on atomicwrites (>=1.0)
   1: fact: pytest (5.4.3) depends on colorama (*)
   1: selecting pytest (5.4.3)
   1: derived: colorama
   1: derived: atomicwrites (>=1.0)
   1: derived: wcwidth
   1: derived: pluggy (>=0.12,<1.0)
   1: derived: more-itertools (>=4.0.0)
   1: derived: attrs (>=17.4.0)
   1: derived: packaging
   1: derived: py (>=1.5.0)
PyPI: 2 packages found for kaleido >=0.2.1,<0.3.0
   1: selecting kaleido (0.2.1.post1)
   1: selecting wcwidth (0.2.5)
   1: selecting pluggy (0.13.1)
   1: selecting more-itertools (8.7.0)
   1: selecting attrs (21.1.0)
   1: fact: packaging (20.9) depends on pyparsing (>=2.0.2)
   1: selecting packaging (20.9)
   1: derived: pyparsing (>=2.0.2)
   1: selecting py (1.10.0)
   1: selecting pyparsing (2.4.7)
   1: selecting colorama (0.4.4)
   1: selecting atomicwrites (1.4.0)
   1: Version solving took 0.032 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system

Package operations: 1 install, 0 updates, 0 removals, 10 skipped

  • Removing atomicwrites (1.4.0): Pending...
  • Removing atomicwrites (1.4.0): Skipped for the following reason: Not currently installed
  • Removing colorama (0.4.4): Pending...
  • Removing colorama (0.4.4): Skipped for the following reason: Not currently installed
  • Installing pyparsing (2.4.7): Pending...
  • Installing pyparsing (2.4.7): Skipped for the following reason: Already installed
  • Installing attrs (21.1.0): Pending...
  • Installing attrs (21.1.0): Skipped for the following reason: Already installed
  • Installing more-itertools (8.7.0): Pending...
  • Installing more-itertools (8.7.0): Skipped for the following reason: Already installed
  • Installing packaging (20.9): Pending...
  • Installing packaging (20.9): Skipped for the following reason: Already installed
  • Installing pluggy (0.13.1): Pending...
  • Installing pluggy (0.13.1): Skipped for the following reason: Already installed
  • Installing py (1.10.0): Pending...
  • Installing py (1.10.0): Skipped for the following reason: Already installed
  • Installing wcwidth (0.2.5): Pending...
  • Installing wcwidth (0.2.5): Skipped for the following reason: Already installed
  • Installing kaleido (0.2.1.post1): Pending...
  • Installing kaleido (0.2.1.post1): Failed

  RuntimeError

  Unable to find installation candidates for kaleido (0.2.1.post1)

  at ~/.poetry/lib/poetry/installation/chooser.py:72 in choose_for
       68│ 
       69│             links.append(link)
       70│ 
       71│         if not links:
    →  72│             raise RuntimeError(
       73│                 "Unable to find installation candidates for {}".format(package)
       74│             )
       75│ 
       76│         # Get the best link

  • Installing pytest (5.4.3): Pending...
  • Installing pytest (5.4.3): Skipped for the following reason: Already installed

Failed to add packages, reverting the pyproject.toml file to its original content.

I'm not sure if it's about the semver incompatible versioning (0.2.1.post) or if there's any other issue.
Installing via pip works fine, however pip installs 0.2.1 (without .post)

@FranzForstmayr FranzForstmayr added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 6, 2021
@abn
Copy link
Member

abn commented May 7, 2021

Can you try with poetry from master? We have a few improvements there for PEP440 version parsing.

You can use pipx to install from master like so.

pipx install --force --suffix=@master 'poetry @ git+https://github.com/python-poetry/poetry.git@master'
poetry@master --version

@FranzForstmayr
Copy link
Author

Sorry, does not work yet.

franz@desktop:~$ pipx install --force --suffix=@master 'poetry @ git+https://github.com/python-poetry/poetry.git@master'
  installed package poetry 1.2.0a0 (poetry@master), Python 3.8.5
  These apps are now globally available
    - poetry@master
done! ✨ 🌟 ✨
franz@desktop:~$ poetry@master --version
Poetry (version 1.2.0a0)
franz@desktop:~$ poetry@master new testing
Created package testing in testing
franz@desktop:~$ cd testing/
franz@desktop:~/testing$ poetry@master 
pyproject.toml  README.md       testing/        tests/          
franz@desktop:~/testing$ poetry@master add kaleido
Creating virtualenv testing in /home/franz/testing/.venv
Using version ^0.2.1-post.1 for kaleido

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing kaleido (0.2.1.post1): Failed

  RuntimeError

  Unable to find installation candidates for kaleido (0.2.1.post1)

  at ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/chooser.py:73 in choose_for
       69│ 
       70│             links.append(link)
       71│ 
       72│         if not links:
    →  73│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74│ 
       75│         # Get the best link
       76│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77│         if not chosen:


Failed to add packages, reverting the pyproject.toml file to its original content.
franz@desktop:~/testing$ poetry@master add kaleido -vvv
Loading configuration file /home/franz/.config/pypoetry/config.toml
Using virtualenv: /home/franz/testing/.venv
PyPI: 9 packages found for kaleido *
Using version ^0.2.1-post.1 for kaleido

Loading configuration file /home/franz/.config/pypoetry/config.toml
Updating dependencies
Resolving dependencies...
   1: fact: testing is 0.1.0
   1: derived: testing
   1: fact: testing depends on kaleido (^0.2.1-post.1)
   1: selecting testing (0.1.0)
   1: derived: kaleido (>=0.2.1-post.1,<0.3.0)
PyPI: 1 packages found for kaleido >=0.2.1-post.1,<0.3.0
   1: selecting kaleido (0.2.1.post1)
   1: Version solving took 0.056 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system

Package operations: 1 install, 0 updates, 0 removals

  • Installing kaleido (0.2.1.post1): Pending...
  • Installing kaleido (0.2.1.post1): Failed

  Stack trace:

  5  ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/executor.py:244 in _execute_operation
      242│ 
      243│             try:
    → 244│                 result = self._do_execute_operation(operation)
      245│             except EnvCommandError as e:
      246│                 if e.e.returncode == -2:

  4  ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/executor.py:321 in _do_execute_operation
      319│             return 0
      320│ 
    → 321│         result = getattr(self, f"_execute_{method}")(operation)
      322│ 
      323│         if result != 0:

  3  ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/executor.py:462 in _execute_install
      460│ 
      461│     def _execute_install(self, operation: Union[Install, Update]) -> int:
    → 462│         status_code = self._install(operation)
      463│ 
      464│         self._save_url_reference(operation)

  2  ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/executor.py:498 in _install
      496│             archive = self._download_link(operation, Link(package.source_url))
      497│         else:
    → 498│             archive = self._download(operation)
      499│ 
      500│         operation_message = self.get_operation_message(operation)

  1  ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/executor.py:646 in _download
      644│ 
      645│     def _download(self, operation: Union[Install, Update]) -> Link:
    → 646│         link = self._chooser.choose_for(operation.package)
      647│ 
      648│         return self._download_link(operation, link)

  RuntimeError

  Unable to find installation candidates for kaleido (0.2.1.post1)

  at ~/.local/pipx/venvs/poetry@master/lib/python3.8/site-packages/poetry/installation/chooser.py:73 in choose_for
       69│ 
       70│             links.append(link)
       71│ 
       72│         if not links:
    →  73│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74│ 
       75│         # Get the best link
       76│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77│         if not chosen:


Failed to add packages, reverting the pyproject.toml file to its original content.

@clintonroy
Copy link
Contributor

I'm not really looking into this at all, just happened to notice that it's post1 in some places and post.1 in others.

@jmigual
Copy link
Contributor

jmigual commented Oct 20, 2021

Hi, I'm having the same issue with poetry 1.1.11. The issue seems related to the fact that the package version (0.2.1.post1) has a post release separator (https://www.python.org/dev/peps/pep-0440/#post-release-separators)

@FranzForstmayr
Copy link
Author

FranzForstmayr commented Dec 17, 2021

Just found out, that kaleido 0.2.1.post1 is a armv7l only release, there aren't even x86 artifacts for this release.
The last valid release is 0.2.1.

I think poetry detects the latest version (0.2.1.post1) first and then tries to install this version. Then poetry recognizes that there's no installable candidate for the current architecture.

This is definitely a bad practice from kaleido, however poetry should be able to find an installable candidate.

@FranzForstmayr
Copy link
Author

I just digged into this issue, and found out that the 'Env' instance is not taken into account when resolving dependencies. That's why 0.2.1.post1 is choosen, although there's no installation candidate.

I tried to pass the environment downto PyPiRepository.find_packages but the class is instantiated multiple times and would need lot's of changes, because the environment is not accessible from everywhere.

Maybe one of the core-devs can answer, why env is not accessible from anywhere, maybe even as a singleton?

@FranzForstmayr FranzForstmayr changed the title Fail to add package kaleido Fail to add package where the latest release contains no installable wheel Dec 20, 2021
@q-wertz
Copy link

q-wertz commented Jul 19, 2022

Having the same issue. Workaround I'm using is to add it as an exact requirement in my pyproject.toml:

kaleido = {version = "0.2.1", optional = true}

@dimbleby
Copy link
Contributor

that unconstrained poetry add always tries to add the latest version is a duplicate of #707

that the latest version of kaleido has not published packages suitable for your system is a kaleido issue.

this can be closed

@FranzForstmayr
Copy link
Author

No, it's the job of the dependency resolution tool to get the latest available version which is compatible to the rest of my dependencies.

@dimbleby
Copy link
Contributor

... which is a duplicate of #707

@neersighted
Copy link
Member

This is overall not a bug; Poetry does not take wheel availability into account when solving. kaleido is doing the wrong thing here -- they should build wheels for all supported platforms with every version, or publish a sdist so they can be built on platforms they do not provide wheels for. If they need to add a single wheel to an existing release, that should be done by simply uploading another file; .postX releases are for metadata-only changes but are otherwise not special in any way.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
@neersighted neersighted added status/external-issue Issue is caused by external project (platform, dep, etc) and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 23, 2022
@mmllee
Copy link

mmllee commented Sep 26, 2023

another workaroud is to add it as follows:

kaleido = "^0.2.1, !=0.2.1.post1"

or fully open:

kaleido = ">=0.2.1, !=0.2.1.post1"

Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

No branches or pull requests

8 participants