PYTHON - No Module named gis

6933
9
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 Emeritus

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

9 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 Emeritus

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
sgharehchahi_jaxstate
New Contributor

Add this first: from arcgis.gis import GIS‍‍

0 Kudos
swang
by
New Contributor

Hello all - I have a similar issue that is hard to make sense to me.  

1. I installed Python 3.9.13 and then installed ArcGIS API for python by using pip install arcgis

2. the test codes works fine with python environment

3, but the same codes does not work in visual studio 2022, saying No module named 'arcgis.gis'; 'arcgis' is not a package

4.the same test codes work in python interpreter in visual studio 2022

5. Had used the same way installed many other packages such as Qt, pandas, all works fine in Visual Studio 2022.  But ArcGIS API for Python failed.

Really appreciate any idea.

Thanks,

Shquing

works in python interpreter in visual studio 2022works in python interpreter in visual studio 2022

works in python interpreterworks in python interpreterdoes not work in visual studio 2022does not work in visual studio 2022

 

0 Kudos
swang
by
New Contributor

it also works fine in Jupyter

0 Kudos
JeffGawrych
New Contributor

I am using IBM Watson Studio and using python 3.9 and no notebooks/jobs have completed since 1/9 due to the error. Anyone know a fix?

No module named 'geomet.esri'

 

0 Kudos