Widget JavaScript Not Detected
Trying to run the samples -
Configured the Jupyter Notebook environment via
%%sh
conda install -c conda-forge ipywidgets
conda install -c esri arcgis
Both of those installed fine
Enabled widgets via
%%sh
jupyter nbextension enable --py --sys-prefix widgetsnbextension
Enabling notebook extension jupyter-js-widgets/extension... - Validating: OK
Then if I try to instantiate a sample map:
from arcgis.gis import GIS
gis = GIS()
map = gis.map('Seattle, WA', 6)
map
I get a JavaScript error: Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"
Non-ESRI widgets work fine in my other notebooks.
@DruidSmith can you try enabling the map widget as mentioned in this section of the help
I've already tried that - it didn't work (see screenshots below). I've gotten to the point where other ArcGIS Online content is being returned (such as user profile and item search results), but the maps will not instantiate. One other note (not sure if it makes a difference): I am running on Jupyter Hub on a server rather than launching Jupyter locally from the command line.

@DruidSmith can you confirm that you have ipywidgets version 5.1.5 or higher?
Also, please open Tools > Developer Tools in Chrome and send a screenshot of any errors you get in the Console when you try to create and view the map widget.
Hi Rohit:
%%sh
conda list ipywidgets
python -V
# packages in environment at /opt/anaconda3:
#
ipywidgets 5.2.2 py35_0
Python 3.5.2 :: Anaconda custom (64-bit)
In Console it is throwing an error relating to require.js
require.js:900 TypeError: Cannot read property 'load_ipython_extension' of undefined
at https://analytics-notebook.edap-cluster.com/user/[email protected]…static/notebook/js/main.min.js?v=f8115aaf7a88fe8ef22f54c4da3b8915:12132:31
at Object.execCb (https://analytics-notebook.edap-cluster.com/user/[email protected]…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1690:33)
at Object.check (https://analytics-notebook.edap-cluster.com/user/[email protected]…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:865:51)
at Object.<anonymous> (https://analytics-notebook.edap-cluster.com/user/[email protected]…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1140:34)
at https://analytics-notebook.edap-cluster.com/user/[email protected]…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:131:23
at https://analytics-notebook.edap-cluster.com/user/[email protected]…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1190:21
at each (https://analytics-notebook.edap-cluster.com/user/[email protected]…c/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:56:31)
at Object.emit (https://analytics-notebook.edap-cluster.com/user/[email protected]…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1189:17)
at Object.check (https://analytics-notebook.edap-cluster.com/user/[email protected]…/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:940:30)
at Object.enable (https://analytics-notebook.edap-cluster.com/user/[email protected]…components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1177:22)check @ require.js:900
utils.js:36Loading extension: nb_anacondacloud/main
@DruidSmith in the screenshot posted above, you are running the widget installation commands from within the notebook (in cell [1]). Have you tried running them from your shell and restarting jupyter notebook / jupyterhub?
Here's some additional debug info - maybe it's an ipywidgets versioning issue?
Loading extension: nbpresent/js/nbpresent.min utils.js:36 Loading extension: nb_anacondacloud/main utils.js:36 Loading extension: arcgis/mapview require.js:900 TypeError: Cannot read property 'load_ipython_extension' of undefined(…)check @ require.js:900 utils.js:36Loading extension: nb_conda/main utils.js:36Loading extension: jupyter-js-widgets/extension
and when we actually run the leaflet cell:
Could not cross validate the widget frontend and backend versions. Error: Timeout while trying to cross validate the widget frontend and backend versions.(…) data:application/x-…:822 Uncaught SyntaxError: Unexpected token ? data:application/x-…:5 Uncaught SyntaxError: Unexpected token ? data:application/x-…:9 Uncaught SyntaxError: Unexpected token ? data:application/x-…:1660 Uncaught SyntaxError: Unexpected token ?
An example of the “unexpected token” from one of the javascript errors above is:
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new
…. (a bunch of code removed for clarity) …
a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
?_=1476479156478
@DruidSmith, can you please check if this is resolved in v0.3 that was released a short time ago?
@rohitgeo The other challenge now is that some of our accounts are dependent on AGOL Enterprise Accounts and the issue there is with SAML support, posted a note about whether a Python SAML library could be used to authenticate against our enterprise ID.
@DruidSmith SAML will work through the 'pro' authentication scheme described at https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#ArcGIS-Pro-user-connecting-to-the-active-portal-in-the-Pro-app
I had the same exact issue as @DruidSmith so i tried re-running:
conda install -c conda-forge ipywidgets
conda install -c esri arcgis
jupyter nbextension enable --py --sys-prefix widgetsnbextension
However, now I'm getting the error:
arcpy must be run from inside the Conda environment, which ArcGIS uses to manage the installation of Python. You can access this environment by launching Python from the links inside the "ArcGIS > ArcGIS Pro" Start Menu Group: "Python Interactive Terminal" starts a Python session. "Python Command Prompt" opens a Command Prompt window initialized with Conda.
I'm running everything via the Python Command Prompt so I dont see how this can be an issue. Please help!
I've seen this message 'Widget JavaScript not detected' on occasion but it seems to be unrelated to the map widget and comes from the ipywidgets dependency. I've seen the map widget work even with this error message.
From the discussion at https://github.com/ipython/ipywidgets/issues/669:
I don't know about anyone else, but I still see this message ALL THE TIME, on lots of different systems. Sometimes it goes away after running the suggested command, sometimes it doesn't. Sometimes reinstalling ipywidgets helps, sometimes it doesn't. Sometimes it means the widgets aren't working, sometimes it doesn't. Sometimes I manage to get it to go away somehow, but then it comes back the next time anything is upgraded. This message and the associated machinery is really a big pain when using ipywidgets. :-(
Another thing to check is that the notebook server must be restarted after you install the arcgis package for the widget to work. This would explain the widget not working if installed from within the Jupyter Notebook environment using %%sh magic.
Is using the "pro" option is predicated on the machine running Jupyter also having an active ArcGIS Pro session running?
We have Jupyter running in a separate, server-based environment, as such it doesn't look like that would work for us.
@DruidSmith yes, the 'Pro' authentication works when you have the arcgis API installed in arcgispro-py3 conda env of ArcGIS Pro and by having Pro session running.
Is using the "pro" option is predicated on the machine running Jupyter also having an active ArcGIS Pro session running?
We're running the Jupyter environment on a Linux server and there isn't yet a Linux version of ArcGIS Pro available. Are there any other ways that we could authenticate to ArcGIS Online via our Enterprise logon?
I am not able to display the map on Jupyter notebook.

I am using Python 3.6.2 on a Windows 64 bit machine and have installed arcgis on conda. This is the message when I run python on my windows command prompt:
Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:58:45) [MSC v.1900 64 bit (AMD64)] on win32
The command "conda list" on command prompt gives following output:
arcgis 1.2.1 py36_1 esri
bleach 1.5.0 py36_0 conda-forge
certifi 2017.7.27.1 py36_0 conda-forge
colorama 0.3.9 py36_0 conda-forge
decorator 4.1.2 py36_0 conda-forge
entrypoints 0.2.3 py36_1 conda-forge
html5lib 0.9999999 py36_0 conda-forge
ipykernel 4.6.1 py36_0 conda-forge
ipython 6.1.0 py36_0 conda-forge
ipython_genutils 0.2.0 py36_0 conda-forge
ipywidgets 7.0.0 py36_0 conda-forge
jedi 0.10.2 py36_0 conda-forge
jinja2 2.9.6 py36_0 conda-forge
jsonschema 2.5.1 py36_0 conda-forge
jupyter_client 5.1.0 py36_0 conda-forge
jupyter_core 4.3.0 py36_0 conda-forge
kerberos-sspi 0.2 py36_0
markupsafe 1.0 py36_0 conda-forge
mistune 0.7.4 py36_0 conda-forge
mkl 2017.0.3 0
nbconvert 5.2.1 py36_1 conda-forge
nbformat 4.3.0 py36_0 conda-forge
notebook 5.0.0 py36_0 conda-forge
numpy 1.13.1 py36_0
pandas 0.20.3 py36_1 conda-forge
pandoc 1.19.2 0 conda-forge
pandocfilters 1.4.1 py36_0 conda-forge
pickleshare 0.7.4 py36_0 conda-forge
pip 9.0.1 py36_0 conda-forge
prompt_toolkit 1.0.15 py36_0 conda-forge
pygments 2.2.0 py36_0 conda-forge
python 3.6.2 0 conda-forge
python-dateutil 2.6.1 py36_0 conda-forge
pytz 2017.2 py36_0 conda-forge
pywin32 220 py36_1 conda-forge
pyzmq 16.0.2 py36_2 conda-forge
setuptools 36.2.2 py36_0 conda-forge
simplegeneric 0.8.1 py36_0 conda-forge
six 1.10.0 py36_1 conda-forge
testpath 0.3.1 py36_0 conda-forge
tornado 4.5.1 py36_0 conda-forge
traitlets 4.3.2 py36_0 conda-forge
vs2015_runtime 14.0.25420 0 conda-forge
wcwidth 0.1.7 py36_0 conda-forge
webencodings 0.5 py36_0 conda-forge
wheel 0.29.0 py36_0 conda-forge
widgetsnbextension 3.0.2 py36_0 conda-forge
wincertstore 0.2 py36_0 conda-forge
Also, the error shown in the screenshot disappears when I re-run the cell. No output, no error message. Just blank.

The console, however, shows a 404 GET message as below:

I have double checked the ipywidgets installation using
conda install -c conda-forge ipywidgets

and there seems to be no issue with that too.
@prasunkgupta Can you validate your ipywidgets version?
import ipywidgets
print(ipywidgets.__version__)
@rwmajor2 Thank you for replying. This is what I get:

@prasunkgupta Thanks. With the recent release of ipywidgets 7.0, we have seen this issue. Currently, it only works with 6.x ipywidgets.