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

Installation of Python 3.8 and Python 3.9 side by side breaks pip version. #62911

Closed
maxim-lobanov opened this issue Oct 15, 2020 · 6 comments
Closed
Labels
outdated PR was locked due to age

Comments

@maxim-lobanov
Copy link

Bug report

What you were trying to do (and why)

We are generating MacOS VMs for CI. We install python@3.8 formula. Then we install some other tools via brew and those tools bring python@3.9 as dependency to machine.

As a result, we have inconsistent python3 and pip3 on machine:

  • python3 from python@3.8 formula
  • pip3 from python@3.9 formula

It causes issues because If you install any packages via pip3 install, they won't be available via python3.

See related issues:

Step-by-step reproduction instructions

Repro steps:

  1. Take clean MacOS (10.14, 10.15 or 11.0)
  2. Install brew
  3. run brew install python@3.8
  4. run brew install python@3.9
  5. Run python3 --version and pip3 --version

What happened (include command output)

Actually, we have the following output:

Mac-1972:~ runner$ python3 --version
Python 3.8.6
Mac-1972:~ runner$ pip3 --version
pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
Mac-1972:~ runner$ ls -la /usr/local/bin/python3
lrwxr-xr-x  1 runner  admin  38 Oct 15 01:01 /usr/local/bin/python3 -> ../Cellar/python@3.8/3.8.6/bin/python3
Mac-1972:~ runner$ ls -la /usr/local/bin/pip3
lrwxr-xr-x  1 runner  admin  35 Oct 15 01:02 /usr/local/bin/pip3 -> ../Cellar/python@3.9/3.9.0/bin/pip3

It means that Python3 is used from python@3.8 formula. Pip3 is used from python@3.9 formula. Those versions are not compatible.
If you install any packages via pip3 install, they won't be available via python3

What you expected to happen

I am expecting that python3 version and pip3 will be consistent.

Possible workaround

We have found a workaround for this issue but it definitely looks like an issue with python formula that should be fixed:

brew install python@3.8
brew install python@3.9
brew unlink python@3.9
brew unlink python@3.8
brew link python@3.8
@ghost
Copy link

ghost commented Oct 16, 2020

Please take a look at this issue. I think it's related.

@SMillerDev
Copy link
Member

It's not

@farvour
Copy link

farvour commented Oct 17, 2020

Also had this issue. A "keg-only" formula should never overwrite these links. This feels like a bug in the 3.9 formula...

@SMillerDev
Copy link
Member

It is, there's a pull request that fixes it in the timeline here. We just need someone to write a check to make sure it doesn't happen again with the next version.

@fxcoudert
Copy link
Member

This is now fixed. Anyone who is affected should be able to restore the expected state of the symlinks with brew reinstall python@3.8

@AFAgarap
Copy link

I'm using zsh, so I had to run echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrc.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 26, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants