Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running homebrew while in a virtualenv

Simple question: is running homebrew while in a virtualenv a bad idea?

If so, is there any way that I can automatically deactivate the virtualenv each time I run a homebrew command? I don't trust myself to always remember to deactivate the virtualenv or open a new terminal window.

like image 871
e h Avatar asked Mar 13 '14 12:03

e h


2 Answers

Since I just ran across this myself in the documentation, it's probably better in general not to brew install from within an active virtualenv. To quote from said docs:

WARNING: When you brew install formulae that provide Python bindings, you should not be in an active virtual environment.

Activate the virtualenv after you've brewed, or brew in a fresh Terminal window. Homebrew will still install Python modules into Homebrew's site-packages and not into the virtual environment's site-package.

Virtualenv has a switch to allow "global" (i.e. Homebrew's) site-packages to be accessible from within the virtualenv.

As such, if you are certain the formula you are brewing will not attempt to provide new Python bindings then let it rip. But for me, if there's no specific reason to brew install with my virtual environment activated, I try and remember to deactivate beforehand.

like image 136
Jared Avatar answered Oct 20 '22 00:10

Jared


I don't think if they are related. You have to use pip for python package management when you use virtualenv. this way you make sure that your new stuff is on the sandbox you created. AFAIK home-brew installs stuff globally. So better not use it to get the python modules. hope it helps.

like image 42
Hossein Avatar answered Oct 20 '22 02:10

Hossein