How does site-packages work with PyTorch and torchvision, given that neither of them get linked to outside their cellars? #5831
Replies: 2 comments
-
python-matplotlib is the same - no links into
|
Beta Was this translation helpful? Give feedback.
-
To me, the way numpy gets set up should be the gold-standard. It has its own python-versioned site-packages dirs in the cellar, but then links to them in the python site-packages. That allows for naive importing without having to add to the python path with every python module that brew installs, and without having to re-source my .bashrc or disable brew updates. |
Beta Was this translation helpful? Give feedback.
-
Output of
brew config
Output of
brew doctor
Description of issue
It's been a while since I've used homebrew python so I'm a bit confused about how this is supposed to work.
Most of the python packages that are available in homebrew seem to contain their own site-packages which then gets linked into the python site-packages directory. But Pytorch's recipe doesn't - it doesn't set up these links into the python site-package dir. Pytorch does have some .pth files, but again it leaves these unlinked inside the cellar.
As a result, torch can't be imported naively, so up until now I've been explicitly adding the PyTorch site-packages directory to my python path in my .bashrc, which is somewhat workable, but actually causes a lot of problems when combined with the (new?) homebrew policy of updating with every brew command - so I've had to also define HOMEBREW_NO_AUTO_UPDATE to avoid having to restart my tmux and my workspace ever time I execute a brew command and accidentally upgrade PyTorch.
Anyways, I installed torchvision and it seems to follow the same policy of not linking out of its cellar, which has me wondering if there's something I'm doing wrong. Am I missing something? Am I supposed to execute some new brew command to make this work properly, without the environment hacks?
Beta Was this translation helpful? Give feedback.
All reactions