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

"Unable to find installation candidates for" for packages that are already installed #4679

Closed
3 tasks done
tedivm opened this issue Oct 27, 2021 · 9 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@tedivm
Copy link

tedivm commented Oct 27, 2021

  • 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).
  • OS version and name: NA (tested with Ubuntu 20)
  • Poetry version: 1.1.11

Issue

If a package is already installed at a specific version Poetry should not fail with "Unable to find installation candidates for" as long as the local version matches the requirements.

We're using a package, oso, which does not currently have an ARM build for linux. It also does not provide a source via pip, as it requires a somewhat complicated build chain. We are building this package locally and installing it directly into the environment, at the appropriate version.

Unfortunately Poetry is still looking to pull the package from somewhere, which in turn causes our install to fail.

@tedivm tedivm added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 27, 2021
@tedivm tedivm closed this as completed Oct 27, 2021
@tedivm tedivm reopened this Oct 27, 2021
@tedivm
Copy link
Author

tedivm commented Nov 2, 2021

Why is this even trying to update anything?

#29 96.38   • Updating oso (0.22.0 /opt/oso/languages/python/oso -> 0.22.0)
#29 96.51   • Installing packaging (20.9)
#29 96.60   • Installing pkginfo (1.7.1)
#29 98.88 
#29 98.89   RuntimeError
#29 98.89 
#29 98.89   Unable to find installation candidates for oso (0.22.0)
#29 98.89 
#29 98.90   at /opt/poetry/lib/poetry/installation/chooser.py:73 in choose_for
#29 99.30        69│             links.append(link)
#29 99.30        70│ 
#29 99.30        71│         if not links:
#29 99.30        72│             raise RuntimeError(
#29 99.31     →  73│                 "Unable to find installation candidates for {}".format(package)
#29 99.32        74│             )
#29 99.32        75│ 
#29 99.33        76│         # Get the best link
#29 99.34        77│         chosen = max(links, key=lambda link: self._sort_key(package, link))
#29 99.35 

@felixgao
Copy link

felixgao commented Apr 27, 2022

I am seeing a similar problem

poetry update
Creating virtualenv ocr in /Users/ggao/github/MONOREPO/libs/ocr/.venv
Updating dependencies
Resolving dependencies... (0.2s)

Package operations: 31 installs, 0 updates, 0 removals

  • Installing protobuf (3.20.1): Failed

  RuntimeError

  Unable to find installation candidates for protobuf (3.20.1)

  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 pyasn1 (0.4.8)
  • Installing six (1.16.0)

protobuf is already installed

> pip install protobuf
Requirement already satisfied: protobuf in /Users/ggao/.pyenv/versions/3.9.10/lib/python3.9/site-packages (3.20.1)

btw, the problem occurred when first I try to run
poetry add --optional pyocr

@dimbleby
Copy link
Contributor

@felixgao /Users/ggao/github/MONOREPO/libs/ocr/.venv is not the same as /Users/ggao/.pyenv/versions/3.9.10/lib/python3.9/site-packages

@felixgao
Copy link

felixgao commented Apr 27, 2022

yea I tried to manually install it with pip but I guess i used the wrong pip.

poetry show 
The /Users/ggao/github/MONOREPO/libs/gvision/.venv seems to be broken.
Recreating virtualenv ocr in /Users/ggao/github/MONOREPO/libs/ocr/.venv
attrs                    21.4.0      Classes Without Boilerplate
cachetools               5.0.0       Extensible memoizing collections and decorators
certifi                  2021.10.8   Python package for providing Mozilla's CA Bundle.
charset-normalizer       2.0.12      The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
google-api-core          2.7.2       Google API client core library
google-auth              2.6.6       Google Authentication Library
google-cloud-vision      2.7.2       Cloud Vision API API client library
googleapis-common-protos 1.56.0      Common protobufs used in Google APIs
grpcio                   1.45.0      HTTP/2-based RPC framework
grpcio-status            1.45.0      Status proto mapping for gRPC
idna                     3.3         Internationalized Domain Names in Applications (IDNA)
loguru                   0.6.0       Python logging made (stupidly) simple
more-itertools           8.12.0      More routines for operating on iterables, beyond itertools
packaging                21.3        Core utilities for Python packages
pillow                   9.1.0       Python Imaging Library (Fork)
pluggy                   0.13.1      plugin and hook calling mechanisms for python
proto-plus               1.20.3      Beautiful, Pythonic protocol buffers.
protobuf                 3.20.1      Protocol Buffers
py                       1.11.0      library with cross-python path, ini-parsing, io, code, log facilities
pyasn1                   0.4.8       ASN.1 types and codecs
pyasn1-modules           0.2.8       A collection of ASN.1-based protocols modules.
pydantic                 1.9.0       Data validation and settings management using python 3.6 type hinting
pyparsing                3.0.8       pyparsing module - Classes and methods to define and execute parsing grammars
pytest                   5.4.3       pytest: simple powerful testing with Python
requests                 2.27.1      Python HTTP for Humans.
rsa                      4.8         Pure-Python RSA implementation
shapely                  1.8.1.post1 Geometric objects, predicates, and operations
six                      1.16.0      Python 2 and 3 compatibility utilities
typing-extensions        4.2.0       Backported and Experimental Type Hints for Python 3.7+
urllib3                  1.26.9      HTTP library with thread-safe connection pooling, file post, and more.
wcwidth                  0.2.5       Measures the displayed width of unicode strings in a terminal

then

 poetry update
The virtual environment found in /Users/ggao/github/MONOREPO/libs/gvision/.venv seems to be broken.
Recreating virtualenv ocr in /Users/ggao/github/MONOREPO/libs/ocr/.venv
Updating dependencies
Resolving dependencies... (4.1s)

Writing lock file

Package operations: 31 installs, 0 updates, 0 removals

  • Installing protobuf (3.20.1): Failed

  RuntimeError

  Unable to find installation candidates for protobuf (3.20.1)

  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 pyasn1 (0.4.8)

edit:

Here is using the correct pip to try to install the package

 .venv/bin/pip -v install protobuf
Using pip 22.0.4 from /Users/ggao/github/MONOREPO/libs/ocr/.venv/lib/python3.9/site-packages/pip (python 3.9)
Collecting protobuf
  Using cached protobuf-3.20.1-py2.py3-none-any.whl (162 kB)
Installing collected packages: protobuf
Successfully installed protobuf-3.20.1

@felixgao
Copy link

another update, I think the problem is with poetry cache. Once I cleared the cache, everything seems to work now.

@ralbertazzi
Copy link
Contributor

This seems indeed to be solved. Here's the test I performed.

  • poetry install-ed a project with some dependencies taken from a private repository
  • Cleared that repository cache (poetry cache clear <repo> --all)
  • Removed credentials for that repository
  • Run poetry install

Running poetry install a second time does not break, resulting in a correct "No dependencies to install or update". Since the private packages are not available in the cache and over the network, it's an additional proof that Poetry isn't trying to find packages that are already installed.

I'm closing this. If you think the latest Poetry version still doesn't work for you, please comment and we'll consider re-opening.

@cntvc
Copy link

cntvc commented Oct 7, 2023

When trying to install textual using Poetry in Python 3.12.0, I encountered the same issue, and even after attempting to clear all repo caches, I couldn't install it. Subsequently, I tried installing the same package textual, in Python 3.8.10, and it worked without any issues.

env:
system: Windows 10
poetry: 1.6.1
Python: 3.12.0

Steps to reproduce:

  1. Create an empty project using Poetry.
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Charlie Brown"]
readme = "README.md"


[tool.poetry.dependencies]
python = "^3.12"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  1. Run poetry add textual
(test-py3.12) D:\Github\c>poetry add textual
Using version ^0.38.1 for textual

Updating dependencies    
Resolving dependencies...

Package operations: 2 installs, 0 updates, 0 removals

  • Installing tree-sitter-languages (1.7.0)

  RuntimeError

  Unable to find installation candidates for tree-sitter-languages (1.7.0)

  at ~\AppData\Local\Programs\Python\Python312\Lib\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│

@clintonroy
Copy link
Contributor

@cntvc the package that is failing to be installed is tree-sitter-languages, not textual. If you go to tree-sitter-languages pypi page, you'll see they don't support source wheels (for whatever reason, whatever reasons they are, I would suggest they are silly reasons) and they don't have any python 3.12 wheels.

Furthermore, this is a very different bug to the title of the bug.

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
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

6 participants