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 appears to be trying to install with the wrong version of pip

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

In my system, I have both python and pip, and python3 and pip3 commands. (Installed with apt install python-pip python3-pip).

I installed poetry with pip3 install poetry, and you can see that it’s using python3 as its binary:

$ head -n 1 `which poetry`
#!/usr/bin/python3

I’ve also configured it not to create virtualenvs, and I’m running this as root inside a ubuntu:xenial docker container.

So now my poetry install errors, because it claims not to have python3.5:

# poetry install -vvv
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file


Package operations: 1 install, 0 updates, 0 removals, 1 skipped

  - Skipping pytz (2018.7) Already installed
  - Installing django (2.1.4)

[EnvCommandError]
Command ['/usr/bin/pip', 'install', '--no-deps', 'django==2.1.4'] errored with the following output:                                           
Collecting django==2.1.4                                                                                                                       
  Using cached https://files.pythonhosted.org/packages/83/f7/4939b60c4127d5f49ccb570e34f4c59ecc222949220234a88e4f363f1456/Django-2.1.4.tar.gz  
    Complete output from command python setup.py egg_info:                                                                                     
                                                                                                                                               
    ==========================                                                                                                                 
    Unsupported Python version                                                                                                                 
    ==========================                                                                                                                 
                                                                                                                                               
    This version of Django requires Python 3.5, but you're trying to                                                                           
    install it on Python 2.7.                                                                                                                  
                                                                                                                                               
    This may be because you are using a version of pip that doesn't                                                                            
    understand the python_requires classifier. Make sure you                                                                                   
    have pip >= 9.0 and setuptools >= 24.2, then try again:                                                                                    
                                                                                                                                               
        $ python -m pip install --upgrade pip setuptools                                                                                       
        $ python -m pip install django                                                                                                         
                                                                                                                                               
    This will install the latest version of Django which works on your                                                                         
    version of Python. If you can't upgrade your pip (or Python), request                                                                      
    an older version of Django:                                                                                                                
                                                                                                                                               
        $ python -m pip install "django<2"                                                                                                     
                                                                                                                                               
    ----------------------------------------                                                                                                   
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dlrX8a/django/                                                   
You are using pip version 8.1.1, however version 18.1 is available.                                                                            
You should consider upgrading via the 'pip install --upgrade pip' command.                                                                     

Exception trace:
 /usr/local/lib/python3.5/dist-packages/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /usr/local/lib/python3.5/dist-packages/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /usr/local/lib/python3.5/dist-packages/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /usr/local/lib/python3.5/dist-packages/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /usr/local/lib/python3.5/dist-packages/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /usr/local/lib/python3.5/dist-packages/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /usr/local/lib/python3.5/dist-packages/poetry/console/commands/install.py in handle() at line 57
   return_code = installer.run()
 /usr/local/lib/python3.5/dist-packages/poetry/installation/installer.py in run() at line 76
   self._do_install(local_repo)
 /usr/local/lib/python3.5/dist-packages/poetry/installation/installer.py in _do_install() at line 287
   self._execute(op)
 /usr/local/lib/python3.5/dist-packages/poetry/installation/installer.py in _execute() at line 295
   getattr(self, "_execute_{}".format(method))(operation)
 /usr/local/lib/python3.5/dist-packages/poetry/installation/installer.py in _execute_install() at line 320
   self._installer.install(operation.package)
 /usr/local/lib/python3.5/dist-packages/poetry/installation/pip_installer.py in install() at line 91
   self.run(*args)
 /usr/local/lib/python3.5/dist-packages/poetry/installation/pip_installer.py in run() at line 112
   return self._env.run("pip", *args, **kwargs)
 /usr/local/lib/python3.5/dist-packages/poetry/utils/env.py in run() at line 354
   raise EnvCommandError(e)

install [--no-dev] [--dry-run] [-E|--extras EXTRAS] [--develop DEVELOP]

But:

$ python3 --version
Python 3.5.2
$ pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
uSpikecommented, Dec 6, 2018

It seems to me that a simple solution is to run [env python] -m pip instead of pip directly.

2reactions
nottrobincommented, Dec 6, 2018

I realise this is the 4th issue I’ve filed today. Sorry for the noise, I’m trying to be helpful rather than difficult.

I love the attitude of poetry (especially as compared to the attitude of Pipenv) and I want it to succeed, I’m just trying to see if I can make it work with our workflow.

I’ll try to delve into this issue more if I get a chance, and maybe even submit a PR or two.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry using wrong Python version - Stack Overflow
Trying to install packages using poetry And getting :
Read more >
Ask HN: Why Poetry did not become a mainstream package ...
Personally, I use pipenv (manages package dependencies and sub-dependencies), pyenv (python version management), and pyenv-virtualenv (creates ...
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
Poetry is a CLI app written in Python so you can simply install it with pip install --user poetry . However, you probably...
Read more >
Announcing Poetry 1.2.0 | Blog
If you have a previous version of Poetry installed via the new installer, pipx or manually, getting Poetry 1.2.0 is as easy as:....
Read more >
Why you should use Poetry instead of Pip or Conda for Python ...
(test-env) user:~$ pip list Package Version --------------- ------- numpy 1.22.3 pandas 1.4.2 ... It seems that packages installed via Pip only ...
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