Homebrew-core: [email protected] breaks python installation

Created on 29 Dec 2019  ·  10Comments  ·  Source: Homebrew/homebrew-core

  • [X] ran brew update and can still reproduce the problem?
  • [X] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [X] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

I wanted to install python and [email protected] in parallel, cause the brews cookiecutter and httpie rely on [email protected].

What happened (include command output)

/usr/local/bin/pip3 from python was replaced with /usr/local/bin/pip3 from [email protected]. For all packages installed with pip3 for global usage, are also using Python 3.8.


Command output

❯ brew reinstall python
[...]
❯ pip3 --version
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
❯ brew install [email protected]
[...]
❯ pip3 --version
pip 19.3.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

What you expected to happen

[email protected] should be keg-only, so a pip3 that uses this version of python should be stored in /usr/local/Cellar/[email protected]/3.8.1/bin/ and not be referenced from /usr/local/bin.

Step-by-step reproduction instructions (by running brew install commands)

brew install python
brew install [email protected]

https://gist.github.com/oliverandrich/bdf9caa4f2d33d10f3f071874b933804#file-python-3-8-2019-12-29_16-22-02-txt

outdated

Most helpful comment

Add /usr/local/opt/[email protected]/bin to your PATH

All 10 comments

poke @bayandin @iMichka

I’m not a Python expert but it looks like the versioned [email protected] is installing stuff outside its keg:

    # post_install happens after link
    %W[pip3 pip#{xy} easy_install-#{xy} wheel3].each do |e|
      (HOMEBREW_PREFIX/"bin").install_symlink bin/e
    end

That postinstall is doing a lot of things directly in HOMEBREW_PREFIX, to which it should not have any access. That looks like a Bad Idea, but maybe it is more subtle than that…

Both pip3 and wheel3 in that list above should not be present on versioned Python formulas.

@oliverandrich running brew postinstall python should fix the issue for you, while we work on the root cause of the bug

@fxcoudert @bayandin @iMichka Side question: I am working on a new formula for poetry. Should I base this already on [email protected]? Or is it save for a new formula to rely on the "normal" python formula.

@oliverandrich right now if it depends only on python and nothing else, [email protected]. Otherwise, python

Two-stage strategy to fix this:

Meanwhile, users affected should run brew postinstall python to fix the issue locally.

I might be missing something. I want Python 3.8 to be the default python3 in my system, instead of 3.7.
Is there a reason not to do it (why is [email protected] keg-only)? Is there anything I can do locally to make python3 and pip3 use 3.8?
Please explain the situation, as I didn't find anything in https://docs.brew.sh/Homebrew-and-Python and https://formulae.brew.sh/formula/[email protected].

We will be migrating everything to Python 3.8 as soon as we can, but migration and testing takes time. Also, not all packages are ready as of now.

@fxcoudert thanks. In the meantime, what's the correct way to run my code against 3.8? Currently all of my scripts are shebanged with /usr/bin/env python3.

Add /usr/local/opt/[email protected]/bin to your PATH

Was this page helpful?
0 / 5 - 0 ratings