Brian Keith
Brian Keith

Reputation: 255

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.

Upvotes: 11

Views: 19144

Answers (7)

pizofreude
pizofreude

Reputation: 11

I faced similar issues and here are the solutions that works for me:

  1. Installed latest version of nodejs and npm.

  2. Manually installed latest version of yarn (download its msi installer instead of via cmd--> npm install --global yarn)

  3. remove npm proxy via cmd:

    npm config rm proxy

    npm config rm https-proxy

  4. Restarting the laptop

  5. jupyter lab build --dev-build=False --minimize=False

  6. Voila, it works flawlessly.

Upvotes: 1

Trung Nguyen
Trung Nguyen

Reputation: 117

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

Upvotes: 0

nferreira78
nferreira78

Reputation: 1174

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

Upvotes: 0

Atahan Özer
Atahan Özer

Reputation: 66

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.

Upvotes: 0

Thomas
Thomas

Reputation: 1871

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:[email protected]: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.

Upvotes: 2

Brian Keith
Brian Keith

Reputation: 255

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.

Upvotes: 4

AzyCrw4282
AzyCrw4282

Reputation: 7744

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

Upvotes: 2

Related Questions