jupyter_core icon indicating copy to clipboard operation
jupyter_core copied to clipboard

Jupyter system paths are incorrect for Homebrew on M1 mac

Open twavv opened this issue 3 years ago • 4 comments

Homebrew on an M1 Mac is usually installed into /opt/homebrew (instead of /usr/local/... on an Intel Mac).

This means that when kernels are installed using setup.py data_files, Jupyter doesn't find them since it's hardcoded to use /usr/local/share/jupyter.

Opened this issue on this repo since that's where the default /usr/local/share/jupyter path is defined.

twavv avatar Dec 23 '21 21:12 twavv

FYI, to prepend search paths to the data path list, set the JUPYTER_PATH environment variable, like export JUPYTER_PATH=/opt/homebrew/share/jupyter.

jasongrout avatar Dec 29 '21 06:12 jasongrout

Jupyter will pick up share directories in the sys.prefix as well, so that should cover the case where Jupyter was running from a Python in /opt/homebrew. Can you give some instructions to reproduce this issue?

jasongrout avatar Dec 29 '21 06:12 jasongrout

Not entirely sure how to reproduce because it's not easy to create a throwaway mac environment. It seems like sys.prefix doesn't match where packages actually get installed. I think it might be related to this: https://github.com/Homebrew/homebrew-core/issues/25592.

>>> import sys
>>> sys.prefix
'/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9'

But the individual packages are installed into /opt/homebrew/lib/python3.9/site-packages.

Maybe Jupyter should be checking all the paths in sys.path instead of just sys.prefix?

twavv avatar Dec 31 '21 20:12 twavv

Is it possible, that the jupyter_path() function does ignore the JUPYTER_PATH environment variable, as in my case it is not listed in it's output?

I tried to workaround the described issue by adding the /opt/homebrew/... path to the environment variable, but it still does not appear in the jupyter_path() output.

guger avatar Oct 19 '22 20:10 guger