NERSC / jupyterlab-slurm

BSD 3-Clause "New" or "Revised" License
92 stars 23 forks source link

Installation error: KeyError: '@jupyterlab/apputils' #27

Closed andreas-h closed 4 years ago

andreas-h commented 4 years ago

When I try to install (JupyterLab 1.1.1, JupyterHub 1.0), I get the following:

$ jupyter labextension install jupyterlab-slurm
An error occured.
KeyError: '@jupyterlab/apputils'
See the log file for details:  /tmp/jupyterlab-debug-up57412b.log

The log file looks like this:

$ cat /tmp/jupyterlab-debug-up57412b.log
Node v11.14.0

> /home/conda/envs/jupyter_2019/bin/npm pack jupyterlab-slurm
npm notice 
npm notice �  jupyterlab-slurm@0.1.3
npm notice === Tarball Contents === 
npm notice 1.8kB  package.json                
npm notice 1.5kB  LICENSE                     
npm notice 1.7kB  README.md                   
npm notice 495B   lib/index.d.ts              
npm notice 24.1kB lib/index.js                
npm notice 250B   lib/slurm-config/config.json
npm notice 7.6kB  style/index.css             
npm notice 1.1kB  style/nersc_icon_small.png  
npm notice 39.4kB style/nersc_icon.png        
npm notice === Tarball Details === 
npm notice name:          jupyterlab-slurm                        
npm notice version:       0.1.3                                   
npm notice filename:      jupyterlab-slurm-0.1.3.tgz              
npm notice package size:  52.9 kB                                 
npm notice unpacked size: 78.0 kB                                 
npm notice shasum:        595662bad0cc97c71f2c50d56be7f1fec910e0ad
npm notice integrity:     sha512-KUp9Q2k+QbVfN[...]p8HNCBbtzqcnQ==
npm notice total files:   9                                       
npm notice 
jupyterlab-slurm-0.1.3.tgz

Fetching URL: https://registry.npmjs.org/jupyterlab-slurm
Fetching URL: https://registry.npmjs.org/jupyterlab-slurm
Traceback (most recent call last):

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

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

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 147, in run_task
    for i, arg in enumerate(self.extra_args)

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 147, in <listcomp>
    for i, arg in enumerate(self.extra_args)

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/commands.py", line 321, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/commands.py", line 525, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/commands.py", line 1446, in _install_extension
    self._format_no_compatible_package_version(name),

  File "/home/conda/envs/jupyter_2019/lib/python3.7/site-packages/jupyterlab/commands.py", line 1619, in _format_no_compatible_package_version
    c = _compare_ranges(core_deps[key], value)

KeyError: '@jupyterlab/apputils'

Exiting application: jupyter

I'd greatly appreciate any help in sorting this out.

krinsman commented 4 years ago

Are you installing this from source or from the PyPI+NPM repositories? The published packages are outdated, so for now if you want to use this with JupyterLab 1.0+, you will need to install it from source. (See e.g. the discussion here.)

Run in the terminal:

git clone https://github.com/NERSC/jupyterlab-slurm.git
cd jupyterlab-slurm
pip install .
jupyter serverextension enable --sys-prefix jupyterlab_slurm
jlpm install
jlpm run build
jupyter labextension install

@andreas-h Let me know if that helped so we can know whether to close this issue or not.

andreas-h commented 4 years ago

Thanks, @krinsman. The pip part seems to work fine, but in jlpm I'm getting warnings and an error:

$ jlpm install
yarn install v1.15.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@jupyterlab/application > @jupyterlab/ui-components@1.1.0" has unmet peer dependency "react@~16.8.4".
warning "@jupyterlab/application > @jupyterlab/ui-components > @blueprintjs/core@3.18.0" has unmet peer dependency "react-dom@^15.3.0 || 16".
warning "@jupyterlab/application > @jupyterlab/ui-components > @blueprintjs/core > react-transition-group@2.9.0" has unmet peer dependency "react-dom@>=15.0.0".
warning "@jupyterlab/application > @jupyterlab/ui-components > @blueprintjs/select@3.10.0" has unmet peer dependency "react-dom@^15.3.0 || 16".
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.17.3", while you're on "1.15.2".
Done in 32.05s.

$ jlpm run build
yarn run v1.15.2
$ tsc
node_modules/@jupyterlab/ui-components/lib/icon/iconregistry.d.ts:1:8 - error TS1192: Module '"/home/jupyter/src/jupyterlab-slurm/node_modules/@types/react/index"' has no default export
.

1 import React from 'react';
         ~~~~~

node_modules/@jupyterlab/ui-components/lib/icon/interfaces.d.ts:3:8 - error TS1192: Module '"/home/jupyter/src/jupyterlab-slurm/node_modules/@types/react/index"' has no default export.

3 import React from 'react';
         ~~~~~

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm in a conda environment.

andreas-h commented 4 years ago

Okay, I managed to make the installation work. I had to add

    "allowSyntheticDefaultImports": true

to tsconfig.json in the compilerOptions section.

wl2776 commented 4 years ago

I've got corrupted jupyterlab after installation.

image

Restarting server and kernels did not help.

I've resolved this issue with reinstallation of jupyterlab (conda install --force-reinstall jupyterlab). However, jupyterlab-slurm extension has disappeared after this.

krinsman commented 4 years ago

@andreas-h That seems like a good fix for the problem. Based on the error I'm not sure whether that is a problem on our side, JupyterLab's side, or React's side. @tslaton Do you know how to diagnose this? Should we use a more specific import statement from the JupyterLab modules?

Anyway I will upload that bug fix now.

I think using npm sometimes leads to things working out better than using Yarn (which is what jlpm) but I don't really know and am actually somewhat grasping at straws here.

EDIT: OK allowSyntheticDefaultImports is now true in the master branch of JupyterLab Slurm. Thank you @andreas-h for catching this and letting us know what the fix is!

krinsman commented 4 years ago

@wl2776 This is obviously not good. Are you using the newest version of JupyterLab (or at least the JupyterLab package from Conda Forge)?

I am not sure right now what the fix is but it is obviously a breaking issue, thank you for bring it to our attention @wl2776!

Maybe can you post the output of conda list so we can compare environments? What operating system are you running on? (See here for formatting collapsible things)

conda list ``` # Name Version Build Channel appnope 0.1.0 py37_1000 conda-forge attrs 19.1.0 py_0 conda-forge backcall 0.1.0 py_0 conda-forge bleach 3.1.0 py_0 conda-forge bzip2 1.0.8 h01d97ff_1 conda-forge ca-certificates 2019.6.16 hecc5488_0 conda-forge certifi 2019.6.16 py37_1 conda-forge decorator 4.4.0 py_0 conda-forge defusedxml 0.5.0 py_1 conda-forge elasticsearch 7.0.2 pypi_0 pypi entrypoints 0.3 py37_1000 conda-forge invoke 1.2.0 py37_1000 conda-forge ipykernel 5.1.2 py37h5ca1d4c_0 conda-forge ipython 7.8.0 py37h5ca1d4c_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jedi 0.15.1 py37_0 conda-forge jinja2 2.10.1 py_0 conda-forge json5 0.8.5 py_0 conda-forge jsonschema 3.0.2 py37_0 conda-forge jupyter_client 5.3.1 py_0 conda-forge jupyter_core 4.4.0 py_0 conda-forge jupyterlab 1.1.3 py_0 conda-forge jupyterlab_server 1.0.6 py_0 conda-forge libcxx 8.0.1 0 conda-forge libcxxabi 8.0.1 0 conda-forge libffi 3.2.1 h6de7cb9_1006 conda-forge libsodium 1.0.17 h01d97ff_0 conda-forge markdown 3.1.1 pypi_0 pypi markupsafe 1.1.1 py37h1de35cc_0 conda-forge mistune 0.8.4 py37h1de35cc_1000 conda-forge nbconvert 5.6.0 py37_1 conda-forge nbformat 4.4.0 py_1 conda-forge nbresuse 0.3.1 pypi_0 pypi ncurses 6.1 h0a44026_1002 conda-forge newrelic 4.20.1.121 pypi_0 pypi nodejs 11.14.0 h6de7cb9_1 conda-forge notebook 6.0.1 py37_0 conda-forge openssl 1.1.1c h01d97ff_0 conda-forge pandoc 2.7.3 0 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.5.1 py_0 conda-forge pexpect 4.7.0 py37_0 conda-forge pickleshare 0.7.5 py37_1000 conda-forge pip 19.2.3 py37_0 conda-forge prometheus_client 0.7.1 py_0 conda-forge prompt_toolkit 2.0.9 py_0 conda-forge psutil 5.6.2 py37h01d97ff_0 conda-forge ptyprocess 0.6.0 py_1001 conda-forge pycurl 7.43.0.3 pypi_0 pypi pygments 2.4.2 py_0 conda-forge pylibmc 1.6.0 pypi_0 pypi pyrsistent 0.15.4 py37h01d97ff_0 conda-forge python 3.7.3 h93065d6_1 conda-forge python-dateutil 2.8.0 py_0 conda-forge pyzmq 18.0.2 py37hee98d25_2 conda-forge readline 8.0 hcfe32e1_0 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 41.2.0 py37_0 conda-forge six 1.12.0 py37_1000 conda-forge sqlite 3.29.0 hb7d70f7_1 conda-forge statsd 3.3.0 pypi_0 pypi terminado 0.8.2 py37_0 conda-forge testpath 0.4.2 py_1001 conda-forge tk 8.6.9 h2573ce8_1002 conda-forge tornado 5.1.1 pypi_0 pypi traitlets 4.3.2 py37_1000 conda-forge urllib3 1.25.3 pypi_0 pypi wcwidth 0.1.7 py_1 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.33.6 py37_0 conda-forge xz 5.2.4 h1de35cc_1001 conda-forge zeromq 4.3.2 h6de7cb9_2 conda-forge zlib 1.2.11 h01d97ff_1006 conda-forge ```

@tslaton This looks exactly like the error we say with JupyterLab-cpustatus, right? Are we sure this is a bug we can fix on our side, or do you think we should open an issue with JupyterLab?

It seems suspicious that the same error would happen independently in two different extensions written in two very different ways if there was no problem with breaking changes to JupyterLab extension API.

I'm not able to reproduce the error on this machine with JupyterLab Slurm, but I got the same error with JupyterLab-cpustatus on Friday on a different machine. I'm not sure what to do about this.

krinsman commented 4 years ago

@wl2776 I made this a separate issue, see: https://github.com/NERSC/jupyterlab-slurm/issues/32

krinsman commented 4 years ago

@andreas-h I'll close this for now, since you said the fix you proposed worked for you, it seemed to work for me too, and the fix has now been pushed to master. Please request that it be reopened if it hasn't actually been fixed yet.