PYTHON - No Module named gis

2525
5
Jump to solution
08-25-2020 09:28 AM
ModernElectric
Occasional Contributor III

I recently downloaded the Python Script - "Overwrite Hosted Feature Service" to update ArcGIS Online from ArcGIS Pro. I have been using Python Script(s) to update the data from ArcMAP, but starting to use ArcGIS Pro alot more for a variety of reasons. 

Trying to run this script thru Python 2.7.13 IDLE and keep getting this error:

   ImportError: No module named GIS.

Is there a way to correct this or is there a different script that I can download and run to update ArcGIS Online from ArcGIS Pro thru Python IDLE and using Window's Task Scheduler?

Thank You

0 Kudos
1 Solution

Accepted Solutions
JoeBorgione
MVP Esteemed Contributor

You'll need to run the script in a python environment that was set up in ArcGIS Pro, which deploys python 3.x as well as the ArcGIS Python API.  The GIS module is within the API not Arcpy.

From How To: Overwrite hosted feature services from ArcGIS Pro to ArcGIS Online using Python :

It is possible to overwrite a hosted feature service using the arcgis.gis.module as a workaround. The module is used to overcome the known limitation of the ArcPy module, with ArcGIS Online credentials in a Python script. The Python script allows the process to be automated. However, Python 3, which is included in an ArcGIS Pro installation, is required.

Check these out:

https://developers.arcgis.com/labs/?product=python&topic=any

ArcGIS API for Python | ArcGIS for Developers 

Download data | ArcGIS for Developers 

Many if not all of the tutorials will have you working in a notebook, but you can really use any IDE you wish.

That should just about do it....

View solution in original post

5 Replies
JoshuaBixby
MVP Esteemed Contributor

You answer your own question, i.e., "trying to run this script thru Python 2.7.13 IDLE..."  ArcGIS Pro is bundled with Python 3, so if you are using Python 2.7.13 IDLE, it means you are running the code from some other Python 2 distribution on the machine.  Make sure you open the right IDLE application.

0 Kudos
JoeBorgione
MVP Esteemed Contributor

You'll need to run the script in a python environment that was set up in ArcGIS Pro, which deploys python 3.x as well as the ArcGIS Python API.  The GIS module is within the API not Arcpy.

From How To: Overwrite hosted feature services from ArcGIS Pro to ArcGIS Online using Python :

It is possible to overwrite a hosted feature service using the arcgis.gis.module as a workaround. The module is used to overcome the known limitation of the ArcPy module, with ArcGIS Online credentials in a Python script. The Python script allows the process to be automated. However, Python 3, which is included in an ArcGIS Pro installation, is required.

Check these out:

https://developers.arcgis.com/labs/?product=python&topic=any

ArcGIS API for Python | ArcGIS for Developers 

Download data | ArcGIS for Developers 

Many if not all of the tutorials will have you working in a notebook, but you can really use any IDE you wish.

That should just about do it....
SharonUngerer_DNREC
New Contributor II

I have the same error as @ModernElectric but the conda list also brings up an error (SyntaxError).  

SharonUngerer_DNREC_0-1625142909227.png

 

SharonUngerer_DNREC_1-1625142935831.png

I am relatively new to using Python is there a step I am missing? 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

You provided a screenshot of a Jupyter notebook, is that the Jupyter that gets installed with Pro or do you possibly have other Python distributions on your machine that have Jupyter included too?

SharonUngerer_DNREC
New Contributor II

It is the Jupyter notebook that was installed with Pro

0 Kudos