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 virtualenvwrapper not auto-picked up by Prezto's python module on Macbook M1 #2094

Open
jeffwidman opened this issue Aug 14, 2024 · 2 comments

Comments

@jeffwidman
Copy link
Collaborator

I was surprised to notice that on a Macbook M1, if I install virtualenvwrapper via brew install virtualenvwrapper that the python module doesn't pick it up. For it to work, I have to explicitly call source .virtualenvwrapper.sh and ain't nobody got time for 'dat!

Looking at the python module here in Prezto, I expected it to automatically discover the presence of the virtualenvwrapper.sh file and source it:

virtualenvwrapper_sources=(
${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
/usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)
)
if (( $#virtualenvwrapper_sources )); then
source "$virtualenvwrapper_sources[1]"
fi

I did notice on a M1 Macbook that since Homebrew uses a different path than intel macs, that may be the problem:

$ which virtualenvwrapper.sh                                                                                                                                                                                                                                                                                                       
/opt/homebrew/bin/virtualenvwrapper.sh

But when I tried locally hardcoding the different path, it didn't seem to work:

    virtualenvwrapper_sources=(
      ${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
      /usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)
      # /opt/homebrew/bin/virtualenvwrapper(_lazy|).sh(OnN)
    )
    if (( $#virtualenvwrapper_sources )); then
      source "$virtualenvwrapper_sources[1]"
    fi
@jeffwidman
Copy link
Collaborator Author

For now as a temp workaround, I'm doing:

$ pip3 install --break-system-packages virtualenvwrapper

But while that works, I actually think it'd be slightly cleaner to be able to brew install virtualenvwrapper... or rather, regardless of where it's coming from, if my path is setup such that I can call which virtualenvwrapper.sh, then I'd expect prezto to source that...

Just not sure why it isn't working... 🤔

@indrajitr
Copy link
Collaborator

This is likely related to how Homebrew changed stuff around Python 3.12. Details are here (https://docs.brew.sh/Homebrew-and-Python#pep-668-and-virtual-environments), but this probably will require a bit more research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants