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 using the wrong Python version (not related to pyenv)

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

I’m having an issue adding a package to a project because poetry is picking up on the wrong Python version. I’m pretty confident that something has gone awry in my system, but I’m doing my best to salvage the situation and not have to go through the whole process of installing Raspbian from scratch on this Raspberry Pi. I installed poetry using the recommended method (curl ...). Can you point me in the right direction? As mentioned in the title, I’m not using pyenv. All of the relevant issues I found were related to pyenv, so I’m not really sure how to get poetry to use the correct Python.

Here are some terminal outputs to help you diagnose the issue:

pi@widget:temp_logger$ python --version
Python 3.5.3
pi@widget:temp_logger!$ sudo python --version
Python 2.7.13
pi@widget:temp_logger$ poetry --version
Poetry 0.12.9
pi@widget:temp_logger$ poetry debug:info

Poetry
======

 * Version: 0.12.9
 * Python:  2.7.13


Virtualenv
==========

 * Python:         2.7.13
 * Implementation: CPython
 * Path:           NA


System
======

 * Platform: linux2
 * OS:       posix
 * Python:   /usr


pi@widget:temp_logger$ poetry add adafruit-blinka

[RuntimeError]
The current Python version (2.7.13) is not supported by the project (^3.5)
Please activate a compatible Python version.

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:38
  • Comments:34 (8 by maintainers)

github_iconTop GitHub Comments

87reactions
Pequecommented, Jun 23, 2019

Using Poetry 1.0 (prerelease) seems to fix this issue:

poetry self:update --preview
poetry env use python3.7

See https://github.com/sdispater/poetry/pull/731 for more information.

59reactions
zmitchellcommented, Nov 22, 2018

I reinstalled with Python 3 using curl ... | python3 and it still only picks up 2.7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry doesn't use the correct version of Python - Stack Overflow
The currently activated Python version 2.7.16 is not supported by the project (^3.8). Trying to find and use a compatible version.
Read more >
Managing environments | Documentation - Poetry
If you use a tool like pyenv to manage different Python versions, you can set the experimental virtualenvs.prefer-active-python option to true .
Read more >
Configure a Poetry environment | PyCharm Documentation
Poetry is a tool that facilitates creating a Python virtual environment based on the project dependencies. You can declare the libraries your project ......
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
In fact, you most likely already know that if you want to develop against multiple Python versions you can readily use pyenv to...
Read more >
Setting up Python Projects with Pyenv & Poetry
Pyenv - Python version management tool to manage multiple Python ... we will not change the global python interpreter and instead we will ......
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 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