Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JupyterLab and arcgis ipywidget 1.6.2 Error model not found #479

Closed
tgrout opened this issue Jul 30, 2019 · 30 comments
Closed

JupyterLab and arcgis ipywidget 1.6.2 Error model not found #479

tgrout opened this issue Jul 30, 2019 · 30 comments
Assignees

Comments

@tgrout
Copy link

tgrout commented Jul 30, 2019

I have tried installing the arcgis-map-ipywidget and I keep getting an error that states:
"Error displaying widget: model not found"

I have tried the following based on other guidance from similar issues (#307)

• run conda uninstall nodejs
• run conda create --name new_blank_env
• run activate new_blank_env
• run conda install -c esri arcgis -y
• run conda install nodejs
• run jupyter labextension install @jupyter-widgets/jupyterlab-manager
• run jupyter labextension install arcgis-map-ipywidget@1.6.2
• run jupyter lab

I get the error when trying to run this code:
"from arcgis.gis import GIS
#Create a map widget like you have done many times before
gis = GIS()
map1 = gis.map()
map1"

I have version 1.6.2 (not 1.5.0) of installed. Any input or guidance would be appreciated. I am able to get this same code to work in Jupyter Notebook but not Jupyter Lab.

@Hiromu-Nakamura
Copy link

I faced same issue as well.

@DavidJVitale
Copy link
Contributor

@Hiromu-Nakamura @tgrout See this related issue for more information: #287

I believe that the newest JupyterLab 1.0 version has introduced a breaking change, causing the widget not to work anymore. I need to investigate some more, and hopefully fix it for our next release. In the mean time, please try downgrading jupyterlab and see if that fixes your issue.

@Hiromu-Nakamura
Copy link

@DavidJVitale Hi David. Thank you for giving detail information. I'll try to downgrading the lab version.

@DavidJVitale
Copy link
Contributor

DavidJVitale commented Aug 19, 2019

FYI for all following this issue, see this post: #287 (comment)

So it looks like when JupyterLab moved up to version 1.0, they stopped hosting their JavaScript that was being used by the older versions. This probably won't revert, so we here at the Python API team will probably have to rewrite some of the widget code to get it to work. This unfortunately means you'll have to wait for a new release of the Python API (v1.7.0 most likely) to get JupyterLab working.

The Classic Jupyter Notebook Server will host notebooks with a functional widget isn't affected by this issue, so that is a short term workaround in the mean time. I'll keep on researching workarounds for JupyterLab and keep you updated with what find. So sorry for the inconvience!

@DavidJVitale
Copy link
Contributor

Also from that thread: #287

I have modified release v1.6.2 and tagged it as v1.6.2-post1. It is uploaded as v1.6.2-post1 to anaconda, pypi, and npm. Can you install this updated python package and npm package in your environment? If you're using anaconda, you might need to specify the build number in the install command.

Let me know if this fixes your issue, I have tested it on my end and it appears to be resolved.

@tgrout @Hiromu-Nakamura please try upgrading and let me know if your issue is resolved!

@swatson26
Copy link

@DavidJVitale Im having trouble finding that release on conda with:

conda install -c esri arcgis=v1.6.2-post1
and dont see it here https://anaconda.org/Esri/arcgis/labels

then reverting to pip, within the following short dockerfile to test

# Get the latest image tag at:
#   https://hub.docker.com/r/jupyter/minimal-notebook/tags/
# Inspect the Dockerfile at:
#   https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook/Dockerfile
FROM jupyter/minimal-notebook:4cdbc9cdb7d1
ARG GIT_COMMIT=unspecified
LABEL git_commit=$GIT_COMMIT
RUN pip install arcgis==v1.6.2-post1
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager
RUN jupyter labextension install arcgis-map-ipywidget@v1.6.2-post1

Im getting the following result
Screen Shot 2019-09-04 at 8 31 34 PM

@swatson26
Copy link

swatson26 commented Sep 5, 2019

and when disregarding the note

IMPORTANT: replace 1.5.0 with the exact version number of the Python API you have installed.

on https://developers.arcgis.com/python/guide/using-the-jupyter-lab-environment/

and reverting to RUN jupyter labextension install arcgis-map-ipywidget@v1.6.2 in the dockerfile
I get
Screen Shot 2019-09-04 at 8 40 30 PM

@Hiromu-Nakamura
Copy link

I have tried as well, and as @swatson26 mentioned, could not install it with exactly same command, conda install -c esri arcgis=v1.6.2-post1, and other possible patterns like 1.6.2-post1 etc..

However, I have found the three files of 1.6.2-post1 at here.
Also, I was able to search the files via conda search arcgis.
2019-09-05_10h15_36

As a quick solution, I would like to download a post1 file and install offline, but not sure which file is for Python 3.6.6, my Pro's python version.
It is appreciated if we could know which file I have to choose.

Thanks

@DavidJVitale
Copy link
Contributor

Hi @Hiromu-Nakamura and @swatson26 , my apologies about the release confusion -- I have updated the build string to include the post1, since conda doesn't allow any release versions outside of X.Y.Z semantic formatting. Conda install commands follow the general format of conda install -c <channel> <package>=<x.y.z version>=<build string>.

Try this install command in your conda environments, it should pick out the correct python version for your environment (py3.6 for Pro, etc.). Let me know if this works.

conda install -c esri arcgis=1.6.2=post1*

@swatson26 on your pip install error, can you try installing it in a pip environment outside of docker? When I run these three commands, my jupyterlab works correctly with the widget when I run these commands in a new blank environment:

pip install arcgis==v1.6.2-post1
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install arcgis-map-ipywidget@v1.6.2-post1

@swatson26
Copy link

thanks @DavidJVitale

I've gotten the plugin working, but there is something wonky going on with the JS (I think) where the tabs and right-hand tool bar are not rendering and have red boxes.

for operational reasons, I need to be using docker and docker build is based off of jupyters minimal docker image https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook/Dockerfile
FROM jupyter/minimal-notebook:4cdbc9cdb7d1 (which then builds from base notebook)

So I'm assuming there is something in there that's disagreeing with arcgis plugin. Want me to create a separate issue on this topic?
Screen Shot 2019-09-06 at 11 59 22 AM

@DavidJVitale
Copy link
Contributor

DavidJVitale commented Sep 6, 2019

@swatson26 I saw a similar error to what you saw, I think this is an issue with upstream JupyterLab. These issues appear to be similar to what you're seeing:

jupyterlab/jupyterlab#7140
jupyterlab/jupyterlab#7122
jupyterlab/jupyterlab#7132

I was able to resolve this by upgrading my Jupyterlab to the latest version, 1.1.X. What version of jupyterlab are you on?

@Hiromu-Nakamura
Copy link

Hiromu-Nakamura commented Sep 10, 2019

@DavidJVitale Sorry for late reply. Thank you so much for clarifying detail. With the command you suggested, I have successfully installed post1.
I just make a map with my own dataset and it works fine on my end so far.
2019-09-10_14h11_30

Again, thank you for your quick work!

@MSDuncan82
Copy link

Followed the instructions in the using-the-jupyter-lab-environment and still getting the error Error displaying widget: model not found.

In a new conda environment with python=3.7:
conda install nodejs
conda install -c esri arcgis (version 1.8.0)
conda install -c conda-forge jupyterlab
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install arcgis-map-ipywidget@1.8.0

@knoopum
Copy link

knoopum commented Jun 29, 2020

Still seeing the errors when trying to use map widget in jupyter-lab with the stock Python environment (1.7.0) that comes with ArcGIS Pro 2.5.2.

Starting from the stock environment and updating arcgis to 1.7.1 does not help:
conda install nodejs -c esri
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install arcgis-map-ipywidget@1.7.1
--> Error displaying widget: model not found and a broken image icon

Starting from the stock environment and updating arcgis to the latest currently available version of arcgis, 1.8.1 does not help either:
conda install nodejs -c esri
conda update arcgis -c esri --no-pin
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install arcgis-map-ipywidget@1.8.1
--> Loading widget... and a broken image icon

@DavidJVitale
Copy link
Contributor

@knoopum Could you try installing v1.X of JupyterLab? I am seeing some strange behavior with the arcgis-map-ipywidget and jupyterlab 2.X, it is resolved when I install 1.X. You can install 1.X of jupyterlab via:

conda install jupyterlab=1

If you are still seeing errors, can you send the browser console when the map doesn't work?

@knoopum
Copy link

knoopum commented Jul 8, 2020

@DavidJVitale Yes, downgrading to jupyterlab 1.x results in a functional map widget. Since I wanted to stay at 1.8.1 I used:

conda install jupyterlab=1 -c esri --no-pin

After downgrading to 1.x, I did have to reinstall the two jupyter labextensions. I also was getting CORS errors, so I had to add http://localhost:8888 to my ArcGIS Online instance's Allowed Origins.

With 1.8.1 and jupyterlab 2.x, I will note that even after installing the jupyter labextensions (and making sure to specify version 1.8.1), I get this error in the Console in Chrome Version 83.0.4103.116 on Windows 10:

Uncaught (in promise) Error: Module arcgis-map-ipywidget, semver range 1.8.1 is not registered as a widget module
    at k.loadClass (manager.js:319)
    at k.<anonymous> (manager-base.js:264)
    at l (manager-base.js:45)
    at Object.next (manager-base.js:26)
    at manager-base.js:20
    at new Promise (<anonymous>)
    at Rtm6.L (manager-base.js:16)
    at k.e._make_model (manager-base.js:258)
    at k.<anonymous> (manager-base.js:247)
    at l (manager-base.js:45)

@FrancisBases
Copy link

FrancisBases commented Jul 13, 2020

Have tried all solution combinations and the more updated and the issue is not resolved with the previous solutions.
So here are current versions:
jupyterlab v.2.1.5
@jupyter-widgets/jupyterlab-manager v2.0.0
arcgis-map-ipywidget v1.8.1
arcgis v1.8.2

image

if anyone has fix is appreciated in advance.

@Hiromu-Nakamura
Copy link

Hiromu-Nakamura commented Jul 13, 2020

Not sure if it would be helpful, but I could show a map with the following environment:
2020-07-13_19h43_02
ArcGIS Pro 2.5.1
arcgis 1.8.1
jupyterlab 1.1.4
nodejs 12.16.1

@jupyter-widgets/jupyterlab-manager v1.0.3
arcgis-map-ipywidget v1.8.1

I think difference may be that I am using nodejs 12.16.1.
Just because I don't want to use later version than LTS of Node.js

@DavidJVitale
Copy link
Contributor

@FrancisBase I have not posted the v1.8.2 jupyterlab extension yet on npm, I will do that sometime this week. I will tag you on this issue when I publish it.

@FrancisBases
Copy link

Awesome @DavidJVitale So many Thanks.

@DavidJVitale DavidJVitale self-assigned this Jul 13, 2020
@DavidJVitale
Copy link
Contributor

@FrancisBase @knoopum @MSDuncan82 I have uploaded the v1.8.2 arcgis-map-ipywidget to npm. This npm package will work with JupyterLab 2.X, but not JupyterLab 1.X

Please install and let me know of any concerns. I have tested on a few computers and it appears to be working well. Thanks!

@FrancisBases
Copy link

FrancisBases commented Jul 24, 2020

Great work @DavidJVitale here is my solution which is working, if you like put star or like in https://github.com/FrancisBase , and most importantly is useful:
jlab_arcgis
Note: if the command jupyter labextension list lists unknown extensions, then you have a bug and for fix do like is explained here jupyterlab/jupyterlab#8122 (comment)
Basically consists in removing the build_config.json in the core jupyterlab settings folder (not necessarily the activated environment's jupyterlab).

If you are in a base conda environment the location of the file is a bit different than: <conda_root>/envs/<env_name>/share/jupyter/lab/settings/build_config.json

Instead it is in: <conda_root>/share/jupyter/lab/settings/build_config.json
cheers.

@DavidJVitale
Copy link
Contributor

Also, for anyone still having issues -- We have updated the installation docs to show how to install it in the JupyterLab UI, please take a look at the new doc:

https://developers.arcgis.com/python/guide/using-the-jupyter-lab-environment/

@Hiromu-Nakamura
Copy link

@DavidJVitale It is very helpful. Thank you for updating the docs.

@homerjonathan
Copy link

I have followed the instructions and I am still getting the error.

I am using JupyterHub to launch single instances. I have built a containerized image of JupyterLab at version 2.1.5.

Installed the extension: arcgis-map-ipywidget v1.8.2 enabled OK
Installed as per instructions the arcgis with exactly the same version as 1.8.2

We have not used Conda since it is a containerized environment anyhow.

I have done a jupyter lab build but nothing has changed. I have based the image from the JupyterLab datascience-notebook. https://hub.docker.com/r/jupyter/datascience-notebook/ Its a good image and everything works except the ArcGIS Widget.

Here is the Docker Image

ARG BASE_IMAGE=jupyter/datascience-notebook
FROM $BASE_IMAGE

ENV GITLAB_HOST=http://ourgitlab.com/

ADD install_jupyterhub.sh /tmp/install_jupyterhub.sh
ARG JUPYTERHUB_VERSION=master

RUN python3 /tmp/install_jupyterhub.sh && \
    python3 -m pip install notebook && \
    python3 -m pip install torch && \
    python3 -m pip install arcgis && \
    python3 -m pip install fastai && \
    python3 -m pip install libtiff && \
    python3 -m pip install jupyterlab-git && \
    jupyter serverextension enable --py jupyterlab_git && \
    jupyter nbextension enable --py --sys-prefix widgetsnbextension && \
    jupyter nbextension enable --py --sys-prefix arcgis && \
    jupyter labextension install @jupyterlab/toc && \
    jupyter labextension install @jupyterlab/geojson-extension && \
    jupyter labextension install @jupyterlab/debugger && \
    jupyter labextension install jupyterlab-drawio && \
    jupyter labextension install jupyterlab-spreadsheet && \
    jupyter labextension install jupyterlab-gitlab

Here is the install_jupyterhub.sh script that was copied from the JupyterLab Single User example.

#!/usr/bin/env python
import os
from subprocess import check_call
import sys

V = os.environ['JUPYTERHUB_VERSION']

pip_install = [
    sys.executable, '-m', 'pip', 'install', '--no-cache', '--upgrade',
    '--upgrade-strategy', 'only-if-needed',
]
if V == 'master':
    req = 'https://github.com/jupyterhub/jupyterhub/archive/master.tar.gz'
else:
    version_info = [ int(part) for part in V.split('.') ]
    version_info[-1] += 1
    upper_bound = '.'.join(map(str, version_info))
    vs = '>=%s,<%s' % (V, upper_bound)
    req = 'jupyterhub%s' % vs

check_call(pip_install + [req])#!/usr/bin/env python
import os
from subprocess import check_call
import sys

V = os.environ['JUPYTERHUB_VERSION']

pip_install = [
    sys.executable, '-m', 'pip', 'install', '--no-cache', '--upgrade',
    '--upgrade-strategy', 'only-if-needed',
]
if V == 'master':
    req = 'https://github.com/jupyterhub/jupyterhub/archive/master.tar.gz'
else:
    version_info = [ int(part) for part in V.split('.') ]
    version_info[-1] += 1
    upper_bound = '.'.join(map(str, version_info))
    vs = '>=%s,<%s' % (V, upper_bound)
    req = 'jupyterhub%s' % vs

check_call(pip_install + [req])

It is a fairly chunky image but we need a comprehensive image.

Any assistance would be great.

@shingike
Copy link

shingike commented Apr 7, 2021

@DavidJVitale, Do you have arcgis-map-ipywidget for arcgis python API v1.8.5? It was working until 1.8.4, but with the new 1.8.5 release, the widget is no longer working.

@rohitgeo
Copy link
Contributor

rohitgeo commented Apr 9, 2021

@shingike the issue should be resolved now. Can you please re-try?

@rohitgeo rohitgeo closed this as completed Apr 9, 2021
@glw
Copy link

glw commented Nov 16, 2023

I am still having issues with this. To install the missing extension, I first installed nodejs in my cloned env.
conda install -c conda-forge nodejs

Then installed the extension through JupyterLab, restarted Jupyter Lab server, re-ran the code but am still getting

Failed to load model class 'ArcGISMapIPyWidgetModel' from module 'arcgis-map-ipywidget'
Error: No version of module arcgis-map-ipywidget is registered

jupyterlab=3.3.2
arcgis=2.0.1
npm --version = 10.1.0
Node.js = 20.8.1

@achapkowski
Copy link
Contributor

Jupyterlabs 3 is not supported in the current version of the ArcGIS API for Python.
In the future this may change but no definite time table.

@glw
Copy link

glw commented Nov 17, 2023

I see thank you for that information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests