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
Solved! Go to Solution.
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.
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.
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.
I have the same error as @ModernElectric but the conda list also brings up an error (SyntaxError).
I am relatively new to using Python is there a step I am missing?
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?
It is the Jupyter notebook that was installed with Pro
Add this first: from arcgis.gis import GIS
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 2022
works in python interpreter
does not work in visual studio 2022
it also works fine in Jupyter
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'