Comments (6)
Perhaps the best solution as you say is to re-create the pyenv installation structure using the contents
/libexec/bin
.
This seems like a good idea and the best implementation here.
from brew.
I'm not sure how this ever worked unless the layout of the python formulae or the behavior of pyenv
has changed since the pyenv-sync
command was added. No python formula links python
in the bin
dir, only the version with the version number appended (python3
, python3.12
, etc), and only the newest version links python3, the rest only link python3.xx:
~ % ls $(brew --prefix)/Cellar/python*/*/bin/python* | grep -v config
/opt/homebrew/Cellar/[email protected]/3.10.14/bin/python3.10
/opt/homebrew/Cellar/[email protected]/3.11.9/bin/python3.11
/opt/homebrew/Cellar/[email protected]/3.12.4/bin/python3
/opt/homebrew/Cellar/[email protected]/3.12.4/bin/python3.12
/opt/homebrew/Cellar/[email protected]/3.9.19/bin/python3.9
The other links are present, but only under libexec/bin
, which I assume pyenv
doesn't read. If this is to be fixed I think it's either asking pyenv
to use libexec/bin
(probably not realistic) or building an additional tree of symlinks with a complete bin dir (presumably in the python formulae, but possibly in the pyenv-sync
command) for pyenv-sync
to link to. (I suppose a third option is installing a hacked version of pyenv
, but that seems like the most problematic solution)
from brew.
I'm seeing the same behavior (no "python" command available, only "python3"). But I'm also seeing the that "pyenv local", "pyenv shell", and even pipenv doesn't work with any version of python linked/synced from brew; only versions installed by pyenv
from brew.
Yep. pyenv
only loads what's in .pyenv/versions/$PYENV_VERSION/bin/
. In the case of the two latest homebrew pythons that is:
~ % ls .pyenv/versions/3.12.4/bin
2to3 pydoc3.12
2to3-3.12 python3
idle3 python3-config
idle3.12 python3.12
pip3 python3.12-config
pip3.12 wheel3
pydoc3 wheel3.12
~ % ls .pyenv/versions/3.11.9/bin/
2to3-3.11 python3.11
idle3.11 python3.11-config
pip3.11 wheel3.11
pydoc3.11
Note that there is no overlap in these lists (i.e. no python3
under 3.11.9
). That's a feature of the python formulae so they don't conflict with one another, but it's also why they don't work with pyenv
.
from brew.
That's a feature of the python formulae so they don't conflict with one another, but it's also why they don't work with
pyenv
.
Exactly that. Note that Homebrew is not a version manager. The only reason versioned formulae exist is because other formulae don't work with the newest version.
from brew.
Indeed, something may have changed. I have noticed ~/.pyenv/bin does not get created (unless $pyenv install
). As I was not exactly sure how pyenv is handling things behind the scenes, I decided to open this issue.
For the time being I have just resolved to use pyenv with redundancy.
Inspecting again, I can see
~ % ls ~/.pyenv/versions
3.10.14 3.11.9 3.12.4
~ % ls ~/.pyenv/versions/3.12.4
bin include lib share
~ % ls ~/.pyenv/versions/3.12.4/bin
2to3 idle3.12 pydoc python-config python3.12-config
2to3-3.12 pip pydoc3 python3 python3.12-gdb.py
idle pip3 pydoc3.12 python3-config
idle3 pip3.12 python python3.12
@rrotter Now I understand your comment
I'm not sure how this ever worked unless...
~ % /opt/homebrew/Cellar/[email protected]/3.12.4
Frameworks LICENSE bin sbom.spdx.json
IDLE 3.app Python Launcher 3.app lib share
INSTALL_RECEIPT.json README.rst libexec
~ % ls /opt/homebrew/Cellar/[email protected]/3.12.4/bin
2to3 idle3.12 pydoc3 python3-config wheel3
2to3-3.12 pip3 pydoc3.12 python3.12 wheel3.12
idle3 pip3.12 python3 python3.12-config
I would like to start playing with authoring/modifying homebrew formulaes, but do not have the time now (until September). In [email protected] formulae Install unversioned symlinks in libexec/bin
. Perhaps the best solution as you say is to re-create the pyenv installation structure using the contents /libexec/bin
.
- This will need to be maintained (do not know how often this changes, perhaps more so on pyenv's end than python's)
- What about
pyenv uninstall
? On my search for similar issues I have stumbled upon "pyenv removes/modifies python installation from homebrew cellar" - can't find it now, possibly pyenv or brew repository. In another words, how does brew protect its installations from being mangled with?
Possibly off topic, but providing context:
My own usecase is to use brew-installed python versions to seed my poetry-based projects for development, which does require for the base version installation to exist on a system to create its venv.
I have seen people both
- use brew-installed python versions with pyenv (via manual/script linking)
- use pyenv-installed python versions with homebrew
I was leaning towards 1. as I want ideally one place to think about installing/uninstalling software, but I was seeking automation and brew pyenv-sync
was promising.
@reitermarkus I see your point, if you are fine with latest minor releases use homebrew, if you need something more specific go elsewhere (e.g. pyenv/virtualenv/conda/docker).
Relevant #2138
Original PR 15507
from brew.
Related Issues (20)
- "undefined method `chomp' for nil" When brew update HOT 4
- "brew upgrade" fails with "Error: Version must not be empty" HOT 1
- brew breaks sudo password cache HOT 1
- Upgrading one package (mise) broke two other packages (eza, bat) HOT 9
- sudo timestamp reset may break scripts HOT 6
- Issue installing openJDK HOT 1
- `sudo` not working anymore after running any `brew` command HOT 9
- IRB no longer has irb_at_exit method HOT 2
- Failed to install Homebrew Portable Ruby (and your system version is too old)! HOT 4
- Improve error/warning when `brew install` refuses to install a formula from a tap with the same name as an already installed keg HOT 7
- shellenv.sh: csh/tcsh: Broken code for setting envvar MANPATH HOT 1
- Make `autoremove` idempotent HOT 8
- Run xattr -r -d com.apple.quarantine App.app on casks on Apple Silicon MacOS HOT 20
- Homebrew's brew alias is broken after update this morning on Debian machines HOT 2
- Are all of the `undef`s we use really necessary? HOT 14
- HOMEBREW_PIP_INDEX_URL is misleading and does not work-as-intended with some mirrors
- “Error: comparison of PkgVersion with String failed” when running `brew upgrade` HOT 3
- brew upgrade or install fails with comparison of PkgVersion with String HOT 1
- Brew link step fail if installing multiple formulae with common symlink using a system with symlinked /home HOT 4
- golang not update to 1.23.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brew.