jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.49k stars 363 forks source link

Installation issue with npm dependencies #670

Open michalrudko opened 4 years ago

michalrudko commented 4 years ago

I've noticed that the latest npm version is 0.13.2, but pip is already 0.13.3 at this moment. I'd like to freeze the version in the setup so that I have control over updates. What's the relation between the pip and npm versions then? Should I stick to 0.13.2 in both cases? I am using JupyterLab 1.2.6 at the moment (planning to upgrade to 2.x soon). Thanks!

davidbrochart commented 4 years ago

The relation is: pip version >= npm version You should not care about the npm version, as it is automatically handled by pip install.

michalrudko commented 4 years ago

So how I should install this package step by step using Jupyter Lab? The instruction on the main page says it should be enough to execute: jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet How does it relate to pip install? Which command should go first? I was using pip install ipyleaflet already in the venv.

I've tried this on both Unix and Mac, but each time I am running into some npm conflicts:


jupyter-leaflet-0.13.2.tgz

Node v14.5.0

Yarn configuration loaded.
Building jupyterlab assets (build:prod:minimize)
> node /usr/local/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-interactive
yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
warning jupyter-leaflet > leaflet.vectorgrid > vector-tile@1.3.0: This module has moved: please install @mapbox/vector-tile instead
warning jupyter-leaflet > leaflet.vectorgrid > vector-tile > point-geometry@0.0.0: This module has moved: please install @mapbox/point-geometry instead
error Couldn't find package "@jupyter-widgets/base@^2 || ^3" required by "jupyter-leaflet@file:../extensions/jupyter-leaflet-0.13.2.tgz" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "@turf/area@^5.1.5" required by "leaflet-measure@^3.1.0" on the "npm" registry.
    at /usr/local/share/jupyter/lab/staging/yarn.js:38113:17
    at Generator.throw (<anonymous>)
    at step (/usr/local/share/jupyter/lab/staging/yarn.js:310:30)
    at /usr/local/share/jupyter/lab/staging/yarn.js:323:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Couldn't find package "@turf/length@^5.1.5" required by "leaflet-measure@^3.1.0" on the "npm" registry.
    at /usr/local/share/jupyter/lab/staging/yarn.js:38113:17
    at Generator.throw (<anonymous>)
    at step (/usr/local/share/jupyter/lab/staging/yarn.js:310:30)
    at /usr/local/share/jupyter/lab/staging/yarn.js:323:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Couldn't find package "@phosphor/widgets@^1.9.3" required by "jupyter-leaflet@file:../extensions/jupyter-leaflet-0.13.2.tgz" on the "npm" registry.
    at /usr/local/share/jupyter/lab/staging/yarn.js:38113:17
    at Generator.throw (<anonymous>)
    at step (/usr/local/share/jupyter/lab/staging/yarn.js:310:30)
    at /usr/local/share/jupyter/lab/staging/yarn.js:323:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Couldn't find package "@phosphor/messaging@^1.3.0" required by "jupyter-leaflet@file:../extensions/jupyter-leaflet-0.13.2.tgz" on the "npm" registry.
    at /usr/local/share/jupyter/lab/staging/yarn.js:38113:17
    at Generator.throw (<anonymous>)
    at step (/usr/local/share/jupyter/lab/staging/yarn.js:310:30)
    at /usr/local/share/jupyter/lab/staging/yarn.js:323:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

npm dependencies failed to install
Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 105, in start
    command=command, app_options=app_options)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 460, in build
    command=command, clean_staging=clean_staging)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 652, in build
    raise RuntimeError(msg)

RuntimeError: npm dependencies failed to install

Exiting application: jupyter
davidbrochart commented 4 years ago

For a Jupyter Lab installation, you should have pip, Node.js and npm installed, then:

$ pip install ipyleaflet
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet
michalrudko commented 4 years ago

After running pip install ipyleaflet the installation of the extension fails:

michalrudko@Michals-MacBook-Pro tmp % jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet
An error occured.
ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package
See the log file for details:  /var/folders/k5/jrbv_k495txdfg107_j48ryr0000gn/T/jupyterlab-debug-hi3sjx0n.log
michalrudko@Michals-MacBook-Pro tmp % node -v
v14.7.0
michalrudko@Michals-MacBook-Pro tmp % npm version
{
  npm: '6.14.7',
  ares: '1.16.0',
  brotli: '1.0.7',
  cldr: '37.0',
  icu: '67.1',
  llhttp: '2.0.4',
  modules: '83',
  napi: '6',
  nghttp2: '1.41.0',
  node: '14.7.0',
  openssl: '1.1.1g',
  tz: '2019c',
  unicode: '13.0',
  uv: '1.38.1',
  v8: '8.4.371.19-node.12',
  zlib: '1.2.11'
}
michalrudko@Michals-MacBook-Pro tmp % pip --version
pip 20.2.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
michalrudko@Michals-MacBook-Pro tmp % cat /var/folders/k5/jrbv_k495txdfg107_j48ryr0000gn/T/jupyterlab-debug-hi3sjx0n.log
Node v14.7.0

Yarn configuration loaded.
> /usr/local/bin/npm pack @jupyter-widgets/jupyterlab-manager
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@jupyter-widgets%2fjupyterlab-manager - Not found
npm ERR! 404 
npm ERR! 404  '@jupyter-widgets/jupyterlab-manager@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michalrudko/.npm/_logs/2020-08-06T09_46_34_156Z-debug.log

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 93, in start
    ans = self.run_task()

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in run_task
    for i, arg in enumerate(self.extra_args)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in <listcomp>
    for i, arg in enumerate(self.extra_args)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 388, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 603, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 1499, in _install_extension
    info = self._extract_package(extension, tempdir, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 1578, in _extract_package
    raise ValueError(msg % source)

ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package

Exiting application: jupyter

michalrudko@Michals-MacBook-Pro tmp % pip freeze | grep ipyleaflet
ipyleaflet==0.13.3
michalrudko@Michals-MacBook-Pro tmp % jupyter labextension list
JupyterLab v2.1.5
Known labextensions:
   app dir: /usr/local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/celltags v2.1.2  enabled  OK
        @jupyterlab/debugger v0.3.0-beta.1  enabled  OK
        @jupyterlab/git v0.20.0  enabled  OK
        @jupyterlab/google-drive v2.0.0  enabled  OK
        @jupyterlab/server-proxy v2.1.1  enabled  OK
        @jupyterlab/toc v4.0.0  enabled  OK
        jupyter-leaflet v0.13.2  enabled  OK
        nbdime-jupyterlab v2.0.0  enabled  OK

Build recommended, please run `jupyter lab build`:
    jupyter-leaflet needs to be included in build
davidbrochart commented 4 years ago

Could you please try again in a fresh environment? I also had some temporary issues with the JS package manager, but it seems to work fine now.

michalrudko commented 4 years ago

OK, thanks for the hint. Just please let me know what do you mean by "fresh environment". Should I uninstall all the extensions? At the moment I am getting an error related to npm dependencies when running jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet

Yarn configuration loaded.
Building jupyterlab assets (build:prod:minimize)
> node /usr/local/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-interactive
-yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
warning jupyter-leaflet > leaflet.vectorgrid > vector-tile@1.3.0: This module has moved: please install @mapbox/vector-tile instead
warning jupyter-leaflet > leaflet.vectorgrid > vector-tile > point-geometry@0.0.0: This module has moved: please install @mapbox/point-geometry instead
error Couldn't find package "@turf/area@^5.1.5" required by "leaflet-measure@^3.1.0" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "@turf/length@^5.1.5" required by "leaflet-measure@^3.1.0" on the "npm" registry.
    at /usr/local/share/jupyter/lab/staging/yarn.js:38113:17
    at Generator.throw (<anonymous>)
    at step (/usr/local/share/jupyter/lab/staging/yarn.js:310:30)
    at /usr/local/share/jupyter/lab/staging/yarn.js:323:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

npm dependencies failed to install
Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 105, in start
    command=command, app_options=app_options)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 460, in build
    command=command, clean_staging=clean_staging)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 652, in build
    raise RuntimeError(msg)

RuntimeError: npm dependencies failed to install

An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details:  /var/folders/k5/jrbv_k495txdfg107_j48ryr0000gn/T/jupyterlab-debug-1a1o75xw.log
Exiting application: jupyter
michalrudko@Michals-MacBook-Pro hive-metastore-docker % jupyter nbextension list
Known nbextensions:
  config dir: /usr/local/etc/jupyter/nbconfig
    notebook section
      jupyter-leaflet/extension  enabled 
      - Validating: OK
      nbdime/index  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
michalrudko@Michals-MacBook-Pro hive-metastore-docker % jupyter labextension list
JupyterLab v2.1.5
Known labextensions:
   app dir: /usr/local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/celltags v2.1.2  enabled  OK
        @jupyterlab/debugger v0.3.0-beta.1  enabled  OK
        @jupyterlab/git v0.20.0  enabled  OK
        @jupyterlab/google-drive v2.0.0  enabled  OK
        @jupyterlab/server-proxy v2.1.1  enabled  OK
        @jupyterlab/toc v4.0.0  enabled  OK
        jupyter-leaflet v0.13.2  enabled  OK
        nbdime-jupyterlab v2.0.0  enabled  OK

Build recommended, please run `jupyter lab build`:
    jupyter-leaflet needs to be included in build
michalrudko@Michals-MacBook-Pro hive-metastore-docker % jupyter serverextension list
config dir: /usr/local/etc/jupyter
    jupyterlab  enabled 
    - Validating...
      jupyterlab 2.1.5 OK
    jupyterlab_git  enabled 
    - Validating...
      jupyterlab_git 0.20.0 OK
    nbdime  enabled 
    - Validating...
      nbdime 2.0.0 OK
davidbrochart commented 4 years ago

Create a new environment, in my case I use conda:

$ conda create -n ipyleaflet-test
$ conda activate ipyleaflet-test
$ conda install pip jupyterlab nodejs
$ pip install ipyleaflet
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet

Of course you could directly install ipyleaflet through conda instead of pip.

michalrudko commented 4 years ago

OK, I did a similar thing just only using venv, but again... some issue with npm packages...

$ python3 -m venv ~/ipyleaflet-test
$ source ipyleaflet-test/bin/activate
$ pip install jupyterlab nodejs
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet  
An error occured.
ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package
See the log file for details:  /var/folders/k5/jrbv_k495txdfg107_j48ryr0000gn/T/jupyterlab-debug-y8fix3qa.log

(ipyleaflet-test) michalrudko@Michals-MacBook-Pro ~ % cat /var/folders/k5/jrbv_k495txdfg107_j48ryr0000gn/T/jupyterlab-debug-y8fix3qa.log
Node v14.7.0

Yarn configuration loaded.
> /usr/local/bin/npm pack @jupyter-widgets/jupyterlab-manager
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@jupyter-widgets%2fjupyterlab-manager - Not found
npm ERR! 404 
npm ERR! 404  '@jupyter-widgets/jupyterlab-manager@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michalrudko/.npm/_logs/2020-08-06T11_12_32_737Z-debug.log

Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 93, in start
    ans = self.run_task()

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in run_task
    for i, arg in enumerate(self.extra_args)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 149, in <listcomp>
    for i, arg in enumerate(self.extra_args)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 388, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 603, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 1499, in _install_extension
    info = self._extract_package(extension, tempdir, pin=pin)

  File "/usr/local/lib/python3.7/site-packages/jupyterlab/commands.py", line 1578, in _extract_package
    raise ValueError(msg % source)

ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package
davidbrochart commented 4 years ago

I looks like there are timeout issues with the npm server: https://www.npmjs.com/package/@jupyter-widgets/jupyterlab-manager ESOCKETTIMEDOUT id: f5c9cd0a-4ee7-4ea9-be3b-66137e65b2bb