Is Python a nightmare when working with ArcGIS Pro?

744
3
04-22-2019 09:50 PM
Raza_Muhammad
New Contributor II

I am new to Python. Recently I had used Random Forest in ArcGIS Pro, but I wanted to use it directly using the Scikit-learn library. As I am new, so I started with Seagrass prediction tutorial to understand how the codes work.

When I use the built-in Python interface in ArcGIS Pro, it gave an error for the Scikit-learn library as it couldn’t find the package. I downloaded the Jupyter notebook and tried the initial libraries importing codes, given in the tutorial, but then the Arcpy package wasn’t found.

I have spent the last three days only resolving errors but in vain. I have tried almost every solution that I could find on webpages or blogs, but nothing worked.


Am I making some basic mistake or Python is perhaps a nightmare when working with ArcGIS Pro? Any help to resolve this basic issue would be appreciated.

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

I didn't see mention of your cloned environment, but the inability to find scikit then arcpy suggests you haven't set up your environment as a clone via the instruction here

Python Package Manager—ArcPy Get Started | ArcGIS Desktop 

or more generally

/blogs/dan_patterson/2018/12/28/clone 

If you intend to work with other packages make sure your environment is set up correctly.  Using 'conda' is usually the easiest if you are familiar with command line

0 Kudos
Raza_Muhammad
New Contributor II

Hi Dan

I have tried it already. But every time the cloning process fails to create a new environment. And for the default clone, it's taking forever to complete the processing.

0 Kudos
HannesZiegler
Esri Contributor

Hey Raza, seems something is off with the state of your Pro install. Before trying an uninstall/reinstall, can you check what is returned when you (from the Python Command Prompt installed with ArcGIS Pro) run the following:

conda env list

You may find that there are a lot of conda environments in that list from failed attempts, try removing all but arcgispro-py3 using the following (do this for each of the bad environments):

conda env remove --name <bad_env> --all

Managing environments — conda 4.8.2.post14+e9a50561 documentation 

Then run conda proswap --name arcgispro-py3 and close the cmd window.

Open up pro and confirm that the current environment is set to arcgispro-py3

Check %localappdata%\ESRI\conda\envs and make sure there's nothing in there except proenv.txt. Open proenv.text and make sure that the path is the path\to\your\arcgispro-py3.

Also open the registry editor (press windows key then type regedit and open "Registry Editor") and make sure that HKEY_CURRENT_USER\Software\ESRI\ArcGISPro\PythonCondaEnv is set to path\to\your\arcgispro-py3.

Go back to the Python backstage in ArcGIS Pro and try cloning again.

0 Kudos