Poetry: Invalid dev dependency

Created on 12 Sep 2018  路  7Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Ubuntu 18.04
  • Poetry version: Poetry 0.11.5
  • Link of a Gist with the contents of your pyproject.toml file: None

Issue

Doing the following:

git clone https://github.com/sdispater/poetry && cd poetry
poetry install

Poetry fails to install black 18.6b4 with this error using -vvv:

```Using virtualenv: /home/dimitris/.cache/pypoetry/virtualenvs/poetry-py3.6
Installing dependencies from lock file

Package operations: 8 installs, 0 updates, 1 removal, 53 skipped

  • Skipping six (1.11.0) Already installed
  • Skipping atomicwrites (1.2.1) Already installed
  • Skipping attrs (18.2.0) Already installed
  • Skipping certifi (2018.8.24) Already installed
  • Skipping chardet (3.0.4) Already installed
  • Skipping colorama (0.3.9) Not needed for the current platform
  • Skipping idna (2.7) Already installed
  • Skipping markupsafe (1.0) Already installed
  • Skipping more-itertools (4.3.0) Already installed
  • Skipping pluggy (0.7.1) Already installed
  • Skipping py (1.6.0) Already installed
  • Skipping pyyaml (3.13) Already installed
  • Skipping tornado (5.1) Already installed
  • Skipping urllib3 (1.23) Already installed
  • Skipping appdirs (1.4.3) Already installed
  • Skipping aspy.yaml (1.1.1) Already installed
  • Skipping cached-property (1.5.1) Already installed
  • Skipping cfgv (1.1.0) Already installed
  • Skipping click (6.7) Already installed
  • Skipping coverage (4.5.1) Already installed
  • Skipping identify (1.1.5) Already installed
  • Skipping jinja2 (2.10) Already installed
  • Skipping livereload (2.5.2) Already installed
  • Skipping lockfile (0.12.2) Already installed
  • Skipping markdown (2.6.11) Already installed
  • Skipping msgpack (0.5.6) Already installed
  • Skipping nodeenv (1.3.2) Already installed
  • Skipping pastel (0.1.0) Already installed
  • Skipping pygments (2.2.0) Already installed
  • Skipping pylev (1.3.0) Already installed
  • Skipping pytest (3.8.0) Already installed
  • Skipping requests (2.19.1) Already installed
  • Skipping toml (0.9.6) Already installed
  • Skipping virtualenv (16.0.0) Already installed
  • Skipping webencodings (0.5.1) Already installed
  • Installing black (18.6b4)

[VenvCommandError]
Command ['pip', 'install', '--no-deps', 'black==18.6b4'] errored with the following output:
Collecting black==18.6b4
Could not find a version that satisfies the requirement black==18.6b4 (from versions: )
No matching distribution found for black==18.6b4

Exception trace:
/home/dimitris/.local/lib/python3.6/site-packages/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/home/dimitris/.local/lib/python3.6/site-packages/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/home/dimitris/.local/lib/python3.6/site-packages/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/dimitris/.local/lib/python3.6/site-packages/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/dimitris/.local/lib/python3.6/site-packages/poetry/console/commands/install.py in handle() at line 50
return installer.run()
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/installer.py in run() at line 76
self._do_install(local_repo)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/installer.py in _do_install() at line 286
self._execute(op)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/installer.py in _execute() at line 294
getattr(self, "_execute_{}".format(method))(operation)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/installer.py in _execute_install() at line 319
self._installer.install(operation.package)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/pip_installer.py in install() at line 76
self.run(args)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/installation/pip_installer.py in run() at line 91
return self._venv.run("pip", *args, *
kwargs)
/home/dimitris/.local/lib/python3.6/site-packages/poetry/utils/venv.py in run() at line 274
raise VenvCommandError(e)

The issue is that pip2 doesn't find the version 18.6b4

```bash
/usr/bin/pip2 install -U black==18.6b4                                                               
Collecting black==18.6b4
  Could not find a version that satisfies the requirement black==18.6b4 (from versions: )
No matching distribution found for black==18.6b4

Pip3 does find the version:

 /usr/bin/pip3 install -U black==18.6b4                                                             1 master
Collecting black==18.6b4
  Using cached https://files.pythonhosted.org/packages/4e/b5/575cdaabf1f98ebe50c0ee85b202fcce3b8df1f21d6ed02708bc539674c3/black-18.6b4-py36-none-any.whl
Collecting toml>=0.9.4 (from black==18.6b4)
  Using cached https://files.pythonhosted.org/packages/c7/19/76c3cb84949a0593767b32b9be83a604d8a68c3580ff5d0ee64856b39ade/toml-0.9.6-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from black==18.6b4)
  Using cached https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a514/attrs-18.2.0-py2.py3-none-any.whl
Collecting appdirs (from black==18.6b4)
  Using cached https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting click>=6.5 (from black==18.6b4)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Installing collected packages: toml, attrs, appdirs, click, black
Successfully installed appdirs-1.4.3 attrs-18.2.0 black-18.6b4 click-6.7 toml-0.9.6

Most helpful comment

Black doesn't have a stable release yet. You need to install it with:

poetry add --dev --allow-prereleases black

All 7 comments

What is the output of poetry debug:info?

dimitris@foobar ~/poetry> poetry debug:info                                                              1 master

Poetry
======

 * Version: 0.11.5
 * Python:  3.6.5


Virtualenv
==========

 * Python:         3.6.5
 * Implementation: CPython
 * Path:           /home/dimitris/.cache/pypoetry/virtualenvs/poetry-py3.6


System
======

 * Platform: linux
 * OS:       posix

This is strange. Why is Poetry using the pip from a Python 2 executable since the virtualenv is Python 3.6?

Alright, I have figured it out. Simply calling /usr/bin/pip or pip doesn't guarantee that pip3 will run and is very dependent on the distribution and Os.

To test the hypothesis, I created a symbolic link as such:

sudo ln -s /usr/bin/pip3 /usr/bin/pip

Then run poetry install and it has successfully installed all dependencies.

Perhaps a note somewhere in documentation or say calling pip3 instead of pip can prevent this from happening again.

I've also hit the same problem installing black:

$ poetry add --dev black

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

(That's from inside a 3.6 pyenv virtualenv.)

Black doesn't have a stable release yet. You need to install it with:

poetry add --dev --allow-prereleases black

Corresponding ticket in Black https://github.com/python/black/issues/517.

Was this page helpful?
0 / 5 - 0 ratings