I’m trying to open existing jupyter notebooks using a freshly installed jupyter from conda. I am doing this on MacOS Catalina (this may be involved).
When I try to open any of the notebooks in the directory from the Jupyter Home Page, I get this error:
Unreadable Notebook: /Users/rpg/projects/xplan/xplan-dev-env/xplan-experiment-analysis/MyNotebook.ipynb FileNotFoundError(2, 'No such file or directory')
The files are definitely there – I can paste the filenames into the terminal and ls
them, and they are there.
The answer:
Conda environments, unlike standard virtual environments, do not shadow the user’s native configuration. So when I was in the conda environment that I thought was all set up correctly:
- python was loading packages from
~/.local
instead of from my conda environment and - jupyter was finding a global configuration that was wildly inappropriate to the virtual environment at hand.
So this is really a conda issue, not a jupyter one. But on the off-chance that anyone else gets bitten by this, the answer is to configure your conda environment so that the environment variable $PYTHONNOUSERSITE
is “True” (or really any value the shell sees as true), and JUPYTER_PATH
is bound to the configuration in your conda environment, so jupyter isn’t decoyed into looking in ~/.local
or goodness only knows where else.
The whole MacOS thing turns out to be a big red herring.
Old stuff, no longer of interest
The logs dumped to the window show this:
[W 17:24:35.865 NotebookApp] 400 GET /api/contents/MyNotebookipynb?type=notebook&_=1610666675658 (127.0.0.1): Unreadable Notebook: /Users/rpg/projects/xplan/xplan-dev-env/xplan-experiment-analysis/notebooks/MyNotebook.ipynb FileNotFoundError(2, 'No such file or directory')
[W 17:24:35.866 NotebookApp] Unreadable Notebook: /Users/rpg/projects/xplan/xplan-dev-env/xplan-experiment-analysis/notebooks/MyNotebook.ipynb FileNotFoundError(2, 'No such file or directory')
[W 17:24:35.866 NotebookApp] 400 GET /api/contents/MyNotebook.ipynb?type=notebook&_=1610666675658 (127.0.0.1) 8.190000ms referer=http://localhost:8888/notebooks/MyNotebook.ipynb
One thing I wondered was whether this could be related to Apple’s new, more aggressive access controls. Is there any chance that this means not that the file isn’t there, but that it isn’t readable by jupyter? And if so, does anyone know how to fix this?
Alternatively, is there any way to get more robust logging or – even better – get myself into pdb
so that I can see what is going wrong here?