Jupyter Lab extension #jupyterlab/git installation issue - jupyter

Background
I want to install git extension for Jupyter Lab. As suggested here, I used the following commands:
pip install --upgrade jupyterlab-git
jupyter lab build
Following that the outcomes of the checking commands are as follows:
(base) neeraj#neeraj-personal:~$ jupyter serverextension list
config dir: /home/neeraj/.jupyter
jupyterlab_git enabled
- Validating...
jupyterlab_git 0.21.1 OK
config dir: /home/neeraj/Documents/0_anaconda3/etc/jupyter
jupyterlab enabled
- Validating...
jupyterlab 2.2.6 OK
jupyterlab_git enabled
- Validating...
jupyterlab_git 0.21.1 OK
nbdime enabled
- Validating...
nbdime 2.0.0 OK
and
(base) neeraj#neeraj-personal:~$ jupyter labextension list
JupyterLab v2.2.6
Known labextensions:
app dir: /home/neeraj/Documents/0_anaconda3/share/jupyter/lab
#jupyterlab/git v0.21.1 enabled OK
#jupyterlab/latex v2.0.1 enabled OK
#jupyterlab/toc v4.0.0 enabled OK
jupyterlab-recents v2.0.0 enabled OK
Problem
The Git panel is not visible. How to address this, or are there any other steps or dependencies that I am missing?
Other information
There are no error messages when starting Jupyter Lab. Following are the messages.
jupyter lab
[I 08:43:23.622 LabApp] JupyterLab extension loaded from /home/neeraj/Documents/0_anaconda3/lib/python3.7/site-packages/jupyterlab
[I 08:43:23.622 LabApp] JupyterLab application directory is /home/neeraj/Documents/0_anaconda3/share/jupyter/lab
[I 08:43:23.837 LabApp] Serving notebooks from local directory: /home/neeraj
[I 08:43:23.838 LabApp] Jupyter Notebook 6.1.1 is running at:
[I 08:43:23.838 LabApp] http://localhost:8888/?token=b2f0f43a667bf02d5dd6909b54142c31264d676921cea5f6
[I 08:43:23.838 LabApp] or http://127.0.0.1:8888/?token=b2f0f43a667bf02d5dd6909b54142c31264d676921cea5f6
[I 08:43:23.838 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:43:23.938 LabApp]
To access the notebook, open this file in a browser:
file:///home/neeraj/.local/share/jupyter/runtime/nbserver-5762-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=b2f0f43a667bf02d5dd6909b54142c31264d676921cea5f6
or http://127.0.0.1:8888/?token=b2f0f43a667bf02d5dd6909b54142c31264d676921cea5f6
[I 08:43:33.879 LabApp] Build is up to date
[I 08:44:51.796 LabApp] Kernel started: 63592d97-9dfd-4c9b-a5dc-adaec553f7b9, name: python3

Related

Why Does the VS Code Jupyter Extension Keep Timing-out Trying to Find a Kernel That Exists?

I need to set up virtual environments for each language that I use. To do this, I'm running the Ubuntu 20.04 LTS Windows Subsystem for Linux (WSL) on Windows 10. Within WSL, I'm using Anaconda, installed in /usr/local/Anaconda, to create conda virtual environments for each language (i.e. one environment contains all my Python stuff, another contains my R stuff, etc.).
Since WSL doesn't come with a GUI, I'm using Visual Studio Code's (VSCode) Jupyter Notebook Extension to run Jupyter Notebooks to see plots/graphics. So far, I managed to easily create conda environments for Python (with ipython and ipykernel) and R (with IRkernel) and run their code in a notebook via the extension. Each time I set up an environment, the extension is easily able to find the kernel, connect to it and run the code.
However, I've not been able to set up an environment for Julia. I followed the documentation on the Julia website for installing the kernel, which is successfully found by the extension. But, when I try running a cell, the extension says it is trying to connect to the kernel, only for it to timeout and fail.
Here are the steps I have taken so far:
Create a clean conda environment (conda create -n Julia && conda activate Julia)
Install the latest version of Julia (conda install -c conda-forge julia)
Install the latest version of Jupyter (conda install -c conda-forge jupyter)
Install the Julia kernel with the built-in Julia package manager (using Pkg; Pkg.add("IJulia"))
Build the IJulia package (using Pkg; Pkg.build("IJulia"))
Confirm the presence of the Julia kernel (jupyter kernelspec list) which indeed shows the presence of a Julia kernel
Reload the VSCode connection to WSL (Ctrl + Shift + P; >Reload Window)
Shut down WSL via CMD (wsl --shutdown) for changes to take effect and reconnect
After I restart VSCode and WSL, the extension shows an option to use the Julia kernel installed in my conda environment: Julia 1.7.2 (~/.conda/envs/Julia/bin/julia). But when I create a cell and run code in a notebook, the extension creates a popup saying that it is connecting to the kernel and after some time an error message shows up:
Failed to start the Kernel.
Unable to start Kernel `Julia 1.7.2` due to connection timeout.
View Jupyter log for further details
I can also see the kernel spec JSON file in ~/.local/share/jupyter/kernels/julia-1.7/kernel.json
{
"display_name": "Julia 1.7.2",
"argv": [
"/home/USER/.conda/envs/Julia/bin/julia",
"-i",
"--color=yes",
"--project=#.",
"/home/USER/.conda/envs/Julia/share/julia/packages/IJulia/AQu2H/src/kernel.jl",
"{connection_file}"
],
"language": "julia",
"env": {},
"interrupt_mode": "signal"
}
The log file starts showing problems here:
info 17:50:48.378: Process Execution: cwd: ~
cwd: ~
warn 17:50:48.893: StdErr from Kernel Process [91m[1mERROR: [22m[39m
warn 17:50:49.138: StdErr from Kernel Process LoadError:
warn 17:50:49.795: StdErr from Kernel Process ArgumentError: Package IJulia not found in current path:
- Run `import Pkg; Pkg.add("IJulia")` to install the IJulia package.
The extension says it cannot find the IJulia kernel. This perplexes me because I can see the kernel spec in my home directory, the jupyter binary I installed from conda says that its there and the Jupyter Notebook extension can see the kernel. I have no explanation as to why the extension can see the kernel, match up the kernelspec but not be able to connect to it. Help would greatly be appreciated!

kernel failed to start using conda environment with Jupyter in Visual Studio Code

When using a Jupyter notebook file in Visual Studio code with the Jupyter extension I receive the error The kernel failed to start due to the missing module 'ipykernel_launcher'. Consider installing this module. View Jupyter [log](command:jupyter.viewOutput) for further details.
This notebook works correctly from the JupyterLab web application when I select the same conda environment that was selected in Visual Studio Code.
pip list shows that ipykernel version 5.3.4 is installed, but I don't know how to install ipykernel_launcher. I tried reinstalling pyzmq and it didn't help.
Any ideas why this isn't working?
Had the same problem. My solution is --
First uninstall all jupyter related modules:
python3 -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat jupyterlab-widgets nbclient ipykernel ipynb
(from: https://stackoverflow.com/a/52912244/1516331)
And then reinstall ipykernel. I'm using VScode so when I run a cell, VSCode asked me to installipykernel. The following should work the same alternatively:
conda install -c conda-forge --update-deps --force-reinstall ipykernel -y

Jupyter Labs: "RuntimeError: npm dependencies failed to install" When Building

I'm new to using Anaconda and recently installed jupyter labs on my computer. However, any time I try to build on my local Jupyter Labs instance I get the following error:
Code run in jupyter labs terminal:
PS C:\Users\briakeit> jupyter lab build
Output:
[LabBuildApp] JupyterLab 1.2.5
[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details: C:\Users\briakeit\AppData\Local\Temp\jupyterlab-debug-0b5ejkfm.log
Log file:
[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v13.7.0
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/#jupyterlab/application-extension/-/application-extension-1.2.1.tgz: read ECONNRESET".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\briakeit\\AnacondaFiles\\share\\jupyter\\lab\\staging\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[LabBuildApp] npm dependencies failed to install
[LabBuildApp] Traceback (most recent call last):
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
yield
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\labapp.py", line 98, in start
command=command, app_options=app_options)
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 459, in build
command=command, clean_staging=clean_staging)
[LabBuildApp] File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 660, in build
raise RuntimeError(msg)
[LabBuildApp] RuntimeError: npm dependencies failed to install
[LabBuildApp] Exiting application: JupyterLab
This happens anytime I try using this command (e.g. after installing anew extension). I have npm v6.4.1, nodejs v10.13.0, and yarn v1.22.0 installed in this environment according to conda. I'm running Jupyter lab 1.2.6.
Any feedback, suggestions or help would be greatly appreciated.
I believe I have found the problem. I consult for a company and I was using the computer they provided me (I'm an admin on the computer). When I followed the same steps on my personal computer, it worked with no issues.
I then switched over to a different, more open network at work and the build was able to complete without errors. Clearly there is something in the firewall or something that was preventing me from doing the build.
Not sure if you've fixed it, if not you may try the solutions below.
info There appears to be trouble with your network connection. Retrying...
This is a yarn related error that seems to suggest something wrong with your network. This can happen if the yarn was trying to connect via a proxy. You can try the following if this is the case.
npm config rm proxy
npm config rm https-proxy
It can also happen if your network is too slow. You can try increasing Yarn timeout.
yarn add <yourPackage> --network-timeout 100000
Source: https://github.com/yarnpkg/yarn/issues/4890
As indicated above this might be due to the fact that your company forces you to download everything over the proxy. Yarn (which is used to install npm) does not know your proxy details by default, so you need to create a .yarnrc file in your home directory (usually C:\Users\Username where you need to fill in your own username in windows, or simply ~/ on ubuntu).
In that file you need to specify your proxy settings as follows:
https-proxy "http://username:password#proxy.address.com:port"
strict-ssl false
Note no = sign in there and quotes around the address.
Then you'll be able to download the packages through your proxy.
I had the same issue. I have tried different versions of nodejs with different environments but couldn't solve the issue. I have checked the log files and found out that there was a problem with yarn cache so clearing the yarn cache solved my problem.
From the logs you can see:
info There appears to be trouble with your network connection.
Retrying...
I had the same issue, and disabling the firewall temporarily helped me to sort out part of the the issue, but then I finally got it with:
jupyter lab build --dev-build=False --minimize=False
I had a similar issue associated with Norton notification blocking jupyter.exe and some other programs while running 'jupyter lab build'. I resolved this issue by 'Turn off or turn on Data Protector' in Norton or disabling Auto-protect and smart-firewall each time running 'jupyter lab build'.
I faced similar issues and here are the solutions that works for me:
Installed latest version of nodejs and npm.
Manually installed latest version of yarn (download its msi installer instead of via cmd--> npm install --global yarn)
remove npm proxy via cmd:
npm config rm proxy
npm config rm https-proxy
Restarting the laptop
jupyter lab build --dev-build=False --minimize=False
Voila, it works flawlessly.

NBExtension does not validate in Jupyter Notebook

I am running Jupyter 4.1.0 on a Mac which I downloaded with Anaconda.
I have tried downloading front-end extensions to Jupyter Notebook but cannot get the packages to validate. For example after I downloaded calico-document-tools with:
jupyter nbextension install https://github.com/Calysto/notebook-extensions/archive/master.zip
When I try to validate it, I get the following.
$ jupyter nbextension enable calico-document-tools
Unrecognized JSON config file version, assuming version 1
Enabling notebook extension calico-document-tools...
- Validating: problems found:
- require? X calico-document-tools
What does this error message mean?

How to add "share notebook as gist" button to Jupyter notebook server?

I upgraded from Ipython Notebook Server to Jupyter Server using anaconda:
(ioos)usgs#gam:~/.jupyter/custom$ conda list jupyter
jupyter 1.0.0 py27_0 defaults
jupyter-client 4.1.1 <pip>
jupyter-console 4.0.3 <pip>
jupyter-core 4.0.6 <pip>
jupyter_client 4.1.1 py27_0 defaults
jupyter_console 4.0.3 py27_0 defaults
jupyter_core 4.0.6 py27_0 defaults
and my "Share Notebook as Gist" button went away.
I imagine that the configuration of extensions changed with the new version.
I can see ~/.local/share/jupyter/nbextensions
with gist.js and a directory called mathjax in it.
Does anyone know how to properly configure the "Share Notebook as Gist" button with this Jupyter version?
You still need to activate the nbextension. The custom.js now lives now in:
$(jupyter --config-dir)/custom
I also have the file:
$HOME/.jupyter/nbconfig/notebook.json
with,
{
"load_extensions": {
"livereveal/main": true,
"gist/gist": true
}
}
that I do remember if I or if jupyter migrate created.
PS: make sure to download the latest gist.js.
I've fixed it using these steps:
Download gist.js:
$ wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/gist.js
Install the extension as a user:
$ jupyter nbextension install --user gist.js
Note: the command accepts the file name (with .js)
To enable it, put into $(jupyter --config-dir)/nbconfig/notebook.json:
{
"load_extensions": {
"gist": true
}
}
Though the instructions here suggest that python snippets should be used instead.
To install, simply run:
pip install jupyter-notebook-gist
jupyter serverextension enable --py jupyter_notebook_gist
jupyter nbextension install --py jupyter_notebook_gist
jupyter nbextension enable --py jupyter_notebook_gist
jupyter nbextension enable --py widgetsnbextension
you also need to configure jupyter. for details visit here