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

brew install poetry depends on python@3.10 and not using pyenv python (macOS) #5423

Closed
3 tasks done
xareelee opened this issue Apr 7, 2022 · 6 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@xareelee
Copy link

xareelee commented Apr 7, 2022

  • 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

I installed both pyenv and poetry by homebrew on macOS.

$ brew install pyenv
$ pyenv --version
pyenv 2.2.5

$ brew install poetry
$ poetry --version
Poetry version 1.1.13

I installed python 3.10.3 by pyenv

$ pyenv install 3.10.3
$ pyenv global 3.10.3
$ pyenv versions
  system
* 3.10.3 (set by ~/.pyenv/version)

# check python version and path
$ python --version
Python 3.10.3
$ ls -lh `which python`
-rwxr-xr-x  1 xaree  staff   182B Mar 23 06:44 /Users/xaree/.pyenv/shims/python

Now I create a python project using poetry

$ mkdir hello
$ cd hello
$ poetry init -n

# enter venv
$ poetry shell

# Check python version. It's not 3.10.3
$ python --version
Python 3.10.2
$ ls -lh `which python`
lrwxr-xr-x  1 xaree  staff    44B Apr  7 12:59 /Users/xaree/dev/playground/hello/.venv/bin/python -> /opt/homebrew/opt/python@3.10/bin/python3.10

The poetry uses brew's python, not pyenv's python. I did not install brew's python manually, but brew's poetry did.

Questions:

  • Is the dependency python@3.10 necessary in poetry.rb for brew installation?
  • How could I initiate a poetry project with specific pyenv's python?

This issue may associate with #4646.

@xareelee xareelee added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Apr 7, 2022
@xareelee
Copy link
Author

xareelee commented Apr 7, 2022

BTW, this issue could be resolved by reinstalling poetry with the official way:

# Uninstall poetry from brew
$ brew uninstall poetry

# Install poetry by official method
$ curl -sSL https://install.python-poetry.org | python3 -

# You need to reinstall packages by poetry
$ rm -r .venv
$ poetry install

# Now it points to pyenv's python
$ poetry shell
$ python --version
Python 3.10.3
$ ls -lh `which python`
lrwxr-xr-x  1 xaree  staff    50B Apr  7 14:15 /Users/xaree/dev/PythonPro/.venv/bin/python -> /Users/xaree/.pyenv/versions/3.10.3/bin/python3.10

I leave the issue opened for installing poetry with brew.

@Rafeqm
Copy link

Rafeqm commented Apr 16, 2022

Opened issue means unresolved issue.

Google can track closed issue as well so there is no need to leave this issue opened.

@ericycfu
Copy link

Same issue with the following configuration

  1. M1 Mac with Monterey, version 12.4
  2. Use asdf to install python 3.10.5
  3. asdf is the active python version and is first in the PATH before homebrew /Users/ericfu/.asdf/shims:/Users/ericfu/.asdf/bin:/opt/homebrew/bin:/opt/homebrew/sbin
  4. Poetry 1.1.13 installed through pipx

I did temporarily hack it by using an .envrc and direnv with poetry env use ~/.asdf/installs/python but that is obviously not ideal.

Installing poetry with curl rather than pipx as mentioned above fixed this issue.

@trallnag
Copy link

trallnag commented Jul 7, 2022

I wonder why Homebrew is not installing Poetry in a self-contained manner.

@Secrus
Copy link
Member

Secrus commented Jul 7, 2022

Homebrew installation is not an official one and is not maintained by the Poetry team. The only official ways are the ones that are mentioned in Poetry documentation.

@Secrus Secrus closed this as completed Jul 7, 2022
@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jul 9, 2022
Copy link

github-actions bot commented Mar 1, 2024

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 Mar 1, 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

No branches or pull requests

6 participants