这是我正在测试的代码
import pandas as pd
import ipyaggrid as Grid
cars = [{'carName': 'Chevelle'}]
df = pd.DataFrame(cars)
options = {'columnDefs': [{'headerName': 'Name', 'field': 'carName'}]}
g = Grid(grid_data=df, grid_options=options)
g
在单元格输出上出现以下错误: 显示小部件时出错
我在Chrome开发者控制台上收到此错误
Plugin 'ipywidget' failed to activate
Error: No provider for: jupyter.extensions.jupyterWidgetRegistry.
at JupyterLab.push.2R+v.Application.resolveRequieredService (index.js:182)
...
Starting application in workspace: /jupyter/user/uid/lab
Disabling terminals plugin because they are not available on the server
Starting Websocket: ...
Kernel: Connected ...
Could not instantiate widget
Error: Could not create model.
at promiseRejection (...)
Exception opening new comm
Module ipyaggrid, semver range ~0.2.1 is not registered as widget module
Uncaught (in promise) Module ipyaggrid, semver range ~0.2.1 is not registered as widget module
这是labextension list
的输出:
$ jupyter labextension list
JupyterLab v0.34.9
Known labextensions:
app dir: /app/conda/base/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v0.37.4 enabled OK
ipyaggrid v0.2.1 enabled OK
conda info
输出
active environment : base
active env location: /app/conda/base
shell level : 1
user config file : /home/user/.condarc
populated config files : /home/user/.condarc
conda version : 4.8.3
conda-build version : 3.15.1
python version : 3.7.3.final.0
virtual packages : __glibc=2.17
base environment : /app/conda/base (writable)
channel URLs : XXX
package cache : /app/conda/base/pkgs
/app/user/.conda/pkgs
envs directories : /app/conda/base/pkgs
/app/user/.conda/pkgs/envs
platform : linux-64
user-agent : conda/4.5.11 requests/2.24.0 CPython/3.7.3 Linux/3.10.0-10-generic rhel/7.8 glibc/2.17
UID:GID : 1000:1000
netrc file : None
offline mode : False