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 leads to mixed up python paths #260

Open
Libretto7 opened this issue Apr 26, 2024 · 4 comments
Open

Brew leads to mixed up python paths #260

Libretto7 opened this issue Apr 26, 2024 · 4 comments

Comments

@Libretto7
Copy link

Using brew to install a python program also installs python3 and pip3 into /home/linuxbrew/.linuxbrew/ .
But there's also a python(3) and pip(3) on the host.

The problem is that when the user uses the commands python or pip, it defaults to the programs installed on the host
and when the user uses python3 or pip3 the programs of the brew install get used.

So if you want to use python without spinning up a distrobox (which should be possible), the different paths can lead to confusion. For example:

  • install module with pip
  • run a program using the module with python3
  • "module not found" error

The brew python should not be in PATH as it is just a dependency of brew programs and should not be used directly.
pip3 install also tells you that this pip (the brew one) should not be used.

@m2Giles
Copy link
Member

m2Giles commented May 16, 2024

If you want to always have system python and pip being used when using an interactive shell:

You can add them to the beginning of PATH as part of your bashrc. They will then have precedence over the python installed by brew

@castrojo
Copy link
Member

Ok so I just tested this. If we do a brew unlink python it removes the python stuff from the path, just for python, seems like a clean solution. I was able to still install and run python apps installed from brew, and it seems to be defaulting to the system python afaict.

This seems like a good default to go with, it'd be weird if python behaved different on a ublue system than a fedora one.

@m2Giles
Copy link
Member

m2Giles commented May 16, 2024

we can also put Brew at the end of PATH so we defer to system binaries.

The unlink will relink after the next upgrade I believe

@marcoceppi
Copy link

marcoceppi commented May 16, 2024

Putting it at the end of the path means if I brew install Python for myself I won't get it as expected. If a brew installed software requires Python brew shouldn't be doing the brew link for Python that feels like a brew issue

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

4 participants