Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The specified Python version (3.8) is not supported by the project (^3.7). #1735

Closed
3 tasks done
jobevers opened this issue Dec 13, 2019 · 15 comments · Fixed by #1736
Closed
3 tasks done

The specified Python version (3.8) is not supported by the project (^3.7). #1735

jobevers opened this issue Dec 13, 2019 · 15 comments · Fixed by #1736
Assignees
Labels
kind/bug Something isn't working as expected

Comments

@jobevers
Copy link

jobevers commented Dec 13, 2019

  • 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).

  • OS version and name: Ubuntu 18.04.3 LTS

  • Poetry version: Poetry version 1.0.0

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/jobevers/a3e674e4f316a6c0ea535ac818bf5f61

Issue

I wanted to start using python 3.8 in a project:

» poetry env use -vvv 3.8.0 

[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.

Traceback (most recent call last):
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
    env = manager.activate(self.argument('python'), self._io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
    self.create_venv(io, executable=python, force=create)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
    self._poetry.package.python_versions, python_minor
@jobevers jobevers added the kind/bug Something isn't working as expected label Dec 13, 2019
@sdispater
Copy link
Member

You should use only the minor version with env use:

poetry env use 3.8

Basically, Poetry looks for a python3.8.0 executable which it does not find leading to this error.

@finswimmer
Copy link
Member

Hello @jobevers ,

I guess the error message is misleading. poetry env use expect the path to an python executable and not a version number.

So specify the complete path to the python 3.8 interpreter or, if you use pyenv for handling multiple python versions, activate the correct version first.

fin swimmer

@jobevers
Copy link
Author

» poetry env use -vvv 3.8

[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.

Traceback (most recent call last):
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
    env = manager.activate(self.argument('python'), self._io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
    self.create_venv(io, executable=python, force=create)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
    self._poetry.package.python_versions, python_minor

@sdispater
Copy link
Member

@jobevers Do you actually have a python3.8 executable in your PATH?

@jobevers
Copy link
Author

poetry env use -vvv /home/jobevers/code/pyenv/versions/3.8.0/bin/python                                             

[NoCompatiblePythonVersionFound]
The specified Python version (3.8) is not supported by the project (^3.7).
Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file.

Traceback (most recent call last):
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/console/commands/env/use.py", line 23, in handle
    env = manager.activate(self.argument('python'), self._io)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 259, in activate
    self.create_venv(io, executable=python, force=create)
  File "/home/jobevers/.local/pipx/venvs/poetry/lib/python3.6/site-packages/poetry/utils/env.py", line 520, in create_venv
    self._poetry.package.python_versions, python_minor

@jobevers
Copy link
Author

» which python3.8
/home/jobevers/code/pyenv/shims/python3.8

@sdispater
Copy link
Member

Oh, I know what's going on, this is a bug in how Poetry gets the patch version of the executable. Basically, it uses the current Python for the patch version instead of the one of the passed executable.

This should be an easy fix.

@echernyavskiy
Copy link

@sdispater could you cut a patch release that includes this fix?

@kamyar
Copy link
Contributor

kamyar commented Jun 5, 2020

+1 having this issue at the moment with python 3.8.2.

Edit:
changing

[tool.poetry.dependencies]
python = "3.8"

to

[tool.poetry.dependencies]
python = "^3.8"

worked.

I guess initially set it too strictly without knowing

@tinder-alexbohr
Copy link

I guess initially set it too strictly without knowing

I'm getting mixed results - work for me but not the person next to me, not sure which is expected behaviour. When saying:

[tool.poetry.dependencies]
python = "3.8"

which patch versions does that support?

@abraralali
Copy link

+1 having this issue at the moment with python 3.8.2.

Edit:
changing

[tool.poetry.dependencies]
python = "3.8"

to

[tool.poetry.dependencies]
python = "^3.8"

worked.

I guess initially set it too strictly without knowing

Thank you kamyar
This solution worked for me also. Python 3.8.5

@himsgupta
Copy link

+1 having this issue at the moment with python 3.8.2.

Edit: changing

[tool.poetry.dependencies]
python = "3.8"

to

[tool.poetry.dependencies]
python = "^3.8"

worked.

I guess initially set it too strictly without knowing
It didinot work in my case, somehow

@neersighted
Copy link
Member

Fixed mine by adding this to ~/.zshrc (on advice from work documentation). Also needed to restart shell and rerun poetry install.

export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
export C_INCLUDE_PATH=/opt/homebrew/Cellar/librdkafka/1.8.2/include
export LIBRARY_PATH=/opt/homebrew/Cellar/librdkafka/1.8.2/lib

I think you may have gotten turned around and are discussing something totally different.

@allendred
Copy link

+1 having this issue at the moment with python 3.8.2.

Edit: changing

[tool.poetry.dependencies]
python = "3.8"

to

[tool.poetry.dependencies]
python = "^3.8"

worked.

I guess initially set it too strictly without knowing

This does not work. After manually modifying toml, python-versions = "^3.7" executes poetry add numpy and still uses version 3.10 of numpy

nickumia-reisys added a commit to GSA/datagov-harvester that referenced this issue Apr 28, 2023
- I needed to specify the python version for poetry to work properly... I didn't have python 3.9 installed... python-poetry/poetry#1735 (comment)
- Don't limit python version to ^3.9, but we should support all newer version as well
- Add titles to make the Github Action page easier to read
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants