Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
john
@jcoady

I tried to uninstall it with the command

pip uninstall -v jupyterlab3_apod

and it says it was successfully uninstalled but when I try the command

jupyter labextension list

it indicates that the extension is still installed in jupyterlab

jupyter labextension list
JupyterLab v3.0.14
C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\labextensions
jupyterlab3_apod v0.1.0 enabled ok (python, jupyterlab3_apod)

and when I run jupyterlab I see that the extension is still installed.

Here is the output from the uninstall command

pip uninstall -v jupyterlab3_apod
Found existing installation: jupyterlab3-apod 0.1.0
Uninstalling jupyterlab3-apod-0.1.0:
Would remove:
c:\users\john\anaconda3\envs\jupyterlab3-ext\lib\site-packages\jupyterlab3-apod.egg-link
Will actually move:
c:\users\john\anaconda3\envs\jupyterlab3-ext\lib\site-packages\jupyterlab3-apod.egg-link
Proceed (y/n)? y
Created temporary directory: C:\Users\John\AppData\Local\Temp\pip-uninstall-thsqzq_e
Removing file or directory c:\users\john\anaconda3\envs\jupyterlab3-ext\lib\site-packages\jupyterlab3-apod.egg-link
Removing pth entries from c:\users\john\anaconda3\envs\jupyterlab3-ext\lib\site-packages\easy-install.pth:
Removing entry: c:\users\john\jupyterlab3_apod
Successfully uninstalled jupyterlab3-apod-0.1.0

Jeremy Tuloup
@jtpio
@jcoady there was a recent change to the cookiecutter today around packaging, which might be related
which might require updating the docs
maybe trying with the previous version might help in the meantime:
cookiecutter https://github.com/jupyterlab/extension-cookiecutter-ts --checkout a161a92deee694d42f52a9769ff76bacc969175f
the checkout option points to the previous commit of the cookiecutter

python setup.py bdist_wheel

also that step is useful only if you want to publish your extension so others can install it

if it's just to try something locally then you can skip that step
john
@jcoady

@ianhi thanks for the suggestion. I did pip install build and tried

python -m build -s .

which worked and created the python source package (.tar.gz) in the dist/ directory but the command python setup.py sdist

1 reply

also worked for me. However when I tried the command

python -m build -w .

it fails with the error message that is similar to what

python setup.py bdist_wheel

gave me. The error message was

error: could not create 'build\bdist.win-amd64\wheel\jupyterlab3_apod-0.1.0.data\data\share\jupyter\labextensions\jupyterlab3_apod\static\vendors-node_modules_css-loader_dist_runtime_api_js-node_modules_css-loader_dist_runtime_cssW-926fd9.168ff8ed2964b36aacaf.js': No such file or directory
Traceback (most recent call last):
File "C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\Users\John\AppData\Local\Temp\build-env-3rm7dyty\Scripts\python.exe', 'C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\site-packages\pep517\in_process\_in_process.py', 'build_wheel', 'C:\Users\John\AppData\Local\Temp\tmpyozy7dkw']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\site-packages\build__init__.py", line 309, in _call_backend
raise BuildBackendException(exception)
build.BuildBackendException: Backend operation failed: CalledProcessError(1, ['C:\Users\John\AppData\Local\Temp\build-env-3rm7dyty\Scripts\python.exe', 'C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\site-packages\pep517\in_process\_in_process.py', 'build_wheel', 'C:\Users\John\AppData\Local\Temp\tmpyozy7dkw'])

←[91mERROR←[0m Backend operation failed: CalledProcessError(1, ['C:\Users\John\AppData\Local\Temp\build-env-3rm7dyty\Scripts\python.exe', 'C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\site-packages\pep517\in_process\_in_process.py', 'build_wheel', 'C:\Users\John\AppData\Local\Temp\tmpyozy7dkw'])

john
@jcoady

Hi @jtpio , I tried your previous cookiecutter and it worked for me. With this version of the cookiecutter the command

python setup.py bdist_wheel

worked for me and created a (.whl) file in the dist/ directory. Thanks

john
@jcoady
After looking into this issue further regarding packaging of my extension for jupyterlab 3 following the instructions in the extension tutorial, I found that the combination of commands

python setup.py sdist
python setup.py bdist_wheel

didn't work for me on my Windows computer to create the wheel file but the commands

python -m build -s .
python setup.py bdist_wheel

did work for me to create the wheel file. So I found that I needed to replace

python setup.py sdist

with

python -m build -s .

in order to get it to work.

john
@jcoady

The Extension Tutorial says that

Distributing an extension as an npm package allows users to compile the extension into JupyterLab explicitly (similar to how was done in JupyterLab versions 1 and 2), which leads to a more optimal JupyterLab package.

john
@jcoady

After I published my extension to npm I tried installing it using

jupyter labextension install jupyterlab3_apod2

but it failed to install. Is installing an extension from npm into jupyterlab3 supposed to work right now?

john
@jcoady

I used got the following error when I tried to install an Extension into Jupyterlab3 from npm

jupyter labextension install jupyterlab3_apod4@0.1.1
Building jupyterlab assets (production, minimized)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details: C:\Users\John\AppData\Local\Temp\jupyterlab-debug-0cyfey7r.log

and the debug file contained the following

node C:\Users\John\anaconda3\envs\jupyterlab3-ext\lib\site-packages\jupyterlab\staging\yarn.js run build:prod:minimize
yarn run v1.21.1
$ webpack --config webpack.prod.minimize.config.js
[webpack-cli] ModuleNotFoundError: Module not found: Error: Can't resolve 'jupyterlab3_apod4/style/index.js' in 'C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\build'
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\Compilation.js:1672:28
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:712:13
at eval (eval at create (C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:10:1)
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:273:22
at eval (eval at create (C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:402:22
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:117:11
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:628:24
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:782:8
at C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\webpack\lib\NormalModuleFactory.js:902:5
resolve 'jupyterlab3_apod4/style/index.js' in 'C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\build'
Parsed request is a module
using description file: C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\build\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\build\node_modules doesn't exist or is not a directory
looking for modules in C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules
existing directory C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4
using description file: C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4\package.json (relative path: .)
using description file: C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4\package.json (relative path: ./style/index.js)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4\style\index.js doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4\style\index.js.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
C:\Users\John\anaconda3\envs\jupyterlab3-ext\share\jupyter\lab\staging\node_modules\jupyterlab3_apod4\style\index.js.json doesn't exist
.wasm
Field 'browser' doesn't contain a vali

Cameron Toy
@cameron-toy

I'm having issues building after jlpm adding some @jupyter-widgets packages. I'm getting errors in the @jupyter-widgets node modules as well as my own code. Errors usually look like one of the two below. There seems to be some problems with inconsistent types between packages.

src/widgets/index.ts:23:14 - error TS2322: Type 'Token<IDashboardTracker>' is not assignable to type 'Token<any>'.
Types have separate declarations of a private property '_tokenStructuralPropertyT'.

23 optional: [IDashboardTracker, IJupyterWidgetRegistry],

OR

node_modules/@jupyter-widgets/jupyterlab-manager/lib/renderer.d.ts:8:22 - error TS2420: Class 'WidgetRenderer' incorrectly implements interface 'IRenderer'.
Types of property 'title' are incompatible.
Type 'import("/Users/camerontoy/Jupyter/jl3/jupyterlab-interactive-dashboard-editor/node_modules/@lumino/widgets/types/title").Titleimport("/Users/camerontoy/Jupyter/jl3/jupyterlab-interactive-dashboard-editor/node_modules/@lumino/widgets/types/widget").Widget' is not assignable to type 'import("/Users/camerontoy/Jupyter/jl3/jupyterlab-interactive-dashboard-editor/node_modules/@jupyterlab/apputils/node_modules/@lumino/widgets/types/title").Title<import("/Users/camerontoy/Jupyter/jl3/jupyterlab-interactive-dashboard-editor/node_modules/@jupyterlab/apputils/node_modules/@lumino/widgets/types/widget")....'.

Has anyone seen something like this before?
Angus Hollands
@agoose77:matrix.org
[m]
cameron-toy (Cameron Toy) ngl I'm not yet confident enough in debugging node errors to do anything before nuking the node modules and starting again :p have you tried that first?
Cameron Toy
@cameron-toy
@agoose77:matrix.org I deleted my node_modules and yarn.lock, set bundled = false and singleton = true in my package.json for @jupyter-widgets/base and @jupyter-widgets/jupyterlab-manager as described here and got rid of all the errors in my own code, although I'm still getting errors in the @jupyter-widgets node modules.
Nicholas Bollweg
@bollwyvl
OT: if you've ever gotten some tricky open source scientific software to work on windows with msys2 and/or conda, you likely have our friend ray donnelley to thank for it. he's in hospice with late-stage cancer, and we're rattling the tin cup trying to support them https://www.gofundme.com/f/help-Ray-fund-a-hospice-bedroom
john
@jcoady

I have a JupyterLab Extension that works perfectly fine with JupyterLab 1 and JupyterLab 2 and I am trying to get it to work with JupyterLab 3 . My Extension contains some font and image files in a data directory and I am able to load these files in my JupyterLab Extension using JupyterLab 1 and 2 but I am not able to load them with JupyterLab 3. The javascript code in my extension specifies a relative path to load the font and image files and the relative path is

var datadir = './static/lab/vpython_data/'

Has the relative path to data files in a JupyterLab Extension changed in JupyterLab 3 ?

For the loading of the font file I am getting the following error in the javascript console using JupyterLab 3 but it works fine in JupyterLab 1 and 2.

glowcommlab.js:92 Uncaught Error: Font ./static/lab/vpython_data/Roboto-Medium.ttf could not be loaded: Error: Unsupported OpenType signature <!do
at glowcommlab.js:92
at eval (eval at module.exports (addScript.js:20), <anonymous>:1:115117)
at XMLHttpRequest.request.onload (eval at module.exports (addScript.js:20), <anonymous>:1:109580)

john
@jcoady

I will add that I am importing the file in javascript with file-loader from Webpack. The js code looks like this.

// Ensure downstream JupyterLab webpack places the fonts and images in predictable locations
import '!!file-loader?name=/vpython_data/[name].[ext]!../vpython_data/metal_texture.jpg'
import '!!file-loader?name=/vpython_data/[name].[ext]!../vpython_data/NimbusRomNo9L-Med.otf'
import '!!file-loader?name=/vpython_data/[name].[ext]!../vpython_data/Roboto-Medium.ttf'

and I expect to find the file in the relative path

var datadir = './static/lab/vpython_data/'

Is there something in JupyterLab 3 that is preventing this. Maybe something with Webpack configuration with regards to file-loader. I think JupyterLab 3 is using Webpack 5 and there is some documentation that file-loader is deprecated.

https://webpack.js.org/loaders/file-loader/

Does anyone know of a fix for my problem of loading the Font files and image files in JupyterLab 3.

4 replies
yuvipanda
@Yuvi:matrix.org
[m]
is there an example of a jupyterlab dialog that's just react inside?
Eric Charles
@echarles
@Yuvi:matrix.org are you willing to show a react component and from there open a react modal dialog, or are you willing to embed a react component into a JLab dialog lumino widget? In both case, you will need import { ReactWidget } from '@jupyterlab/apputils’;- I guess you know https://github.com/jupyterlab/extension-examples/tree/master/react-widget
yuvipanda
@Yuvi:matrix.org
[m]
yeah, that's where I've endd up! I have a Lumnio button on the notebook toolbar (which I guess I can change into a React button), and that eventually opens a lumino dialog (I'd love for this to be a Chakra UI dialog, but too many deps)
and then inside that the dialogbody is now a ReactWidget that hosts my react element
so that works out ok i think
Eric Charles
@echarles
to update the button in the toolbar, you would need to also create a separated Widget class that would extend ReactWidget -> this would work, no issue
yuvipanda
@Yuvi:matrix.org
[m]
yeah
Eric Charles
@echarles
then you have to trigger the openDialog action when the user clicks on the button (so you need to implement that in the ‘onClick’ even handler)
If you prefer it to be a Chakra dialog, you just have to call it in the onClick handler, instead of calling the jupyterlab dialog
yuvipanda
@Yuvi:matrix.org
[m]
yeah. but Chakra is a pretty big dependency
Eric Charles
@echarles
I often ship material-ui as additional artifact and I don’t see a change in terms of performance (page loding speed)
yuvipanda
@Yuvi:matrix.org
[m]
@echarles: do you know why I can't use hooks inside the render method of a ReactWidget, but can if I just extract out that code to its own function?
@echarles: ooooh, I see.
my main app is in chakra, maybe I can just reuse all that code
Eric Charles
@echarles
treeshaking should help for the bundle size
yuvipanda
@Yuvi:matrix.org
[m]
yeah, but chakra has tree shaking issues still tho
Eric Charles
@echarles
mmh reactwidget is oldschool react
no hooks
yuvipanda
@Yuvi:matrix.org
[m]
right
i barely know react, and definitely don't know lumio, and this mix probably will only land me in trouble :D
but i don't know at all how to construct DOM elements without it in Lumino, and I don't wanna make them by hand
Eric Charles
@echarles
yep, I hear you… I am working on a library to allow reusing lumino into react to ease migration and reuse. Will announce something soon. Not sure if it would help you. Being in between 2 techs is not comfortable
yuvipanda
@Yuvi:matrix.org
[m]
trying to install a few jupyterlab extensions
running into 'AttributeError: 'Version' object has no attribute 'major''
/srv/conda/envs/notebook/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
Traceback (most recent call last):
  File "/srv/conda/envs/notebook/bin/jupyter-labextension", line 5, in <module>
    from jupyterlab.labextensions import main
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyterlab/__init__.py", line 7, in <module>
    from .labapp import LabApp
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyterlab/labapp.py", line 15, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyterlab_server/__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyterlab_server/app.py", line 7, in <module>
    from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyter_server/__init__.py", line 15, in <module>
    from ._version import version_info, __version__
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyter_server/_version.py", line 9, in <module>
    version_info = get_version_info(__version__)
  File "/srv/conda/envs/notebook/lib/python3.8/site-packages/jupyter_packaging/setupbase.py", line 248, in get_version_info
    version_info = [parsed.major, parsed.minor, parsed.micro]
AttributeError: 'Version' object has no attribute 'major'
Removing intermediate container d4a404eceeb0
yuvipanda
@Yuvi:matrix.org
[m]
@echarles: I'm really grateful for your comments on the JupyterHub admin panel PR :)
1 reply