【问题标题】:Gmaps Not working with Jupyter Labs - Error: No provider for: jupyter.extensions.jupyterWidgetRegistryGmaps 不适用于 Jupyter Labs - 错误:没有提供程序:jupyter.extensions.jupyterWidgetRegistry
【发布时间】:2019-07-07 01:02:48
【问题描述】:

Gmaps 可与 Jupyter notebook 配合使用,但设置几乎相同,而与 jupyter lab 配合使用则无法正常工作。我已安装、完成构建并拥有所有基本扩展,如屏幕截图所示。我在类似问题上看到了另一个线程,但它没有解决我的问题,我已将有关扩展和其他 conda env 的所有信息放在下面。

(regtest) ➜  ~ jupyter nbextension list
Known nbextensions:
  config dir: /Users/somghosh/miniconda3/envs/regtest/etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled
      - Validating: OK
      jupyter-gmaps/extension  enabled
      - Validating: OK
(regtest) ➜  ~ jupyter labextension list
JupyterLab v1.0.1
Known labextensions:
   app dir: /Users/somghosh/miniconda3/envs/regtest/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.0.0  enabled  OK
        jupyter-gmaps v0.8.4  enabled  OK
(regtest) ➜  ~ conda info

     active environment : regtest
    active env location : /Users/somghosh/miniconda3/envs/regtest
            shell level : 2
       user config file : /Users/somghosh/.condarc
 populated config files : /Users/somghosh/miniconda3/envs/regtest/.condarc
          conda version : 4.7.5
    conda-build version : not installed
         python version : 3.7.3.final.0
       virtual packages :
       base environment : /Users/somghosh/miniconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/somghosh/miniconda3/pkgs
                          /Users/somghosh/.conda/pkgs
       envs directories : /Users/somghosh/miniconda3/envs
                          /Users/somghosh/.conda/envs
               platform : osx-64
             user-agent : conda/4.7.5 requests/2.21.0 CPython/3.7.3 Darwin/18.5.0 OSX/10.14.4
                UID:GID : 502:20
             netrc file : None
           offline mode : False

(regtest) ➜  ~ conda list
# packages in environment at /Users/somghosh/miniconda3/envs/regtest:
#
# 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
ca-certificates           2019.6.16            hecc5488_0    conda-forge
certifi                   2019.6.16                py37_0    conda-forge
decorator                 4.4.0                      py_0    conda-forge
defusedxml                0.5.0                      py_1    conda-forge
entrypoints               0.3                   py37_1000    conda-forge
geojson                   2.4.1                      py_0    conda-forge
gmaps                     0.8.4                      py_0    conda-forge
ipykernel                 5.1.1            py37h24bf2e0_0    conda-forge
ipython                   7.6.1            py37h5ca1d4c_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.5.0                      py_0    conda-forge
jedi                      0.14.0                   py37_0    conda-forge
jinja2                    2.10.1                     py_0    conda-forge
json5                     0.8.4                      py_0    conda-forge
jsonschema                3.0.1                    py37_0    conda-forge
jupyter_client            5.2.4                      py_3    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge
jupyterlab                1.0.1                    py37_0    conda-forge
jupyterlab_server         1.0.0                      py_1    conda-forge
libcxx                    4.0.1                hcfea43d_1
libcxxabi                 4.0.1                hcfea43d_1
libedit                   3.1.20181209         hb402a30_0
libffi                    3.2.1                h475c297_4
libsodium                 1.0.16            h1de35cc_1001    conda-forge
markupsafe                1.1.1            py37h1de35cc_0    conda-forge
mistune                   0.8.4           py37h1de35cc_1000    conda-forge
nbconvert                 5.5.0                      py_0    conda-forge
nbformat                  4.4.0                      py_1    conda-forge
ncurses                   6.1                  h0a44026_1
notebook                  5.7.8                    py37_1    conda-forge
openssl                   1.1.1b               h01d97ff_2    conda-forge
pandoc                    2.7.3                         0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.5.0                      py_0    conda-forge
pexpect                   4.7.0                    py37_0    conda-forge
pickleshare               0.7.5                 py37_1000    conda-forge
pip                       19.1.1                   py37_0
prometheus_client         0.7.1                      py_0    conda-forge
prompt_toolkit            2.0.9                      py_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
pygments                  2.4.2                      py_0    conda-forge
pyrsistent                0.15.2           py37h01d97ff_0    conda-forge
python                    3.7.3                h359304d_0
python-dateutil           2.8.0                      py_0    conda-forge
pyzmq                     18.0.2           py37h2d07e9b_0    conda-forge
readline                  7.0                  h1de35cc_5
send2trash                1.5.0                      py_0    conda-forge
setuptools                41.0.1                   py37_0
six                       1.12.0                py37_1000    conda-forge
sqlite                    3.28.0               ha441bb4_0
terminado                 0.8.2                    py37_0    conda-forge
testpath                  0.4.2                   py_1001    conda-forge
tk                        8.6.8                ha441bb4_0
tornado                   6.0.3            py37h01d97ff_0    conda-forge
traitlets                 4.3.2                 py37_1000    conda-forge
wcwidth                   0.1.7                      py_1    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.33.4                   py37_0
widgetsnbextension        3.5.0                    py37_0    conda-forge
xz                        5.2.4                h1de35cc_4
zeromq                    4.3.1             h0a44026_1000    conda-forge
zlib                      1.2.11               h1de35cc_3

图中代码如下


import ipywidgets
ipywidgets.IntSlider()
locations = [(51.45681, -0.11717),
 (51.49119, -0.07177),
 (51.51439, -0.13108),
 (51.54591, -0.15607)]
import gmaps
import gmaps.datasets
gmaps.configure(api_key=API_KEY) # Your Google API key
fig = gmaps.figure()
heatmap_layer = gmaps.heatmap_layer(locations)
fig.add_layer(heatmap_layer)
fig
print(gmaps.__version__); print(ipywidgets.__version__)

【问题讨论】:

    标签: google-maps jupyter jupyter-lab gmaps.js


    【解决方案1】:

    遗憾的是,并非每个 Jupyter Notebook 扩展都适用于 JupyterLab。原因是底层软件架构完全不同,因此 Jupyter Notebook 扩展的代码在 JupyterLab 上运行时会导致错误。有关 JupyterLab 扩展的更多信息,您可以查看documentation

    我现在找不到 gmaps 的官方 JupyterLab 扩展,但也许您可以在推荐的 list of JupyterLab extensions 中找到替代方案。

    【讨论】:

    • 您先生是救生员。解决方案是运行jupyter-notebook 而不是jupyter-lab 来启动我的环境。
    猜你喜欢
    • 1970-01-01
    • 2018-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-26
    • 2017-09-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多