Gmaps works with Jupyter notebook but with a nearly identical setup and with jupyter lab it fails to work. I have installed, done build and have all the basic extensions as I show in screenshots . I have seen one other thread on similar issue but it doesnt solve my problem, i have put all information about extensions and other conda env below.
(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__)
Sadly, not every Jupyter Notebook extension works also with JupyterLab. The reason for that is that the underlying software architecture is quite different, and therefore the code for the Jupyter Notebook extensions leads to errors when running on JupyterLab. For further information on the extensions for JupyterLab you can have a look at the documentation .
I could not find an official JupyterLab extension for gmaps now, but maybe you can find an alternative in the recommended list of JupyterLab extensions .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.