Giter VIP home page Giter VIP logo

insights-scripting-guide's Introduction

Insights Scripting Guide

This guide offers a reference for creating custom features in ArcGIS Insights using Python and R. It is the definitive guide for Insights scripting topics and a resource for implementing Jupyter's Kernel Gateway.

Check out the wiki here

Prerequisites

  • ArcGIS Insights (version 2020.x or above). Refer readme for details on versions.
  • Anaconda (with Python version 3.7 or above)
  • See needed Python and R dependencies

Note: Scripting is not supported in Insights running in ArcGIS Online. Download Insights Desktop for this instead, which supports ArcGIS Online connections, ArcGIS Enterprise connections, database and scripting features.

Note: Plots created with pandas i.e., pandas.DataFrame.plot() are not displayed in the cards when added to a script model.

You can access an archived version of this documentation here.

Setup Kernel Gateway

Insights supports connections to Jupyter's Kernel Gateway, which is an open source web server distributed through conda-forge and other repository channels. To setup a Kernel Gateway, with the required dependencies choose one of the following deployment sections.

Check out Deployment Patterns for system planning recommendations.

Deploy with Anaconda

Note: If you have already created the conda environment, skip to this section here

  1. Install Anaconda

  2. Create a folder named gateway

  3. Copy selfsign.py into gateway folder

  4. Copy the .yml file into the gateway folder.

  5. Open Anaconda's command prompt and CD into the gateway folder

  6. If you are using 2023.1, 2023.2, or 2023.3 versions of the ArcGIS Insights, run the following commands:

    conda env create -f insights-latest.yml
    conda activate insights-latest
    python selfsign.py

Note: If the process of creating a conda environment is taking too long, follow these instructions to create the environment here

  1. If you are using any of the versions 2021.2, 2021.3, 2022.1, 2022.2, or 2022.3 of the ArcGIS Insights, run the following commands:

    conda env create -f insights-2022.yml
    conda activate insights-2022
    python selfsign.py
  2. If you are using any of the versions 2020.2, 2020.3 or 2021.1 of the ArcGIS Insights, run the following commands:

    conda env create -f insights-base.yml
    conda activate insights-base
    python selfsign.py
  3. Start the Kernel Gateway:

  • If you are using Insights in ArcGIS Enterprise, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=./server.crt --keyfile=./server.key --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager
  • If you are using Insights Desktop, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager
  1. Open the kernel gateway url in the browser before using it to connect in the Insights web application. For example: If you are using Insights in Chrome, open the gateway url in a new tab in Chrome, and bypass the security exceptions. Similarly, if you are using Insights in Safari or Firefox, open the gateway url and bypass the security exceptions. For more detailed instructions on bypassing security exceptions, refer wiki

  2. When you open the gateway url (ex: https://pickle.esri.com:9999), you will see a JSON response as {"reason": "Not Found", "message": ""}. This is a valid message and it indicates that our kernel is up and running and it is ready to use within Insights. This message is just a default swagger-api's response. If you are interested in more detailed response regarding the kernel, you can navigate to api/kernelspecs page (ex: https://pickle.esri.com:9999/api/kernelspecs)

  3. Do not close the Anaconda prompt or the terminal window after starting the kernel gateway. Just minimize it. Closing the window will kill the kernel gateway.

  4. Optional: Stop Kernel Gateway by pressing Control-C in the running window or close the window.

Note: If you would like to access your data (.csv,.xls, etc.,) in the scripting environment, create a data folder within gateway folder and put your files in it. Then, activate your conda environment after CD'ng into the data folder and run the appropriate gateway command to start the gateway.

Deploy with Docker

  1. Install Docker

  2. Create a folder named gateway

  3. Copy selfsign.py and Dockerfile into gateway folder

  4. Run selfsign.py to create certificates in the gateway folder

    python selfsign.py
  5. Create a data folder within gateway and put your data files there

  6. Run the following command to create the Kernel Gateway Docker image

    docker build -t insights-gateway .
  7. Start the Kernel Gateway

    docker run -p 9999:9999 insights-gateway

Alternative method to create a conda environment

In some cases, creating a conda environment using a yml file takes a long time, and the process might get stuck as conda is trying to solve the environment by resolving the conflicts between some of the dependencies. Instead of waiting for the process to resolve, we can install the packages one by one. Follow the instructions below to quickly create your environment.

  1. Open Anaconda's command prompt and CD into the gateway folder.
  2. Creating a new environment and installing dependencies:
  • If you are using 2023.1, 2023.2, or 2023.3 versions of the ArcGIS Insights, run the following commands:

    # Creates a new environment named `insights-latest` with Python 3.9.14 installed.
    conda create -n insights-latest -c conda-forge python=3.9.14
    # Activates the insights-latest environment.
    conda activate insights-latest
    # Installs the packages from conda-forge channel.
    conda install -c conda-forge jupyter_kernel_gateway=2.5.1 pandas=1.5.1 shapely=1.8.5 msgpack-python=1.0.4 matplotlib
    conda install -c conda-forge geopandas=0.11.1
    conda install -c conda-forge pyspark=3.3.1
    # You can skip the following if you don't need R kernel.
    conda install -c conda-forge r-itertools
    conda install -c conda-forge r-essentials
    # Creates certificates in the gateway folder.
    python selfsign.py
  • If you are using any of the versions 2021.2, 2021.3, 2022.1, 2022.2, or 2022.3 of the ArcGIS Insights, run the following commands:

    # Creates a new environment named `insights-2022` with Python 3.7.12 installed.
    conda create -n insights-2022 -c conda-forge python=3.7.12
    # Activates the insights-2022 environment.
    conda activate insights-2022
    # Installs the packages from conda-forge channel.
    conda install -c conda-forge jupyter_kernel_gateway=2.5.1 pandas=1.5.1 shapely=1.8.5 msgpack-python=1.0.4 matplotlib
    conda install -c conda-forge geopandas
    conda install -c conda-forge pyspark=3.1.0
    # You can skip the following if you don't need R kernel.
    conda install -c conda-forge r-itertools
    conda install -c conda-forge r-essentials
    # Creates certificates in the gateway folder.
    python selfsign.py
  1. Start the kernel gateway:
  • If you are using Insights in ArcGIS Enterprise, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=./server.crt --keyfile=./server.key
    --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager
  • If you are using Insights Desktop, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager

Starting the kernel gateway

Note: If you haven't created a conda environment. Refer to the instructions here

  1. Open Anaconda's command prompt and CD into the gateway folder.
  2. Activate the conda environment:
  • If you are using 2023.1, 2023.2, or 2023.3 versions of the ArcGIS Insights, run the following command:

    conda activate insights-latest
  • If you are using any of the versions 2021.2, 2021.3, 2022.1, 2022.2, or 2022.3 of the ArcGIS Insights, run the following command:

    conda activate insights-2022
  • If you are using any of the versions 2020.2, 2020.3 or 2021.1 of the ArcGIS Insights, run the following command:

    conda activate insights-base
  1. Start the Kernel Gateway:
  • If you are using Insights in ArcGIS Enterprise, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=./server.crt --keyfile=./server.key
    --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager
  • If you are using Insights Desktop, run the following command:

    jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --KernelGatewayApp.kernel_manager_class=notebook.services.kernels.kernelmanager.AsyncMappingKernelManager

Create a connection

To create a connection to your Kernel Gateway follow these steps:

  1. Open Insights
  2. Create a new workbook
  3. Click the Scripting icon Open console
  4. Complete Kernel Gateway connection form

Note: Connections must reference the Kernel Gateway root URL. For tips on what connections may look like see Connection examples.

Connection examples

Urls may be HTTP or HTTPS. Hosts can be referenced in numerous ways, IP address, localhost, FQDN etc. You can use any available inbound port number that is not already in use. If using 443, a connection will not require the port number. Here are some examples. Yes means connection schema is supported. No, means that URL connection will likely fail (not work).

Connection URL Insights in Enterprise Insights Desktop
http://localhost:9999 no yes
https://localhost:9999 no no
http://pickle:9999 no yes
https://pickle:9999 no no
http://12.120.95.153:9999 no yes
https://12.120.95.153:9999 yes no
http://pickle.esri.com:9999 no yes
https://pickle.esri.com:9999 yes no 1

1 Insights Desktop can make connections to HTTPS Kernel Gateway endpoints, if the Kernel Gateway uses a domain or a certificate authority certificate.

2 If using port 443, the connection url will look like this https://pickle.esri.com. Here pickle is the machine name.

Note: In Chrome, when trying to access the gateway url, it will give you a "Your connection is not private" warning. Click somewhere on the page and then blindly type the word thisisunsafe. This will instantly bypass the warning.

General Features

Python and R scripting features are distributed across the app. Shared scripts are accessed from the Add dialog. Script modules and module options are accessed via the Data Pane. Lastly, the Console itself has many script features. Refer to this table for an overview of tools and capabilities.

Icon Tool Name Description
Open console Open console Opens the Python and R scripting console or Kernel Gateway connection dialog. If no Kernel Gateway connection exists within the page, this is when the connection dialog openes.
Create module Create module Creates a script from selected cells then adds a module to the data pane.
Create card Create card Takes the active cell and creates a card.
Delete cell Delete cell Deletes the active cell.
Export script Export script Enables saving of cell (or cells) to common formats like Python, R, or Jupyter Notebook files.
Import file Import file Enables importing of scripts into the console from common files like Python, R or Jupyter Notebook files.
Insert cell Insert cell Inserts a new scripting cell.
Restart kernel Restart kernel Restarts the execution kernel within the Kernel Gateway. Restarting stops running scripts and clears the namespace and any data held in memory.
Run Run Runs script in active cell.
Run all Run all Runs all scripts in active cell.
Switch connection Switch connection Enables connection changing from one Kernel Gateway to another.

Shortcuts

The console enables keyboard shortcuts to perform routine tasks quickly.

Shortcut Description
Ctrl + B Create comments for selected code.
Shift + Enter Executes code in current cell.
Ctrl + Alt + B Adds %insights_return(<data frame object>) magic command to cell

Magic commands

The console supports the following magic command. This magic command must be placed in it's own cell.

Magic command Description
%insights_return(<data frame object>) Converts Python or R data frames into Insights datasets. When %insights_return(df) is run it will generate an Insights dataset from the df object. Data will be persisted in the workbook (when the workbook is saved) and will appear in the data pane after execution.

Deployment Patterns

There are various configurations to choose from when planning a Jupyter Kernel Gateway with Insights. It should be noted that some configurations may have tactical advantages over others. Additionally, each configuration will offer different end user experiences and varying degrees of effort regarding setup and maintenance.

These conceptual diagrams were designed to help organizations visualize different kinds of Jupyter Kernel Gateway configurations next to different kinds of Insights deployments.

Insights Desktop and Kernel Gateway

Insights Desktop and Kernel Gateway

  • This configuration entails low newtworking and firewall considerations
  • Data files may live on personal computer or file server

Insights in ArcGIS Enterprise and Kernel Gateway

Dedicated

Dedicated Kernel Gateway

  • This configuration entails moderate networking and firewall considerations and skills
  • Data files should live on file server or Kernel Gateway machine

Co-Located

Co-Located Kernel Gateway

  • This configuration entails moderate networking and firewall considerations and skills
  • Data files should live on file server or Kernel Gateway machine

Client Kernel Gateway System Design

Client Kernel Gateway

  • This configuration entails moderate networking and firewall considerations and skills
  • Data files may live on personal computer or file server

Cloud Kernel Gateway

  • Data files may need to be accessible from the cloud
  • This configuration entails advanced networking and firewall skills and considerations

Cloud Kernel Gateway

What is ArcGIS Insights?

Part of the Esri Geospatial Cloud, ArcGIS Insights is data analytics made for advanced location intelligence. Using Insights you can ask questions you did not know to ask, analyze data completely, and tell powerful data stories. Connect to your data directly, then use maps, charts, tables and reuseable models and scripts to perform basic to complex analyses that scale based on skill level and business need.

FAQs and Troubleshooting

How do I install additional Python libraries using the console that are not in my Kernel Gateway?

You can do this by putting an explanation point in front of a pip install command. Like,

!pip install BeautifulSoup4

If all goes well (after running the command), download activity will apear in the output cell. When the command finishes, you can then import your library and run scripts like normal.

from bs4 import BeautifulSoup
soup = BeautifulSoup("<p>Hello Insights!</p>")
print(soup.prettify())

Insights is running in the web browser and when making a Kernel Gateway connection it says "Not able to add this connection. Try with a different URL or web socket or check if your gateway is running."

If you've followed the guide (and ran the selfsign.py file), you have created a self signed SSL certificate. It may be possible that Insights cannot make a connection because the web browser itself does not trust the certificate. To work around this problem open the kernel gateway URL in the web browser and accept the browser warning. Then try connecting again.

WebSocket connection to gateway url failed: Error during WebSocket handshake: Incorrect 'Sec-WebSocket-Accept' header value?

This error can occur on a windows machine and when this happens, you will see an indefinite progress spinner in the scripting environment. This error can be found in the browser console and can be resolved by installing Websockets on IIS. Go to the Server Manager > Manage > Add Roles and Features > Server Roles > Web Server > Application Development > WebSocket Protocol. Make sure this is checked. Refer: Link

My Kernel Gateway is on a different machine and I am having trouble making a connection using Insights?

A fundamental way to troubleshoot this problem is confirm that all needed computers can talk to each other. If you are running Insights in Enterprise this means each ArcGIS Server machine, plus your Kernel Gateway and personal computer must all be able to communicate with each other. Insights Desktop entails less troubleshooting. For Insights Desktop deployments, only the Kernel Gateway and your personal computer need to talk to each other.

Try getting the IP address of:

  • Your personal computer machine
  • Your kernel gateway machine
  • Your ArcGIS Server machine(s)

and then from each machine run the ping command to see if ping messages are received.

Tip: On windows, run ipconfig and reference the Iv4 address to get the IP address. On mac, run ipconfig getifaddr en0 and note the address.

Seeing any other setup or connection issues?

If you encounter any issue which you are unable to troubleshoot, open your developer tools and see if there are any error messages in the console and create an issue on the repo with the error message. We will get back to you as soon as possible with a possible solution.

Tip: To open Developer tools of the web browsers, use Shift + Ctrl + I on Windows and Option + Cmd + I on Mac.

Get Insights Desktop

Download Insights Desktop

Licensing

Copyright 2020 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

insights-scripting-guide's People

Contributors

applecool avatar insights-test avatar jonbodie avatar melanieimfeld avatar warrendz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

insights-scripting-guide's Issues

Using Github Releases

Github projects can have Releases.

It is possible to wire certain actions, notifications, mechanisms, etc. to these releases.

Could you please set up releases for this Github repository?

Solving dependencies unsuccessful

Context

  • Subject : Solving dependencies unsuccessful
  • Resume : The creation of the Python virtual environment is unsuccessful and remains stuck on resolving dependencies.

Environment

  • ArcGIS Enterprise : 11.1 (without "badpatch")
    • Machine 1 : Portal / WebServer
    • Machine 2 : Server
  • ArcGIS Insights : 2023.3
  • Strategy : Co-location on ArcGIS Server on machine 2

Steps

Create project and gateway directory into :

D:\poc-insights-gateway\gateway

Copy ./gateway/selfsign.py and .gateway/insights-latest.yml

Edit insights-latest.yml to remove unnecessary r-packages :

name: insights-latest
channels:
  - conda-forge
dependencies:
  - python=3.9
  - jupyter_kernel_gateway=2.5.1
  - pandas=1.5.1
  - shapely=1.8.5
  - requests
  - msgpack-python=1.0.4
  - matplotlib
  - geopandas=0.11.1
  - pyspark=3.3.1
  #- r-itertools
  #- r-essentials

Create new conda env from ArcGIS Server conda.exe :

# Load
C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts>proenv.bat

# Init env into project dir
(arcgispro-py3) C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts>conda env create -f D:\poc-insights-gateway\gateway\insights-latest.yml -p D:\poc-insights-gateway\gateway\env\ags111insights20233

# ...

solving_env_failure

At this point, solving environment takes forever. Stop after 24h running.


According to the documentation, segregate the creation of env. :

# Load
C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts>proenv.bat

# create new env
(arcgispro-py3) C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts>conda create -p D:\poc-insights-gateway\gateway\env\ags111insights20233 -c conda-forge python=3.9

# load new env
(arcgispro-py3) C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts>activate D:\poc-insights-gateway\gateway\env\ags111insights20233

# move to directory
(D:\poc-insights-gateway\gateway\env\ags111insights20233) C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts> cd D:\poc-insights-gateway\gateway

# Install step 1
(D:\poc-insights-gateway\gateway\env\ags111insights20233) D:\poc-insights-gateway\gateway>conda install -c conda-forge jupyter_kernel_gateway=2.5.1 pandas=1.5.1 shapely=1.8.5 msgpack-python=1.0.4 matplotlib

# [...]

At this point, it works after ~1H.

Install geopandas

(D:\poc-insights-gateway\gateway\env\ags111insights20233) D:\poc-insights-gateway\gateway>conda install -c conda-forge geopandas=0.11.1

#[ ...]

Stuck here with solving dependencies. Stop after ~2H.

Can you please fix all the package versions used in the yml?

Thank you in advance

Kernel not starting, Insights for Portal

Hello there!,

I am trying to test scripting on ArcGIS Insights in the Enterprise version, but when I try to connect to the kernel it never starts, it keeps loading and in the command prompt there is no answer from the gateway. Also it does not show any error.

I´ve already tested my conection using ArcGIS Insights Local and it works correctly, its only on the portal were I find this issue.
Attached you can see a screenshot of the Command Prompt when I try to start the kernel. From there it doesn´t do anything else.

Thanks for any help
kernel

the latest jupyter gateway 2.4.0 does not work with Insights

My container gateway fails to connect while my anaconda gateway connects fine.

After comparing the installed modules in these two python environment, I find the version of the jupyter gateway in anaconda is 2.1.0 , but in the container the version is 2.4.0.

A simple change in the dockerfile to force pip to install 2.1.0 seems fix the connection problem.

Is it an isolated case, or it is true that the latest Jupyter gateway v2.4.0 does have issue when connecting from Insights

Support for Plotly charts in R

Can support for the Plotly package for R be added? It looks like the chart_studio module is supported. Currently the R scripting environment lets you execute code to create a plotly chart, but the output is empty (and the image card).

It would be great to have the full functionality of Plotly in Insights :)

cannot run the sample 'drag-n-drop-charting'

Try to get the data from the pane.
But I have an error:
Error in eval(expr, envir, enclos): object 'points.salesamtho' is not found.
(I added the sample geojson to workbook, that data set name is "points".)

Kernel not starting, localhost

Hi there,

We're trying to test scripting on Insights, but when we try to connect to the kernel it never starts, it keeps loading and in the command prompt there is no answer from the gateway. Also it does not show any error. Similar to another issue here, but we're running local.

Following the guide, we have used the following ssl config:

[dn] CN=BC.localhost.com [req] distinguished_name=dn [EXT] subjectAltName=DNS:BC.localhost.com keyUsage=digitalSignature extendedKeyUsage=serverAuth

And created with
openssl req -x509 -days 365 -out BC.crt -keyout BC.key -newkey rsa:2048 -nodes -sha256 -subj "/CN=BC.localhost.com" -extensions EXT -config insightsgw.cnf

Then started kernel
jupyter kernelgateway --KernelGatewayApp.ip=0.0.0.0 --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=C:\insightsgw\BC.crt --keyfile=C:\insightsgw\BC.key

Checking in browser seems ok?
image

image

But connecting in Insights starts the loading screen which runs indefinitely
image

Not sure what we're doing wrong? Any help would be much appreciated. Thanks

Setup Scripting Environment to Connect via ArcGIS Pro Python Installation

I am running ArcGIS Insights 2022.1.x on Windows, I already have ArcGIS Pro installed, and primarily use the Python installed with ArcGIS Pro. It seems like the instructions here may require a separate Python installation to create the Jupyter Kernel Gateway even though ArcGIS Pro uses conda (not Anaconda...I know there is a difference, but I am not completely sure if that applies here). I am possibly missing something here, but is there a way to just connect ArcGIS Insights to the ArcGIS Pro Python installation? Seems like that would be the easiest implementation as I would expect most Insight users to also have ArcGIS Pro. Thanks.

Graph labeling problems

Is it possible to define a customized graph labeling that the label of a vertex is sum of the weights of incident edges and visualize the induced label by the size of the vertices?

Moreover, I would like to know some basics information about a graph, such as eccentricity of a vertex, edge-cut, spanning tree of a graph.

Is there any tools/ script can solve these problems?

ERR_EMPTY_RESPONSE

Hello,

I need to use ArcGIS Insights using Python, and it has been decided to use Jupyter's Kernel Gateway via Docker.

Docker is installed and configured (a laptop using Windows 10), has been tested, and works normally. The python script selfsign.py has been created to create the scripts (by the way, I would make a change because as it is, it generates the certificate with the hostname and not the FQDN).

In the gateway folder, there is a Dockerfile, the insights-latest.yml (I assume it is not used), the README.md, the script selfsign.py, and the public key as a private key of the certificate (server.crt and server.key).

At this point, I have a doubt.
5. Create a data folder within gateway and put your data files there.

Which files should be copied there? could you please be more explicit?
In this case, I have created the data folder and copied the same files mentioned before.

When executing it, I have errors when creating the docker image.

docker build -t insights-gateway .

ERROR: failed to solve: process "/bin/bash -o pipefail -c conda install --quiet --yes 'rpy2=2.8*' 'r-base=3.4.1' 'r-irkernel=0.8*' 'r-plyr=1.8*' 'r-jsonlite=1.5*' 'r-data.table=1.11.4*' 'r-devtools=1.13*' 'r-tidyverse=1.1*' 'r-shiny=1.0*' 'r-rmarkdown=1.8*' 'r-forecast=8.2*' 'r-rsqlite=2.0*' 'r-reshape2=1.4*' 'r-nycflights13=0.2*' 'r-caret=6.0*' 'r-rcurl=1.95*' 'r-crayon=1.3*' 'r-randomforest=4.6*' 'r-htmltools=0.3*' 'r-sparklyr=0.7*' 'r-htmlwidgets=1.0*' 'r-hexbin=1.27*' && conda clean -tipsy && fix-permissions $CONDA_DIR && fix-permissions /home/$NB_USER" did not complete successfully: exit code: 1

At least in my case, R is not needed so I have modified the Dockerfile.

# Jupyter image w/ Python
FROM jupyter/scipy-notebook

LABEL maintainer="Insights"

USER root

WORKDIR /data

COPY server.crt /etc/ssl/certs/
COPY server.key /etc/ssl/certs/

# uncomment to copy data to the container
COPY /data/* /data/

USER $NB_UID

# install the kernel gateway, arcgis Python API, geopandas, msgpack, shapely, and requests
RUN pip install --quiet jupyter_kernel_gateway==2.1.0 arcgis geopandas msgpack shapely requests

# environment settings for kernel gateway
ENV KG_ALLOW_ORIGIN='*'
ENV KG_LIST_KERNELS='True'

# run kernel gateway on container start, not notebook server
EXPOSE 9999

# set tls (https) on the kernel gateway
CMD ["jupyter", "kernelgateway", "--KernelGatewayApp.ip=0.0.0.0", "--KernelGatewayApp.port=9999", "--KernelGatewayApp.allow_credentials='*'", "--KernelGatewayApp.allow_headers='*'", "--KernelGatewayApp.allow_methods='*'", "--KernelGatewayApp.certfile=/etc/ssl/certs/server.crt", "--KernelGatewayApp.keyfile=/etc/ssl/certs/server.key"]

I rebuild the Docker image, and no error messages.

docker build -t insights-gateway .

[+] Building 205.5s (11/11) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.02kB 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/jupyter/scipy-notebook:latest 1.0s => [1/6] FROM docker.io/jupyter/scipy-notebook@sha256:fca4bcc9cbd49d9a15e0e4df6c666adf17776c950da9fa94a4f0a045d5 0.0s => [internal] load build context 0.0s => => transferring context: 4.49MB 0.0s => CACHED [2/6] WORKDIR /data 0.0s => CACHED [3/6] COPY server.crt /etc/ssl/certs/ 0.0s => CACHED [4/6] COPY server.key /etc/ssl/certs/ 0.0s => [5/6] COPY /data/* /data/ 0.1s => [6/6] RUN pip install --quiet jupyter_kernel_gateway==2.1.0 arcgis geopandas msgpack shapely requests 202.3s => exporting to image 2.0s => => exporting layers 2.0s => => writing image sha256:e5fe6b9d09c9e3351cb86ad713959ce633ffc0714d29950f15131ad37598433e 0.0s => => naming to docker.io/library/insights-gateway 0.0s

What's Next? View summary of image vulnerabilities and recommendations → docker scout quickview_

I start the Kernel Gateway.

docker run -p 9999:9999 insights-gateway

[KernelGatewayApp] Jupyter Kernel Gateway at https://0.0.0.0:9999

The container is created in Docker.

But when accessing.

http://localhost:9999/
https://localhost:9999/
http://server.domain.name:9999/
https://server.domain.name:9999/
http://10.1.1.2:9999/
https://10.1.1.2:9999/

I should receive a response in JSON.
{"reason": "Not Found", "message": ""}

But in this case, I have the log in Docker.

[KernelGatewayApp] Jupyter Kernel Gateway at https://0.0.0.0:9999
[W 240319 16:05:05 iostream:1382] SSL Error on 8 ('172.17.0.1', 49888): [SSL] internal error (_ssl.c:1006)
[W 240319 16:05:05 iostream:1382] SSL Error on 9 ('172.17.0.1', 49890): [SSL] internal error (_ssl.c:1006)
[W 240319 16:05:05 iostream:1382] SSL Error on 8 ('172.17.0.1', 49892): [SSL] internal error (_ssl.c:1006)
[W 240319 16:05:05 iostream:1382] SSL Error on 9 ('172.17.0.1', 49894): [SSL] internal error (_ssl.c:1006)
[W 240319 16:05:06 iostream:1382] SSL Error on 8 ('172.17.0.1', 49896): [SSL] internal error (_ssl.c:1006)
[W 240319 16:05:06 iostream:1382] SSL Error on 9 ('172.17.0.1', 49898): [SSL] internal error (_ssl.c:1006)

Any idea / recommendation to solve the issue?

Regards.

cannot setup the gateway - error installing rpy2 with conda

This is what I get:

SpecsConfigurationConflictError: Requested specs conflict with configured specs.
requested specs:
- rpy2=2.8
pinned specs:
- python=3.7
Use 'conda config --show-sources' to look for 'pinned_specs' and 'track_features'
configuration parameters. Pinned specs may also be defined in the file
/opt/conda/conda-meta/pinned.

NameError: name '__get_column_types' is not defined

hi there,

I am using the magic command %insights_return(df) to add an Pandas dateframe but I received this error after running the cell:
NameError: name '__get_column_types' is not defined

What am I doing wrong?

Thanks very much

WebSocket connection failed: Error during WebSocket handshake

When use the container option, it fails to connect from Insights, while the anaconda option works.

I compared the two options, and found the cause:

The version of the jupyter gateway in anaconda is 2.1.0 , but in the pip repository, the version is 2.4.0, which will be installed when building the docker image.
So change the dockerfile to force pip to install gateway 2.1.0, it will be working.

Unable to use Insights data or bring in data from Jupyter Kernel Gateway to Insights

Hi,

I'm trying to set up the scripting environment for Insights desktop, I followed the instructions in the scripting guide but when I try to connect o the Python kernel I get the message "Unable to use Insights data or bring in data from Jupyter Kernel Gateway to Insights. One or more libraries are missing from your Jupyter Kernel Gateway. Review the ArcGIS Insights Scripting Guide for more information". I checked that the dependencies are all installed, but I keep getting the same message. When I try to connect to the R kernel is all good however. Do you know what might be going on?

Thank you!

The ubuntu container won't handle windows authentication

My ArcGIS Enterprise is using Integrated Windows Authentication, it seems the python gateway container can't handle the windows authentication, as a result, it can't access the data sources from the ArcGIS Enterprise (Portal).

It does sound odd to let a Linux container handle windows authentication... but I am no expert in this area.

Are there any work around for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.