Closed mnky9800n closed 3 years ago
Could you check you are actually using the kernel of the new environment?
You can list all installed kernels with the following command:
jupyter kernelspec list
If you are seeing multiple kernel definition, you may need to pick the right one in the notebook.
You can do that by selecting Kernel > Change Kernel... in the menu:
The only kernels that appear are the ones in this list. I am not sure why it has tensorflow, etc. in this list. Those are old kernels from other environments.
Also this is the output of the available kernels:
(borehole) john@vegeta:~/research$ jupyter kernelspec list
Available kernels:
ir /home/john/.local/share/jupyter/kernels/ir
python3 /home/john/.local/share/jupyter/kernels/python3
tensorflow /home/john/.local/share/jupyter/kernels/tensorflow
tf /home/john/.local/share/jupyter/kernels/tf
I'm at a complete loss. In every step it seems like the jupyter lab server is coming from the borehole environment until i open a notebook and read the path which is clearly pointing to a different environment.
Is there some config file that exists somewhere outside of the environment that is getting referenced? When I checked the other environments I have they all actually have the same problem.
As you are using conda environment, I would advice you to install nb_conda_kernels in the same environment than JupyterLab. It will ease picking up the proper kernel. Then you should have the expected results for sys.path
that worked thank you.
Description
This is related to this stackoverflow post:
https://stackoverflow.com/questions/68085993/conda-environment-path-is-different-for-ipython-versus-jupyter
Basically, I create a new environment with conda, I conda install jupyter and jupyterlab. I run the jupyter lab server. This is loaded from the newly created environment. When I open a notebook in the browser, it says the path is to a different environment. This quickly leads to trouble since none of the installed libraries from conda end up being accessible to the notebook since it sees a different environment as the path.
Reproduce
conda create -n test python=3.8
conda install jupyter
conda install jupyterlab
jupyter lab
import sys
sys.path
Expected behavior
The path of a notebook should be the same as the path of the server
Context
Troubleshoot Output
Command Line Output