jupyter-lab does not load jupyter_nbextensions_configurator (but jupyter-notebook does) - jupyter-notebook

Having failed to resolve this after a day and a half of solid effort, I feel I am losing my mind: I have checked config files, rebuilt environments half-a-dozen times, enabled everything possibly relevant, consulted numerous S.O. posts, & github issues and I still can't get it to work.
I want to use certain non-core notebook extensions - and be able to debug using xeus-python (in an environment set up for TensorFlow with CUDA - this part at least has always been OK)
I have tried numerous combinations of python versions, notebook, conda/pip for installation of jupyter etc. but jupyter-lab will not load jupyter_nbextensions_configurator.
However! I discovered by accident that jupyter-notebook does load it (see line 4) - and suddenly I have something to hang a question on. When I run jupyter-notebook, the output begins...
(TF250_PY3810_xeus) A:\My Documents\IT\Programming\Python\Perceptilabs\Batch Files & Shortcuts>jupyter-notebook
[I 10:54:00.733 NotebookApp] Writing notebook server cookie secret to C:\Users\Julian\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[W 10:54:00.992 NotebookApp] All authentication is disabled. Anyone who can connect to this server will be able to run code.
[I 10:54:01.017 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.1
[W 2021-07-01 10:54:01.703 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-07-01 10:54:01.704 LabApp] 'password_required' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-07-01 10:54:01.704 LabApp] 'token' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2021-07-01 10:54:01.712 LabApp] JupyterLab extension loaded from C:\Users\Julian\anaconda3\envs\TF250_PY3810_xeus\lib\site-packages\jupyterlab
[I 2021-07-01 10:54:01.712 LabApp] JupyterLab application directory is C:\Users\Julian\anaconda3\envs\TF250_PY3810_xeus\share\jupyter\lab
[I 10:54:01.717 NotebookApp] Serving notebooks from local directory: A:/My Documents
[I 10:54:01.718 NotebookApp] Jupyter Notebook 6.1.1 is running at:
[I 10:54:01.718 NotebookApp] http://localhost:8888/
[I 10:54:01.718 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
(Unfortunately, the debugger seems unavailable in jupyter notebook and ipyfilechooser seemed not to work - note that ipyfilechooser does work in the same environment under jupyter lab!)
Question!
Given this, why isn't jupyter_nbextensions_configurator loaded by jupyter-lab and how do I fix it?
I used a specific notebook version in the end but have no idea whether this is in fact important, since the discovery action was not performed before... but I do wonder whether a specific jupyter version might also be required.
(Side issue/bonus question: why are lab & notebook behaviours different in other ways too e.g. debugger, ipyfilechooser?)
Addtional Info
System: Win 10, 64-bit
I also tried explicitly using
jupyter nbextensions_configurator enable --user/--system/--sys-prefix
even if I used the conda installation that should have taken care of this. Obviously to no avail.
The environment in which is created by (silent, no prompts) batch file as follows (most non-functional content stripped out for posting):
set envName=TF250_PY3810_xeus
echo Conda stuff - create and activate environment %envName%, add xeus-python and cuda support
call conda create -y --name %envName% python==3.8.10
call C:\Users\Julian\anaconda3\Scripts\activate.bat %envName%
call conda install -y -c conda-forge xeus-python
call conda install -y -c conda-forge cudatoolkit=11.2.2
call conda install -y -c conda-forge cudnn=8.1.0.77
echo Conda stuff - install jupyterlab, notebook (versioned!), extensions stuff
call conda install -y -c conda-forge jupyterlab notebook==6.1.1
call conda install -y -c conda-forge jupyter_nbextensions_configurator
call conda install -y -c conda-forge jupyter_contrib_nbextensions
#REM pip installations. NB tensorflow_decision_forests is linux only 30/06/2021 so can't install yet
echo Pip stuff - install TensorFlow, seaborn, etc.
pip install -q --upgrade pip setuptools
pip install -q --no-input tensorflow-gpu==2.5.0 tensorflow-probability tensorflow-addons
pip install -q --no-input seaborn tabulate pandoc
pip install -q ipyfilechooser tqdm
#REM Alternative jupyter PIP setup.
#REM pip install -q jupyterlab jupyter_nbextensions_configurator jupyter_contrib_nbextensions
#REM jupyter contrib nbextension install --user
#REM jupyter nbextensions_configurator enable --user
#REM jupyter lab

Related

Adding jupyter_nbextensions_configurator to Jupyter Notebook

Ultimately, I want a Notebook extension that has spell check. Following this tutorial I tried to install the jupyter_nbextensions_configurator
However, it doesn't seem to have been enabled as I never see the "Nbextensions" tab as promised.
Steps I took:
Installed pip package
pip install jupyter_nbextensions_configurator
Enabled the server extension with the command:
➜ jupyter nbextensions_configurator enable --user # can be skipped for notebook >=5.3
Enabling: jupyter_nbextensions_configurator
- Writing config: /home/hofbr/.jupyter
- Validating...
jupyter_nbextensions_configurator 0.6.1 OK
Enabling notebook nbextension nbextensions_configurator/config_menu/main...
Enabling tree nbextension nbextensions_configurator/tree_tab/main...
Refreshed my .zshrc
Yet, when opening up a fresh notebook (after shutting down all other jupyter environments) I still never see this fabled Nbextensions tab.

Jupiter not using conda env [duplicate]

I installed Anaconda (with Python 2.7), and installed Tensorflow in an environment called tensorflow. I can import Tensorflow successfully in that environment.
The problem is that Jupyter Notebook does not recognize the new environment I just created. No matter I start Jupyter Notebook from the GUI Navigator or from the command line within the tensorflow env, there is only one kernel in the menu called Python [Root], and Tensorflow cannot be imported. Of course, I clicked on that option multiple times, saved file, re-opened, but these did not help.
Strangely, I can see the two environments when I open the Conda tab on the front page of Jupyter. But when I open the Files tab, and try to new a notebook, I still end up with only one kernel.
I looked at this question:
Link Conda environment with Jupyter Notebook
But there isn't such a directory as ~/Library/Jupyter/kernels on my computer! This Jupyter directory only has one sub-directory called runtime.
I am really confused. Are Conda environments supposed to become kernels automatically? (I followed https://ipython.readthedocs.io/en/stable/install/kernel_install.html to manually set up the kernels, but was told that ipykernel was not found.)
I don't think the other answers are working any more, as conda stopped automatically setting environments up as jupyter kernels. You need to manually add kernels for each environment in the following way:
source activate myenv
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
As documented here:http://ipython.readthedocs.io/en/stable/install/kernel_install.html#kernels-for-different-environments
Also see this issue.
Addendum:
You should be able to install the nb_conda_kernels package with conda install nb_conda_kernels to add all environments automatically, see https://github.com/Anaconda-Platform/nb_conda_kernels
If your environments are not showing up, make sure you have installed
nb_conda_kernels in the environment with Jupyter
ipykernel and ipywidgets in the Python environment you want to access (note that ipywidgets is to enable some Juptyer functionality, not environment visibility, see related docs).
Anaconda's documentation states that
nb_conda_kernels should be installed in the environment from which
you run Jupyter Notebook or JupyterLab. This might be your base conda
environment, but it need not be. For instance, if the environment
notebook_env contains the notebook package, then you would run
conda install -n notebook_env nb_conda_kernels
Any other environments you wish to access in your notebooks must have
an appropriate kernel package installed. For instance, to access a
Python environment, it must have the ipykernel package; e.g.
conda install -n python_env ipykernel
To utilize an R environment, it must have the r-irkernel package; e.g.
conda install -n r_env r-irkernel
For other languages, their corresponding kernels must be installed.
In addition to Python, by installing the appropriatel *kernel package, Jupyter can access kernels from a ton of other languages including R, Julia, Scala/Spark, JavaScript, bash, Octave, and even MATLAB.
Note that at the time originally posting this, there was a possible cause from nb_conda not yet supporting Python 3.6 environments.
If other solutions fail to get Jupyter to recognize other conda environments, you can always install and run jupyter from within a specific environment. You may not be able to see or switch to other environments from within Jupyter though.
$ conda create -n py36_test -y python=3.6 jupyter
$ source activate py36_test
(py36_test) $ which jupyter
/home/schowell/anaconda3/envs/py36_test/bin/jupyter
(py36_test) $ jupyter notebook
Notice that I am running Python 3.6.1 in this notebook:
Note that if you do this with many environments, the added storage space from installing Jupyter into every environment may be undesirable (depending on your system).
The annoying thing is that in your tensorflow environment, you can run jupyter notebook without installing jupyter in that environment. Just run
(tensorflow) $ conda install jupyter
and the tensorflow environment should now be visible in Jupyter Notebooks started in any of your conda environments as something like Python [conda env:tensorflow].
I had to run all the commands mentioned in the top 3 answers to get this working:
conda install jupyter
conda install nb_conda
conda install ipykernel
python -m ipykernel install --user --name mykernel
Just run conda install ipykernel in your new environment, only then you will get a kernel with this env. This works even if you have different versions installed in each envs and it doesn't install jupyter notebook again. You can start youe notebook from any env you will be able to see newly added kernels.
Summary (tldr)
If you want the 'python3' kernel to always run the Python installation from the environment where it is launched, delete the User 'python3' kernel, which is taking precedence over whatever the current environment is with:
jupyter kernelspec remove python3
Full Solution
I am going to post an alternative and simpler solution for the following case:
You have created a conda environment
This environment has jupyter installed (which also installs ipykernel)
When you run the command jupyter notebook and create a new notebook by clicking 'python3' in the 'New' dropdown menu, that notebook executes python from the base environment and not from the current environment.
You would like it so that launching a new notebook with 'python3' within any environment executes the Python version from that environment and NOT the base
I am going to use the name 'test_env' for the environment for the rest of the solution. Also, note that 'python3' is the name of the kernel.
The currently top-voted answer does work, but there is an alternative. It says to do the following:
python -m ipykernel install --user --name test_env --display-name "Python (test_env)"
This will give you the option of using the test_env environment regardless of what environment you launch jupyter notebook from. But, launching a notebook with 'python3' will still use the Python installation from the base environment.
What likely is happening is that there is a user python3 kernel that exists. Run the command jupyter kernelspec list to list all of your environments. For instance, if you have a mac you will be returned the following (my user name is Ted).
python3 /Users/Ted/Library/Jupyter/kernels/python3
What Jupyter is doing here is searching through three different paths looking for kernels. It goes from User, to Env, to System. See this document for more details on the paths it searches for each operating system.
The two kernels above are both in the User path, meaning they will be available regardless of the environment that you launch a jupyter notebook from. This also means that if there is another 'python3' kernel at the environment level, then you will never be able to access it.
To me, it makes more sense that choosing the 'python3' kernel from the environment you launched the notebook from should execute Python from that environment.
You can check to see if you have another 'python3' environment by looking in the Env search path for your OS (see the link to the docs above). For me (on my mac), I issued the following command:
ls /Users/Ted/anaconda3/envs/test_env/share/jupyter/kernels
And I indeed had a 'python3' kernel listed there.
Thanks to this GitHub issue comment (look at the first response), you can remove the User 'python3' environment with the following command:
jupyter kernelspec remove python3
Now when you run jupyter kernelspec list, assuming the test_env is still active, you will get the following:
python3 /Users/Ted/anaconda3/envs/test_env/share/jupyter/kernels/python3
Notice that this path is located within the test_env directory. If you create a new environment, install jupyter, activate it, and list the kernels, you will get another 'python3' kernel located in its environment path.
The User 'python3' kernel was taking precedence over any of the Env 'python3' kernels. By removing it, the active environment 'python3' kernel was exposed and able to be chosen every time. This eliminates the need to manually create kernels. It also makes more sense in terms of software development where one would want to isolate themselves into a single environment. Running a kernel that is different from the host environment doesn't seem natural.
It also seems that this User 'python3' is not installed for everyone by default, so not everyone is confronted by this issue.
To add a conda environment to Jupyter:
In Anaconda Prompt :
run conda activate <env name>
run conda install -c anaconda ipykernel
run python -m ipykernel install --user --name=<env name>
** tested on conda 4.8.3 4.11.0
$ conda install nb_conda_kernels
(in the conda environment where you run jupyter notebook) will make all conda envs available automatically. For access to other environments, the respective kernels must be installed. Here's the ref.
This worked for me in windows 10 and latest solution :
1) Go inside that conda environment ( activate your_env_name )
2) conda install -n your_env_name ipykernel
3) python -m ipykernel install --user --name build_central --display-name "your_env_name"
(NOTE : Include the quotes around "your_env_name", in step 3)
The nb_conda_kernels package is the best way to use jupyter with conda. With minimal dependencies and configuration, it allows you to use other conda environments from a jupyter notebook running in a different environment. Quoting its documentation:
Installation
This package is designed to be managed solely using conda. It should be installed in the environment from which you run Jupyter Notebook or JupyterLab. This might be your base conda environment, but it need not be. For instance, if the environment notebook_env contains the notebook package, then you would run
conda install -n notebook_env nb_conda_kernels
Any other environments you wish to access in your notebooks must have an appropriate kernel package installed. For instance, to access a Python environment, it must have the ipykernel package; e.g.
conda install -n python_env ipykernel
To utilize an R environment, it
must have the r-irkernel package; e.g.
conda install -n r_env r-irkernel
For other languages, their corresponding kernels must be installed.
Then all you need to do is start the jupyter notebook server:
conda activate notebook_env # only needed if you are not using the base environment for the server
# conda install jupyter # in case you have not installed it already
jupyter
Despite the plethora of answers and #merv's efforts to improve them, it still hard to find a good one. I made this one CW, so please vote it to the top or improve it!
This is an old thread, but running this in Anaconda prompt, in my environment of interest, worked for me:
ipython kernel install --name "myenvname" --user
We have struggle a lot with this issue, and here's what works for us. If you use the conda-forge channel, it's important to make sure you are using updated packages from conda-forge, even in your Miniconda root environment.
So install Miniconda, and then do:
conda config --add channels conda-forge --force
conda update --all -y
conda install nb_conda_kernels -y
conda env create -f custom_env.yml -q --force
jupyter notebook
and your custom environment will show up in Jupyter as an available kernel, as long as ipykernel was listed for installation in your custom_env.yml file, like this example:
name: bqplot
channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- bqplot
- ipykernel
Just to prove it working with a bunch of custom environments, here's a screen grab from Windows:
I ran into this same problem where my new conda environment, myenv, couldn't be selected as a kernel or a new notebook. And running jupter notebook from within the env gave the same result.
My solution, and what I learned about how Jupyter notebooks recognizes conda-envs and kernels:
Installing jupyter and ipython to myenv with conda:
conda install -n myenv ipython jupyter
After that, running jupter notebook outside any env listed myenv as a kernel along with my previous environments.
Python [conda env:old]
Python [conda env:myenv]
Running the notebook once I activated the environment:
source activate myenv
jupyter notebook
hides all my other environment-kernels and only shows my language kernels:
python 2
python 3
R
This has been so frustrating, My problem was that within a newly constructed conda python36 environment, jupyter refused to load “seaborn” - even though seaborn was installed within that environment. It seemed to be able to import plenty of other files from the same environment — for example numpy and pandas but just not seaborn. I tried many of the fixes suggested here and on other threads without success. Until I realised that Jupyter was not running kernel python from within that environment but running the system python as kernel. Even though a decent looking kernel and kernel.json were already present in the environment. It was only after reading this part of the ipython documentation:
https://ipython.readthedocs.io/en/latest/install/kernel_install.html#kernels-for-different-environments
and using these commands:
source activate other-env
python -m ipykernel install --user --name other-env --display-name "Python (other-env)"
I was able to get everything going nicely. (I didn’t actually use the —user variable).
One thing I have not yet figured is how to set the default python to be the "Python (other-env)" one. At present an existing .ipynb file opened from the Home screen will use the system python. I have to use the Kernel menu “Change kernel” to select the environment python.
I had similar issue and I found a solution that is working for Mac, Windows and Linux. It takes few key ingredients that are in the answer above:
To be able to see conda env in Jupyter notebook, you need:
the following package in you base env:
conda install nb_conda
the following package in each env you create:
conda install ipykernel
check the configurationn of jupyter_notebook_config.py
first check if you have a jupyter_notebook_config.py in one of the location given by jupyter --paths
if it doesn't exist, create it by running jupyter notebook --generate-config
add or be sure you have the following: c.NotebookApp.kernel_spec_manager_class='nb_conda_kernels.manager.CondaKernelSpecManager'
The env you can see in your terminal:
On Jupyter Lab you can see the same env as above both the Notebook and Console:
And you can choose your env when have a notebook open:
The safe way is to create a specific env from which you will run your example of envjupyter lab command. Activate your env. Then add jupyter lab extension example jupyter lab extension. Then you can run jupyter lab
While #coolscitist's answer worked for me, there is also a way that does not clutter your kernel environment with the complete jupyter package+deps.
It is described in the ipython docs and is (I suspect) only necessary if you run the notebook server in a non-base environment.
conda activate name_of_your_kernel_env
conda install ipykernel
python -m ipykernel install --prefix=/home/your_username/.conda/envs/name_of_your_jupyter_server_env --name 'name_of_your_kernel_env'
You can check if it works using
conda activate name_of_your_jupyter_server_env
jupyter kernelspec list
First you need to activate your environment .
pip install ipykernel
Next you can add your virtual environment to Jupyter by typing:
python -m ipykernel install --name = my_env
Follow the instructions in the iPython documentation for adding different conda environments to the list of kernels to choose from in Jupyter Notebook. In summary, after installing ipykernel, you must activate each conda environment one by one in a terminal and run the command python -m ipykernel install --user --name myenv --display-name "Python (myenv)", where myenv is the environment (kernel) you want to add.
Possible Channel-Specific Issue
I had this issue (again) and it turned out I installed from the conda-forge channel; removing it and reinstalling from anaconda channel instead fixed it for me.
Update: I again had the same problem with a new env, this time I did install nb_conda_kernels from anaconda channel, but my jupyter_client was from the conda-forge channel. Uninstalling nb_conda_kernels and reinstalling updated that to a higher-priority channel.
So make sure you've installed from the correct channels :)
I encountered this problem when using vscode server.
In the conda environment named "base", I installed the 1.2.0 version of opennmt-py, but I want to run jupyter notebook in the conda environment "opennmt2", which contains code using opennmt-py 2.0.
I solved the problem by reinstalling jupyter in conda(opennmt2).
conda install jupyter
After reinstalling, executing jupyter notebook in the opennmt2 environment will execute the newly installed jupyter
where jupyter
/root/miniconda3/envs/opennmt2/bin/jupyter
/root/miniconda3/bin/jupyter
For conda 4.5.12, what works for me is (my virtual env is called nwt)
conda create --name nwt python=3
after that I need to activate the virtual environment and install the ipykernel
activate nwt
pip install ipykernel
then what works for me is:
python -m ipykernel install --user --name env_name --display-name "name of your choosing."
As an example, I am using 'nwt' as the display name for the virtual env. And after running the commands above. Run 'jupyter notebook" in Anaconda Prompt again. What I get is:
Using only environment variables:
python -m ipykernel install --user --name $(basename $VIRTUAL_ENV)
I just wanted to add to the previous answers: in case installing nb_conda_kernels, ipywidgets and ipekernel dosen't work, make sure your version of Jupyter is up to date. My envs suddenly stopped showing up after a period of everything working fine, and it resumed working after I simply updated jupyter through the anaconda navigator.
In my case, using Windows 10 and conda 4.6.11, by running the commands
conda install nb_conda
conda install -c conda-forge nb_conda_kernels
from the terminal while having the environment active didn't do the job after I opened Jupyter from the same command line using conda jupyter notebook.
The solution was apparently to opened Jupyter from the Anaconda Navigator by going to my environment in Environments: Open Anaconda Navigator, select the environment in Environments, press on the "play" button on the chosen environment, and select 'open with Jupyter Notebook'.
Environments in Anaconda Navigator to run Jupyter from the selected environment

Remote Jupyter Notebook/ Jupyter Lab cannot connect to Kernel without ssh tunnelling

I am getting a problem in opening remote Jupyter Lab/ Jupyter Notebook, it is not connecting to the kernel, I've mentioned the setup steps, problem coming and attempted fixed below. Any solutions, suggestions, or directions are greatly welcomed. Thanks in advance.
Setup Steps Followed:
I am using a fresh Anaconda 3 install in Ubuntu 20.04 LTS. I set up the Jupyter Notebook/ Jupyter Lab to be accessed remotely using the method provided in this answer (IP of that computer is 172.17.25.75), I've quoted the steps below:
Step 1. jupyter notebook --generate-config
Step 2. gedit /home/koushik/.jupyter/jupyter_notebook_config.py and edit the values c.NotebookApp.allow_origin = '*' and
c.NotebookApp.ip = '0.0.0.0
Step 3. Allow port sudo ufw allow 8888
Step 4. Set Password jupyter notebook password
Step 5. Start Jupyter Lab using jupyter lab --no-browser or Start Jupyter Notebook using jupyter notebook --no-browser
And access the Jupyter Lab/ Jupyter Notebook from my computer using
http://172.17.25.75:8888 in the browser.
I am behind my Institue proxy server. When I connect to Jupyter Lab or Jupyter Notebook using ssh tunneling ssh -N -f -L localhost:8889:localhost:8888 zuddler#172.17.25.75 and access localhost:8889 everything works fine. But when I am not tunneling and accessing them using IP, the following errors occur.
Problem with Jupyter Lab:
Upon running the command jupyter lab --no-browser below is the terminal output:
(base) zuddler#silplab:~$ jupyter lab --no-browser
[I 11:42:09.625 LabApp] JupyterLab extension loaded from /home/zuddler/anaconda3/lib/python3.8/site-packages/jupyterlab
[I 11:42:09.625 LabApp] JupyterLab application directory is /home/zuddler/anaconda3/share/jupyter/lab
[I 11:42:09.627 LabApp] Serving notebooks from local directory: /home/zuddler
[I 11:42:09.627 LabApp] Jupyter Notebook 6.1.4 is running at:
[I 11:42:09.627 LabApp] http://silplab:8888/
[I 11:42:09.627 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 11:42:15.449 LabApp] Build is up to date
Upon opening http://172.17.25.75:8888 in the browser and starting a python 3 notebook, it asked to select a kernel
screenshot 1
upon selecting the kernel Python 3, it says
**Error Starting Kernel**
Invalid Response: 405 Method Not Allowed
screenshot 2
but a kernel was started and the terminal showed the below line
[I 11:46:47.547 LabApp] Kernel started: 572fa891-918c-486c-997a-96dd19651968, name: python3
which is also evident from the below screenshot
screenshot 3
upon selecting the marked kernel, it gives the same error mentioned in screenshot 2.
Upon executing jupyter kernelspec list, one kernel detail was returned
(base) zuddler#silplab:~$ jupyter kernelspec list
Available kernels:
python3 /home/zuddler/anaconda3/share/jupyter/kernels/python3
Problem with Jupyter Notebook:
Upon running the command jupyter notebook --no-browser below is the terminal output:
(base) zuddler#silplab:~$ jupyter notebook --no-browser
[I 11:55:20.472 NotebookApp] JupyterLab extension loaded from /home/zuddler/anaconda3/lib/python3.8/site-packages/jupyterlab
[I 11:55:20.472 NotebookApp] JupyterLab application directory is /home/zuddler/anaconda3/share/jupyter/lab
[I 11:55:20.474 NotebookApp] Serving notebooks from local directory: /home/zuddler
[I 11:55:20.474 NotebookApp] Jupyter Notebook 6.1.4 is running at:
[I 11:55:20.474 NotebookApp] http://silplab:8888/
[I 11:55:20.474 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Upon opening http://172.17.25.75:8888 in the browser and starting the previously created python 3 notebook, it gave the error Kernel not found asked to select a kernel
screenshot 4
on clicking Set Kernel, it gave a connection failed error as below
screenshot 5
but again a kernel was started and the terminal showed the below line (similar to Jupyter Lab)
[I 11:55:42.447 NotebookApp] Kernel started: d6af7843-cf02-43ce-adc2-14a7659ee4ff, name: python3
Again, upon executing jupyter kernelspec list, one kernel detail was returned
(base) zuddler#silplab:~$ jupyter kernelspec list
Available kernels:
python3 /home/zuddler/anaconda3/share/jupyter/kernels/python3
Attempted Fixed
Try 1. Tried updating jupyter using conda update jupyter, it returned
(base) zuddler#silplab:~$ conda update jupyter
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
So, I tried to check if I have the lastest versions of conda and jupyter and it returned:
(base) zuddler#silplab:~$ jupyter --version
jupyter core : 4.6.3
jupyter-notebook : 6.1.4
qtconsole : 4.7.7
ipython : 7.19.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 2.2.6
nbconvert : 6.0.7
ipywidgets : 7.5.1
nbformat : 5.0.8
traitlets : 5.0.5
(base) zuddler#silplab:~$ conda --version
conda 4.9.2
To check if there is some path issue, I checked using which as mentioned here and it returned
(base) zuddler#silplab:~$ which jupyter-notebook
/home/zuddler/anaconda3/bin/jupyter-notebook
(base) zuddler#silplab:~$ which jupyter-lab
/home/zuddler/anaconda3/bin/jupyter-lab
(base) zuddler#silplab:~$ which python
/home/zuddler/anaconda3/bin/python
so, the paths were correct.
I also set c.NotebookApp.allow_remote_access = True in .jupyter/jupyter_notebook_config.py file (as mentioned here), but it did not fix the issue.
Try 2. To be sure that the kernel had the correct python path, I checked the kernel.json file, the path to python 3 was correct
(base) zuddler#silplab:~$ cat /home/zuddler/anaconda3/share/jupyter/kernels/python3/kernel.json
{
"argv": [
"/home/zuddler/anaconda3/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
I further tried to rename the kernel folder as mentioned in this jupyter-notebook doc
A path ending in ipykernel/resources, like in the example above, is this default kernel. The default often does what you want, so if the python3 kernelspec points somewhere else and you can’t start a Python kernel, try deleting or renaming that kernelspec folder to expose the default.
the executed commands and outputs are below, it revealed the default kernel:
(base) zuddler#silplab:~$ cd /home/zuddler/anaconda3/share/jupyter/kernels/
(base) zuddler#silplab:~/anaconda3/share/jupyter/kernels$ ls
python3
(base) zuddler#silplab:~/anaconda3/share/jupyter/kernels$ mv python3 python3_bak
(base) zuddler#silplab:~/anaconda3/share/jupyter/kernels$ cd ~
(base) zuddler#silplab:~$ jupyter kernelspec list
Available kernels:
python3 /home/zuddler/anaconda3/lib/python3.8/site-packages/ipykernel/resources
python3_bak /home/zuddler/anaconda3/share/jupyter/kernels/python3_bak
but I am getting the same errors.
Try 3. I also tried to follow the suggestions referenced in this question, but to no benefit.

C++14 no visible after installing xeus-cling in Jupyter (Ubuntu 18.04 - Anaconda)

I followed the installation of the xeus-cling (created an env, activated,installed xeus-cling there) and when I want to select the C++14 kernel in a jupyter notebook it only appears Python3. What am I doing wrong?
I had the same problem. Its because jupyter-notebook is not installed in your environment. The jupyter server which is starting is the global one hence you don't see the c++14 option. The solution is:
Create a new directory and git clone the repository.
Run the conda env create -f environmental.yml command in cmd.
Run the conda activate xeus-cling command.
Run the jupyter notebook command.
You should now be able to see the c++14 and c++17 options. Step 2 created the xeus-cling environment and installs all the correct package versions including the correct jupyter notebook version.
Install notebook in your environment.
conda install xeus-cling notebook -c QuantStack -c conda-forge
You need register new kernels in jupyter:
jupyter kernelspec install PREFIX/share/jupyter/xcpp11 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp14 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp17 --sys-prefix

`jupyter notebook` gives error: `"Could not open static file ''"` on macOS

I haven't changed my system configuration, But I'm spotting this error for the first time today.
I've reported it here: https://github.com/jupyter/notebook/issues/4871
> jupyter notebook
[I 10:44:20.102 NotebookApp] JupyterLab extension loaded from /usr/local/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 10:44:20.102 NotebookApp] JupyterLab application directory is /usr/local/anaconda3/share/jupyter/lab
[I 10:44:20.104 NotebookApp] Serving notebooks from local directory: /Users/pi
[I 10:44:20.104 NotebookApp] The Jupyter Notebook is running at:
[I 10:44:20.104 NotebookApp] http://localhost:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[I 10:44:20.104 NotebookApp] or http://127.0.0.1:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[I 10:44:20.104 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:44:20.110 NotebookApp]
To access the notebook, open this file in a browser:
file:///Users/pi/Library/Jupyter/runtime/nbserver-65385-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
or http://127.0.0.1:8888/?token=586797fb9049c0faea24f2583c4de32c08d45c89051fb07d
[E 10:44:21.457 NotebookApp] Could not open static file ''
[W 10:44:21.512 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 9.02ms referer=http://localhost:8888/tree?token=BLA
[W 10:44:21.548 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 0.99ms referer=http://localhost:8888/tree?token=BLA
Set
Looks like this issue was fixed in Jupyter 6.0.1
So the question becomes: can I force-install jupyter 6.0.1?
As the initial question has now provoked a second question, I now ask this new question here: How to force `conda` to install the latest version of `jupyter`?
Alternatively I can manually provide the missing file, but I'm not sure where. I've asked here: Where does Jupyter install site-packages on macOS?
Research:
https://github.com/jupyter/notebook/pull/4772 "add missing react-dom js to package data #4772" on 6 Aug 2019
minrk added this to the 6.0.1 milestone on 18 Jul
Ok, so can I get Jupyter Notebook 6.0.1?
brew cask install anaconda downloads ~/Library/Caches/Homebrew/downloads/{LONG HEX}--Anaconda3-2019.07-MacOSX-x86_64 which is July, and conda --version reports conda 4.7.10. But this is for Anaconda which is the Package Manager.
> conda list | grep jupy
jupyter 1.0.0 py37_7
jupyter_client 5.3.1 py_0
jupyter_console 6.0.0 py37_0
jupyter_core 4.5.0 py_0
jupyterlab 1.0.2 py37hf63ae98_0
jupyterlab_server 1.0.0 py_0
So that's a bit confusing. No jupyter notebook here.
> which jupyter
/usr/local/anaconda3/bin/jupyter
> jupyter --version
jupyter core : 4.5.0
jupyter-notebook : 6.0.0
qtconsole : 4.5.1
ipython : 7.6.1
ipykernel : 5.1.1
jupyter client : 5.3.1
jupyter lab : 1.0.2
nbconvert : 5.5.0
ipywidgets : 7.5.0
nbformat : 4.4.0
traitlets : 4.3.2
Ok, so it appears jupyter-notebook is in jupyter which is maintained by Anaconda.
Can we update this?
https://jupyter.readthedocs.io/en/latest/projects/upgrade-notebook.html
> conda update jupyter
:
Alas jupyter --version is still 6.0.0
I fixed this by updating both jupyter on pip and pip3 (just to be safe) and this fixed the problem
using both
pip install --upgrade jupyter
and
pip3 install --upgrade jupyter --no-cache-dir
I believe you can do this in the terminal as well as in conda's terminal (since conda envs also have pip)
As per Where does Jupyter install site-packages on macOS?, I locate where on my system jupyter is searching for this missing file:
> find / -path '*/static/components' 2>/dev/null
/usr/local/anaconda3/pkgs/notebook-6.0.0-py37_0/lib/python3.7/site-packages/notebook/static/components
/usr/local/anaconda3/lib/python3.7/site-packages/notebook/static/components
And as per https://github.com/jupyter/notebook/pull/4772#issuecomment-515794823, if I download that file and deposit it in the second location, i.e. creating:
/usr/local/anaconda3/lib/python3.7/site-packages/notebook/static/components/react/react-dom.production.min.js
... now jupyter notebook launches without errors.
(NOTE: Being cautious I have also copied it into the first location. But that doesn't seem to have any effect.)

Resources