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.

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

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

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 https://github.com/python-poetry/poetry/issues/4646.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
xareeleecommented, 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.

0reactions
Secruscommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Set Up Python and Poetry
Setting up Python using pyenv. First, install pyenv. There are different ways to do so as described here. For Mac, I choose the...
Read more >
Why is not recommended to install poetry with homebrew?
Homebrew installed poetry will probably also depend on Homebrew-installed Python, etc, instead of having its own isolated venv to execute from.
Read more >
Managing environments | Documentation
By default, Poetry will try to use the Python version used during Poetry's installation to create the virtual environment for the current project....
Read more >
How to Manage Multiple Python Versions on an Apple ...
How to Manage Multiple Python Versions on an Apple Silicon M1 Mac. Install both ARM64 and x86 Python versions and seamlessly switch between...
Read more >
What are your thoughts on Homebrew for getting Python3 ...
I install Python with Homebrew and then use Pyenv. ... Pyenv does not depend on Python itself. pyenv was made from pure shell...
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