简体   繁体   中英

Single conda environment missing from jupyter

In my current conda environment I want to start using jupyter. I have done this successfully in other projects. This time I'm unable to access the kernel from jupyter.

The environment is activated using conda activate myenv .

The I run, (myenv) jupyter lab , which opens jupyter, but my kernel is not on the list.

I went back to an old environment: (myenv) conda deactivate then conda activate oldenv . There I installed the ipykernel using (oldenv) conda install ipykernel .

This kernel is now on the dropdown list of kernels when starting jupyter regardles of which jupyter i start. This means I can find it using both (myenv) jupyter lab and (oldenv) jupyter lab .

I have tried to reinstall nb_conda and ipykernel in myenv . Now I'm out of ideas. Some outputs from myenv is listed below. I'm at such a loss I don't even know what the relevant output is.

(myenv) jupyter kernelspec list
Available kernels:
  python3    /anaconda3/envs/gkn-phase-two/share/jupyter/kernels/python3
(myenv) conda list | grep nb_conda*
nb_conda                  2.2.1                    py36_0    conda-forge
nb_conda_kernels          2.2.0                 py36_1000    conda-forge
(myenv) conda list | grep ipykernel
ipykernel                 5.1.0           py36h24bf2e0_1002    conda-forge
conda list | grep jupyter*
jupyter                   1.0.0                      py_1    conda-forge
jupyter_client            5.2.4                      py_0    conda-forge
jupyter_console           6.0.0                      py_0    conda-forge
jupyter_contrib_core      0.3.3                      py_2    conda-forge
jupyter_contrib_nbextensions 0.5.1                    py36_0    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyter_highlight_selected_word 0.2.0                 py36_1000    conda-forge
jupyter_latex_envs        1.4.4                 py36_1000    conda-forge
jupyter_nbextensions_configurator 0.4.1                    py36_0    conda-forge
jupyterlab                0.35.4                   py36_0    conda-forge
jupyterlab_server         0.2.0                      py_0    conda-forge

IIUC you want to access several kernels with jupyter(-lab). To achieve this I install on the base conda jupyter(-lab) and for every env i do

source activate my_env
conda install ipykernel
python -m ipykernel install --user --name my_env --display-name "my_env"

Then from a terminal, and without enter on any env, I just need to launch jupyter(-lab) and select the favorite kernel for my notebook.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM