Issue
I am starting jupyter from conda which is installed in my home directory on MacOS. I opened up a notebook to test a module I installed in conda. To my surprise, this did not work. The module is correctly installed and importing it in interactive python started from conda works. Even stranger is that
import sys
sys.executable
run in a notebook cell points to a virtual environment completely unrelated to all of this. It is locate in a different subdirectory of the parent directory the test notebook is in. I have started conda in the VS Code interactive shell, maybe this helps.
which jupyter
correctly points to the conda installation in my home directory, as do which python
, which python3
and which python9
and which pip3
.
How to I change this weird behavior and what causes it? That is, how can I use the conda python environment instead of this virtual environment?
Edit
This is somehow related to the port forwarding set up by VS Code. I cannot connect to the server without it. Even connecting via regular ssh and using port mapping via the -L
flag, this happens.
Edit 2
I zipped the directory containing the python environment and removed the actual directory. Now the jupyter kernel won't start anymore because of a FileNotFound
pointing to this exact python
executable. But why?
Solution
The problem was a stray Kernel configuration located at ~/Library/Jupyter/kernels
. I faintly remembering installing jupyterlab to the main python installation on this machine once. This must have created this configution. The installation on conda seems to use this configuration. I removed the ~/Library/Jupyter
directory and now everything works as expected.
Note that this configuration hid the correct "Python 3" Kernel. That is, when I tried to create a new python 3 notebook, the menu only listed one "Python 3" entry which referred to the incorrect python 3 installation in the virtual environment.
Answered By - HerpDerpington
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.