-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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-installed Poetry can't use pyenv-managed Python versions #53169
Comments
Are you asking for a Homebrew-installed application to be able to use a Python of your choice rather than Homebrew's Python? |
Correct. This is seemingly a pretty fundamental feature because Poetry manages the underlying virtualenv your project's dependencies are installed into. Without being able to control the precise version of Python that Poetry uses (or minimally, installs into the virtualenv) it's very difficult to use Poetry. (The exception of course is if the version of Python installed by Homebrew exactly matches what you'd like your project to run on). One way around this could be use to Homebrew to install Python. This would be fine for us I think, but it seems there isn't much control over which version of Python Homebrew installs (I see From my perspective, the most natural tool for Python version management in the contemporary toolchain is pyenv so it does seem like it could be nice if Homebrew-installed Poetry could be made capable of utilizing that. |
Sorry, it's expected behaviour that Homebrew-installed tools use the Homebrew-installed dependencies when run. It sounds like you may be best to install Poetry outside of Homebrew. Thanks! |
Hm but this fundamentally limits Poetry. Wouldn’t it be reasonable to expect that brew-installed pyenv could interact with brew-installed Poetry? That’s simply not the case today... |
Perhaps but you can install it with
Whether it's reasonable or not: it's not what we currently do or plan to change, sorry. |
I don't think this is a workable solution for our use-case. We might be able to workaround this by using brew to install a specific version of Python, but then this won't actually work when we have projects with conflicting Python versions (we currently are in this situation).
What's the point of installing Poetry in this way then? I'd love to better understand this rationale. This takes a tool which relies heavily on the specific Python version you're running, locks that down in a way that isn't configurable (or seemingly barely so), and then doesn't provide any way to interact with the standard toolset (e.g. pyenv) for managing Python versions. Why not provide an option to install Poetry configured to use pyenv as part of the build environment? |
The problem comes with Poetry's dependencies. You can already override the Python used to execute Poetry (as with any shebang), but you would have to be using the exact same Python as Poetry was configured to use (3.7). Python 3.8 in your pyenv would likely not work well with Homebrew Poetry. Homebrew will change Poetry to use 3.8 in the future without notice. |
The thousands of other users who are using it in the last few months would be able to tell you. @Bo98 has provided more explanation: I think we've hit the limit of productive discussion: this is the Homebrew issue tracker and this is not a bug. |
brew update
and can still reproduce the problem?brew doctor
, fixed all issues and can still reproduce the problem?brew config
andbrew doctor
and included their output with your issue?What you were trying to do (and why)
Hi there, I've been mucking around with setting up a consistent Python environment for my team. We use Poetry to manage our Python project dependencies. While a nice improvement over historical alternatives, it's hardly been a silver bullet so it's required some extra work to get things working smoothly across local environments. Specifically, in order to keep the project on a locked version of Python, we've paired Poetry with pyenv.
This has generally worked, but recently we've switch from installing Poetry via the standard cURL method, to using Homebrew. Why brew? Well once again it's hard to keep everyone's environments aligned and specifically the
brew bundle
facility allows us to ship aBrewfile
with our projects thus keeping everyone on a consistent set of tools. Problem solved, right?Well, not exactly. In theory we should be able to use the
Brewfile
to provide Poetry, pyenv, and other system-level dependencies. While it does in fact provide those things, it seems that by moving to installing Poetry with brew we're no longer able to point Poetry at Python versions managed by pyenv.What happened (include command output)
For example, let's say I want to use Python 3.6 and I install that with pyenv and then set my local project to 3.6.10:
Now, I've already configured my
pyproject.toml
to require this specific version of Python and I'll also instruct Poetry to set up the virtualenv to use it:Unfortunately this didn't work as intended:
What you expected to happen
I'd hope that we could still manage Python versions with pyenv after installing Poetry with brew. It seems we aren't able to (see above). Cursory investigation seems to reveal that the Poetry bin installed by brew is hardcoding Python:
This doesn't necessarily seem like the intended behavior so I figured it probably warrants an issue.
Output of
brew config
andbrew doctor
commandsThe text was updated successfully, but these errors were encountered: