jupyter_environment_kernels: calling jupyter notebook outputs error

calling

jupyter notebook --NotebookApp.kernel_spec_manager_class='environment_kernels.EnvironmentKernelSpecManager'

causes this error:

[C 15:15:03.610 NotebookApp] Bad config encountered during initialization:
[C 15:15:03.610 NotebookApp] The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x10314af90> instance must be a type, but u'environment_kernels.EnvironmentKernelSpecManager' could not be imported

How should I deal with this issue?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 28 (3 by maintainers)

Most upvoted comments

You need to install environment_kernels using : pip install environment_kernels

Same issue. I cannot run jupyter notebook from the system (but it works from another environment).

Here, someone solved by editing the config, but did not specify which one.

Ok, so I solved it finally, here are the steps:

  1. In terminal, find the configurations directories with jupyter --paths.
  2. In one of the directories there I found jupyter_notebook_config.json
  3. Save a back up copy 😉
  4. From the file delete the following line:
"kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager" 
  1. Delete the comma preceding it. (Duh, I know…)

got this fixed by installing juypiter notebook inside the new conda environment (conda install jupyter)

i tried installing jupyter notebook inside my environment. it is still not working.

For error that cannot import

nb_conda_kernels.CondaKernelSpecManager

It was because nb_conda_kernels cannot be imported. That can happy when you change environment that calls juypter notebook.

conda install nb_conda_kernels resolves the problem.

Same issue. I cannot run jupyter notebook from the system (but it works from another environment). Here, someone solved by editing the config, but did not specify which one.

Ok, so I solved it finally, here are the steps:

  1. In terminal, find the configurations directories with jupyter --paths.
  2. In one of the directories there I found jupyter_notebook_config.json
  3. Save a back up copy 😉
  4. From the file delete the following line:
"kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager" 
  1. Delete the comma preceding it. (Duh, I know…)

Many thanks for this.

@nocibambi My friend, I owe you my sanity 😉 Thanks so much!

Yes, I had environment_kernels installed in a conda environment, but the jupyter notebook I seemed to be starting it from the system. So after installing jupyter notebook inside the conda env, it was fixed.
(I could probably also have installed environment_kernels in system env to get rid of the issue, but it’s cleaner inside the conda environment)

You will have to have environment_kernels installed in the Python env (conda, virtualenv or system) where you are running the jupyter notebook command. Is that what you are saying you fixed, or are you having startup issues if you don’t have jupyter installed in all your envs?

my jupyter_notebook_config.json file was in /opt/conda/envs/beakerx/etc/jupyter