question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry install creates venv using compatible version (python3) but tries to install dependencies using pip v2

See original GitHub issue
  • 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).

Issue

pip is unable to install the required package as it does not target python 2. Once a venv is created it should use the pip installed in the venv to install the packages.

poetry install -vvv         <aws:amazon-web-services>
The currently activated Python version 2.7.17 is not supported by the project (^3.6).
Trying to find and use a compatible version.
Trying python3
Using python3 (3.7.5)
Virtualenv tool-it-02NcbsqG-py3.7 already exists.
Using virtualenv: /Users/nick.perkins/Library/Caches/pypoetry/virtualenvs/tool-it-02NcbsqG-py3.7
Installing dependencies from lock file


Package operations: 28 installs, 0 updates, 0 removals, 2 skipped

  - Installing more-itertools (8.0.2)

[EnvCommandError]
Command ['pip', 'install', '--no-deps', 'more-itertools==8.0.2'] errored with the following return code 1, and output:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement more-itertools==8.0.2 (from versions: 1.0, 1.1, 2.0, 2.1, 2.2, 2.3, 2.4, 2.4.1, 2.5.0, 2.6.0, 3.0.0, 3.1.0, 3.2.0, 4.0.0, 4.0.1, 4.1.0, 4.2.0, 4.3.0, 5.0.0)
ERROR: No matching distribution found for more-itertools==8.0.2


Traceback (most recent call last):
  File "/Users/nick.perkins/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/nick.perkins/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/nick.perkins/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/nick.perkins/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/nick.perkins/.poetry/lib/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/installer.py", line 286, in _do_install
    self._execute(op)
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/installer.py", line 302, in _execute
    getattr(self, '_execute_{}'.format(method))(operation)
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/installer.py", line 327, in _execute_install
    self._installer.install(operation.package)
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/pip_installer.py", line 97, in install
    self.run(*args)
  File "/Users/nick.perkins/.poetry/lib/poetry/installation/pip_installer.py", line 118, in run
    return self._env.run_pip(*args, **kwargs)
  File "/Users/nick.perkins/.poetry/lib/poetry/utils/env.py", line 824, in run_pip
    return self._run(cmd, **kwargs)
  File "/Users/nick.perkins/.poetry/lib/poetry/utils/env.py", line 1052, in _run
    return super(VirtualEnv, self)._run(cmd, **kwargs)
  File "/Users/nick.perkins/.poetry/lib/poetry/utils/env.py", line 856, in _run
    raise EnvCommandError(e, input=input_)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
nickperkinscommented, Dec 19, 2019

That is exactly the issue.

With poetry now having functionality that creates a virtualenv that is compatible with the project (python3) it would also make sense to use that version of python to install the dependences.

1reaction
rvanlaarcommented, Dec 24, 2019

@DmytroLitvinov Did you solve this problem and what was your solution?

I have Poetry complaining that pip wasn’t installed. Where as pip3 was installed. After installing pip for python2 it wouldn’t install the correct packages.

Another system that is almost the same doesn’t have this problem.

Edit: Solved this by:

  • installing pip3 as the user setting PATH to ~/.local/bin/:$PATH
Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing Poetry 1.2.0 | Blog
Poetry will be installed using the Python interpreter the installer is invoked with. The new installer (or a compatible install method such as ......
Read more >
Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
How To Install Poetry to Manage Python Dependencies on ...
Poetry is installed using an official installation script provided on the Poetry website. This command will download the installation script, ...
Read more >
why poetry removes virtualenv? - Stack Overflow
The poetry command will detect it is inside a virtualenv and then install the dependencies into that virtualenv, but also cleaning up ...
Read more >
Python Dependencies - Everything You Need to Know
Pip is the de facto standard tool for installing Python packages and managing their dependencies. When you use pip to install packages, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found