Poetry: Can not install black

Created on 20 Nov 2018  路  3Comments  路  Source: python-poetry/poetry

  • Poetry version: 0.12.9
$ python --version
3.6.7
$ poetry add -D black                                                      
[ValueError]                           
Could not find a matching version of package black  

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
$ poetry add -D black==18.9b0   # specify version works
Updating dependencies
Resolving dependencies... (0.7s)


Package operations: 4 installs, 0 updates, 0 removals

Writing lock file

  - Installing appdirs (1.4.3)
  - Installing click (7.0)
  - Installing toml (0.10.0)
  - Installing black (18.9b0)
$ poetry add -D --allow-prereleases black                                                                                                                                                                        
Using version ^18.3-alpha.0 for black

Updating dependencies
Resolving dependencies... (23.3s)


Package operations: 4 installs, 0 updates, 0 removals

Writing lock file

  - Installing appdirs (1.4.3)
  - Installing click (7.0)
  - Installing toml (0.10.0)
  - Installing black (18.9b0)  # not 18.3-alpha.0

Most helpful comment

@Gr1N to do this from the command line you can set the --allow-prereleases flag as well

All 3 comments

Same for me but worked well with poetry==0.11.4.

To fix this just update your pyproject.toml:

diff --git a/pyproject.toml b/pyproject.toml
index 787d572..d8a0744 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -43,7 +43,7 @@ python = "^3.6"
 pytelegraf = "0.*"

 [tool.poetry.dev-dependencies]
-black = "*"
+black = { version = "*", allows-prereleases = true }
 flake8 = "*"
 flake8-bugbear = "*"
 isort = "*"

This is required because there are no release versions of black at all.

@Gr1N to do this from the command line you can set the --allow-prereleases flag as well

Was this page helpful?
0 / 5 - 0 ratings