cga-wm / advgis-beta

This is Advanced GIS at W&M - beta version.
0 stars 0 forks source link

Exercise 2: import arcpy #17

Open eosinski opened 4 years ago

eosinski commented 4 years ago

I've tried running this in Spyder and Atom but both result in a "ModuleNotFoundError"

Has anyone run into the same issue or perhaps know how to fix it?

dt-woods commented 4 years ago

I'm guessing the issue is with arcpy? This module is only available through ArcGIS. You can "hack" into the same Python environment that ArcGIS Pro uses by following these steps:

https://cga-wm.github.io/resources-how-to-hack-arcpro-python.html

Or you can just run the example using ArcGIS Notebooks (just save a copy and Run the code cells).

Steranso commented 4 years ago

Do you have a suggestion for what to do if those steps do not work? Specifically if the error is "Failed to create environment"

dt-woods commented 4 years ago

Can you take a screenshot of that error and post it?

dt-woods commented 4 years ago

Potential solution: run ArcGIS Pro as Administrator

parthree commented 4 years ago

I'm having the same problem and having no luck with the solutions. I opened Pro as Administrator and it still Failed to Create Environment. image

dt-woods commented 4 years ago

Oh geeze. It looks like the path is the issue and because you have ArcGIS Pro installed system wide (i.e., it's in Program Files), the space in the folder name is unavoidable.

  1. You could reinstall ArcGIS Pro locally, which will put it into C:\Users[username]\AppData\Local\Programs\ArcGIS\Pro

    One problem may occur if your username has spaces, e.g. "Ty's PC". In this case, create a new folder (C:\Esri) and install it there.

  2. Try using Start Menu > ArcGIS > Python Command Prompt (see Using the API)