1

We are trying to automate the upload of shapefiles to ArcGIS Online using a Python script. This script will need to run on a (virtual) computer that does not have an ArcGIS Pro installation. We have a username and password which can be used to log into ArcGIS Online.

We have a Python script which takes four arguments: username, password, url to ArcGIS Online map, and path to the zipped shapefile to be uploaded. This script works when run on a PC with ArcGIS Pro installed, using the Python libraries stored inside the ArcGIS Pro account.

How can we run this script on a PC that does not have ArcGIS Pro? We have tried:

  • Installing the ArcGIS packages in a Python 3.7 environment set up in Anaconda Navigator, following these instructions: https://support.esri.com/en/technical-article/000022005. This returns a variety of "package conflicts" and does not install the required packages.
  • Copying the Python environment folder from the computer with ArcGIS Pro into the Anaconda Navigator envs folder on a computer without ArcGIS Pro. When we run the script using this copied environment, we get the Traceback error "ImportError: Unable to locate a valid Pro or Server installation to use with ArcPy...". Curiously, the shapefile is still uploaded to our account.

Is it possible to run a Python script to upload shapefiles to ArcGIS Online without having an installation of ArcGIS Pro?

4
  • 2
    At a minimum, you need the ArcGIS API for Python installed. Instead of asking how to do this without the API, the Question should be focused on the errors you receive when attempting install.
    – Vince
    Commented Jan 18, 2022 at 14:48
  • If you have a legitimate login into ArcGIS Online why not simply install arcpro into your virtual PC then you'll have the full power of arcpy and the ArcGIS python API? If you have a Login you must have access to MyESRI and the ability to download ArcPro or someone does in your organisation...
    – Hornbydd
    Commented Jan 18, 2022 at 16:37
  • We are setting up a system for a client - they use ArcPro, and we need to automate the upload of shapefiles into their ArcGIS Online account. We have a legitimate login to upload the shapefiles, but would prefer not to install all the extra software on our PC that is doing processing that otherwise has nothing to do with ArcGIS Pro (shapefiles are made using other software)...
    – Nena
    Commented Jan 18, 2022 at 18:26
  • Remote into your client machine and execute your code from there taking advantage of their installation? Just an idea.
    – Hornbydd
    Commented Jan 18, 2022 at 23:41

1 Answer 1

1

It seems likely your code requires the ArcGIS Python API. (This is included with ArcGIS Pro's Python). As long as your code does not require anything arcpy, you can migrate your code and workflow to a computer without ArcGIS Pro (thus no Arc* license required). You only need to satisfy the minimum requirements of the ArcGIS Python API. However, if your code calls arcpy, then it's simply impossible to run your script somewhere without either ArcGIS Pro or ArcGIS Server. You cannot just copy the contents of the Python folder on an ArcGIS machine and expect it to work somewhere else. Please abandon this idea, it'll never work properly.

The basic steps you want to follow are in the ArcGIS Python API setup help.

The easiest way is to install Python 3.x+ and Anaconda. You'll note the conda install explanation from the help. Basically, from your Conda command prompt: conda install -c esri arcgis This might be the best path forward for you as you've mentioned you setup Anaconda elsewhere.

If you don't want to use Conda, you can still get all the pieces you need be installing Python 3.x+ (note actual version requirements from the help), and then do a pip install arcgis. This should pull down and install all the Python API requirements at the same time.

3
  • rather than linking to the solution, it is best to add the solution to the answer. Commented Aug 25, 2022 at 14:54
  • Agree to disagree. I'm not going to re-write a bunch of steps from a help topic that includes images and better formatting than I can do here.
    – KHibma
    Commented Aug 26, 2022 at 15:46
  • Thanks, I ended up doing something along these lines, but following exactly these step-by-step instructions: support.esri.com/en/technical-article/000022005. The package conflicts I mentioned in my first bullet didn't occur on a new virtual machine, so those conflicts were related to some existing anaconda/python installation problems.
    – Nena
    Commented Dec 6, 2022 at 12:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.