python-poetry / poetry

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

Poetry cannot find and install package with 0.???a (alpha/beta designation) in its version #824

Closed amal-khailtash closed 4 years ago

amal-khailtash commented 5 years ago

Issue

When trying to add "bit-vector" package, I get this error:

$ poetry add bit-vector

[ValueError]                                
Could not find a matching version of package bit-vector  

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

poetry search bit-vector shows:

bit-vector (0.42a0)
 A BitVector class for Python

Editing the .toml file and adding 'bit-vector = "0.26a0"' works, but poetry show --outdated does not show new "0.42a0" version nor, poetry update updates to this version.

amal-khailtash commented 5 years ago

The problem seems to be with packages with a/b. ... (alpha/beta) designation. The same thing happens with sty.

Search:

$ poetry search sty
sty (1.0.0b8)

Add:

$ poetry add sty

[ValueError]                         
Could not find a matching version of package sty  

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

This works:

$ poetry add sty="1.0.0b8"
Updating dependencies
Resolving dependencies... (2.3s)

Package operations: 1 install, 0 updates, 0 removals

Writing lock file

  - Installing sty (1.0.0b8)
woile commented 5 years ago

Have you tried adding the --allow-prereleases flag?

amal-khailtash commented 5 years ago

I commented the following in the pyproject.toml:

# bit-vector = "0.42a0"

And ran add with --allow-prereleases, and I see:

$ poetry add --allow-prereleases bit-vector-vector
Using version ^0.10.0-alpha.0 for bit-vector

Updating dependencies
Resolving dependencies... (4.8s)

Package operations: 0 installs, 1 update, 0 removals

Writing lock file

  - Updating bit-vector (0.42a0 -> 0.11a0)

I also see this line in pyproject.toml:

bit-vector = {version = "^0.10.0-alpha.0",allows-prereleases = true}

I am not sure why it does not pick the newer version: "0.42a0"!

amal-khailtash commented 5 years ago

Adding the specific version works though:

$ poetry add --allow-prereleases bit-vector="^0.42.0a0"

Not sure if this is expected, but this does not work:

$ poetry add --allow-prereleases sty="^1.0.0"

But this works:

$ poetry add --allow-prereleases sty="^1.0.0a9"

amal-khailtash commented 5 years ago

Apparently either of the following:

bit-vector = {version = "^0.42.0a0",allows-prereleases = true}
bit-vector = "0.42a0"

causes a hang that I reported in issue https://github.com/sdispater/poetry/issues/832

pawamoy commented 5 years ago

Just a note: poetry could print a message like If the package you try to install is in alpha/beta, try with the --allow-prereleases flag when the command fails. Currently, people experiencing this issue must come here on the issue tracker and search for this problem to get the solution, which is not efficient. Sometimes they will even open duplicate issues :sweat_smile: A simple message could help reduce this.

$ poetry add sty

[ValueError]                         
Could not find a matching version of package sty
If the package you want to install is in alpha/beta, try with the --allow-prereleases flag  

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
paranoidi commented 5 years ago

The message given by black is confusing and inadequate in this instance. The message should be improved so that user understands situation properly.

Better message might be,

Could not find a matching stable version of package black. Use --allow-prereleases to remove restrictions.

Edit: Opened PR #1216

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

github-actions[bot] commented 8 months ago

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.