jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.71k stars 4.94k forks source link

Bad config encountered during initialization: #2875

Open foreignsand opened 7 years ago

foreignsand commented 7 years ago

When I try to launch Jupiter Notebook from the command line or from Anaconda Navigator I get the following error:

[C 13:09:45.091 NotebookApp] Bad config encountered during initialization: [C 13:09:45.104 NotebookApp] The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x101ca3278> instance must be a type, but 'nb_conda_kernels.CondaKernelSpecManager' could not be imported

I can run Jupiter Notebook from other Python environments but not from root. I would really like to just be able to launch the notebook using the default version of Python on my machine. Currently this is 3.6.2.

Many thanks, Emily

blink1073 commented 7 years ago

Hi Emily,

It sounds like you have nb_conda_kernels enabled but not installed in the root environment. Can you give the output of jupyter serverextension list and conda list nb_conda_kernels from the root environment?

foreignsand commented 7 years ago

Sure thing. Here they are:

$ jupyter serverextension list
config dir: /Users/lemurbear/anaconda/etc/jupyter
    nb_anacondacloud  enabled 
    - Validating...
Error loading server extension nb_anacondacloud
      X is nb_anacondacloud importable?
    nb_conda  enabled 
    - Validating...
Error loading server extension nb_conda
      X is nb_conda importable?
    nbpresent  enabled 
    - Validating...
Error loading server extension nbpresent
      X is nbpresent importable?
$ conda list nb_conda_kernels
# packages in environment at /Users/lemurbear/anaconda:
#
nb_conda_kernels          2.0.0                    py35_0

Thanks!

blink1073 commented 7 years ago

@bollwyvl, @damianavila, thoughts on the above?

damianavila commented 7 years ago

What is the content of this file? /Users/lemurbear/anaconda/etc/jupyter/jupyter_notebook_config.json

gayathry2612 commented 6 years ago

I encountered this error : Please share any information on how to resolve this. Thanks

[C 12:18:07.611 NotebookApp] Bad config encountered during initialization:
[C 12:18:07.612 NotebookApp] The 'contents_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x10a35d750> instance must be a type, but u'jupyterdrive.mixednbmanager.MixedContentsManager' could not be imported
tobycheese commented 6 years ago

@gayathry2612: For what it's worth, I just encountered this error after an upgrade. To fix it, I removed my ~/.jupyter config directory, reinstalled all jupyter-related packages with

pip list|grep jupyter|cut -f 1 -d ' ' | xargs pip install -U --force-reinstall

and reenabled the one extension I had installed:

jupyter nbextensions_configurator enable --user (I also have Rise installed, but it does not need to be enabled)

You'll also have to reapply any customisations you've made to the config files, but I didn't have any.

ltrottier commented 5 years ago

Removing ~/.jupyter fixed it for me.

turkialjrees commented 5 years ago

This is might Help I SOLVED and wrote about it here

There is sometimes that the jupyter_notebook_config.py is missing To create a jupyter_notebook_config.py file, after installing the python , you can use the following command line: jupyter notebook --generate-config then run : jupyter notebook --config=/home/john/mystuff/jupyter_notebook_config.json

magg1ee commented 4 years ago

When I try to launch Jupiter Notebook from the command line or from Anaconda Navigator I get the following error:

[C 13:09:45.091 NotebookApp] Bad config encountered during initialization: [C 13:09:45.104 NotebookApp] The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x101ca3278> instance must be a type, but 'nb_conda_kernels.CondaKernelSpecManager' could not be imported

I can run Jupiter Notebook from other Python environments but not from root. I would really like to just be able to launch the notebook using the default version of Python on my machine. Currently this is 3.6.2.

Many thanks, Emily find this

c.NotebookApp.kernel_spec_manager_class = 'jupyter_client.kernelspec.KernelSpecManager'

and delete # then words

wzl1368611 commented 4 years ago

Removing ~/.jupyter fixed it for me.

the file is bad,it is a little problem,so easy,thanks!

harshith7823 commented 3 years ago

Removing ~/.jupyter did not fix the issue for me

PaulKGrimes commented 1 year ago

This can also occur if you have extensions installed in your global jupyter lab/notebook configuration, but not the underlying python packages installed in your Conda environment.

In my case, it was jupyter-fs messing things up, which saves a configuration .json in .jupyter, and tries to read it. But without the jupyter-fs Python package, it causes this error on start-up.

abraham4671 commented 1 year ago

I was learning and practicing anaconda on cloud and this happened

Bad config encountered during initialization: The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x7f238ef2e290> instance must be a type, but 'nb_conda_kernels.CondaKernelSpecManager' could not be imported

kiranzo commented 9 months ago

I am trying to run miniconda of virtual Ubuntu server and access Jupyter notebook remotely, and I'm also having this error.

What should my exact steps be to install and run Jupyter on miniconda?

UPD Worked for me after I recreated my working environment and did conda install jupyter

JPapir commented 2 months ago

As other people noted, deleting the ~/.jupyter folder can help. However, the config folder is not necessarily in the home. To find out the configuration currently used, you should run:

jupyter-lab --debug

It will return the list of possible config files, and tell you which file is loaded. In my case :

[D 2024-08-25 23:03:27.378 ServerApp] Loaded config file: /home/XXXX/miniforge3/etc/jupyter/jupyter_config.json

Then, simply delete the appropriate config file, according to the output, and you should be able to reset the config.