Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling jupyter notebook outputs error #33

Closed
jshin49 opened this issue Nov 14, 2017 · 28 comments
Closed

calling jupyter notebook outputs error #33

jshin49 opened this issue Nov 14, 2017 · 28 comments

Comments

@jshin49
Copy link

jshin49 commented Nov 14, 2017

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?

@Cadair
Copy link
Owner

Cadair commented Nov 14, 2017

'environment_kernels.EnvironmentKernelSpecManager' could not be imported

It appears from this line that there is something wrong with your install, are you sure you have this pacakge and your notebook server installed in the same env?

@Avik1993
Copy link

I am facing the same error. Any way to rectify this?

@driesbuyck
Copy link

driesbuyck commented Feb 2, 2018

I have the same problem. Is this plugin working in python 3.6 environments and jupyter notebook 5.0.0?

import environment_kernels
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<removed>/.conda/envs/myenv/lib/python3.6/site-packages/environment_kernels/__init__.py", line 2, in <module>
    from .core import *
  File "<removed>/.conda/envs/myenv/lib/python3.6/site-packages/environment_kernels/core.py", line 7, in <module>
    from jupyter_client.kernelspec import (KernelSpecManager, NoSuchKernel)
ModuleNotFoundError: No module named 'jupyter_client'

-> After installing module jupyter_client, I can now import it

Python 3.6.3 |Anaconda, Inc.| (default, Nov 20 2017, 20:41:42) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import environment_kernels
>>> 

But I still get the error when starting jupyter notebook

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

@driesbuyck
Copy link

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

@Cadair
Copy link
Owner

Cadair commented Feb 15, 2018

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?

@driesbuyck
Copy link

driesbuyck commented Feb 16, 2018

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)

@Cadair
Copy link
Owner

Cadair commented Feb 19, 2018

maybe this needs to be a little better documented (much like the whole project), but the solution to this, as you have found, is to have both the notebook server and environment_kernels installed in the same path.

@Cadair Cadair closed this as completed Feb 19, 2018
@Darshil020
Copy link

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

@buddhashrestha
Copy link

You need to install environment_kernels using :
pip install environment_kernels

@xiaoleitw
Copy link

facing the same question.

@nocibambi
Copy link

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.

@nocibambi
Copy link

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...)

@InsciteAnalytics
Copy link

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

@lstamaria
Copy link

@nocibambi
This actually works. Amazing. Thank you!

@Djeutsch
Copy link

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.

@PursuitYP
Copy link

@nocibambi It really works! Thank you very much!

@andreisharshov
Copy link

@nocibambi Thank you very much!:)

@ghost
Copy link

ghost commented Jul 20, 2019

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

@sykim862
Copy link

@Djeutsch Thank you very much ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

@jamesmuniu
Copy link

Thank you!!

@andrewssdd
Copy link

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.

@coolkate3738
Copy link

@nocibambi you are a real hero!! Big love <3

@minying1999
Copy link

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...)

Thank you very much, you are such a hero!

@sreedharu
Copy link

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...)

Thank you

@scott-n58
Copy link

scott-n58 commented May 8, 2020

this issue seems to be a problem with nb extensions becoming corrupted.
https://docs.anaconda.com/anaconda/user-guide/tasks/use-jupyter-notebook-extensions/
reviewing this setting after following the deletion step from above I did get
a notebook session successfully started. of course - w/o my envs.
to resolve this i found the link above & in an open notebook cell:
conda install nb_conda
after this was completed (w/o any hiccups) i checked that *_config.json file
& sure enough:
in this jupyter_notebook_config.json was the new extension seek line
with nb_conda set to true.

{
"NotebookApp": {
"nbserver_extensions": {
"nb_conda": true
},
"kernel_spec_manager_class': "nb_conda_kernels.CondaKernelSpecManager"
}

closing with a restart - the new session displayed all of my envs & available for selection.

@Larry-u
Copy link

Larry-u commented Aug 6, 2021

this issue seems to be a problem with nb extensions becoming corrupted.
https://docs.anaconda.com/anaconda/user-guide/tasks/use-jupyter-notebook-extensions/
reviewing this setting after following the deletion step from above I did get
a notebook session successfully started. of course - w/o my envs.
to resolve this i found the link above & in an open notebook cell:
conda install nb_conda
after this was completed (w/o any hiccups) i checked that *_config.json file
& sure enough:
in this jupyter_notebook_config.json was the new extension seek line
with nb_conda set to true.

{
"NotebookApp": {
"nbserver_extensions": {
"nb_conda": true
},
"kernel_spec_manager_class': "nb_conda_kernels.CondaKernelSpecManager"
}

closing with a restart - the new session displayed all of my envs & available for selection.

The analysis from this bro is correct, if u just delete

"kernel_spec_manager_class': "nb_conda_kernels.CondaKernelSpecManager"

from jupyter_config.json, the error is gone but u cannot see envs in jupyter starter page.

The correct way is delete that line in jupyter_config.json, and append it to jupyter_notebook_config.json (in the same dir), as the this quote displayed.

@KonWys01
Copy link

If someone has this issue in case of ArcGIS Pro, then removing "kernel_spec_manager_class': "nb_conda_kernels.CondaKernelSpecManager" from jupyter_config.json solves the issue (in default environment -C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\etc\jupyter.

If you are not allowed to do it - grand yourself all roles in properties -> security -> users. You need administrator account to do it

@mugsiemx
Copy link

SOLVED!! THANK YOU so very much!! my path is; C:\Users<username>\anaconda3\etc\jupyter\jupyter_notebook_config.json. Once deleting the "kernel_spec_manager_class': "nb_conda_kernels.CondaKernelSpecManager" line from the file, my jupter notebook fired up quickly!! I AM SO GRATEFUL!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests