jupyter_core
jupyter_core copied to clipboard
Jupyter system paths are incorrect for Homebrew on M1 mac
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.
FYI, to prepend search paths to the data path list, set the JUPYTER_PATH environment variable, like export JUPYTER_PATH=/opt/homebrew/share/jupyter.
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?
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?
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.