Python 3.6 tries to initialize with Python 2.7

2770
24
Jump to solution
04-03-2019 12:17 PM
MarkBinder
Occasional Contributor

I am having some major Python issues. When I try to start PyCharm using the ArcGIS Pro Python environment it tries to initialize using the Python 2.7 ArcGIS 10.6 installation. Somehow my Python installations got crossed up.

I've tried uninstalling ArcGIS Pro and reinstalling it but that has no effect.

Is there any way to solve this?

0 Kudos
24 Replies
curtvprice
MVP Esteemed Contributor

All non-ArcGIS pythons should be able to be removed from a Windows box using Add Remove Programs. Removing ArcGIS will remove all the Esri Python installs, they are "attached" to the desktop uninstall process. 

Be sure after all the pythons are gone you don't have any left over references in your system and user variables PATH and PYTHONPATH.

To be more efficient I would have recommended removing all Python software you see (including Anaconda, PyCharm etc) from Add/Remove programs and then doing a repair install of ArcGIS, but whatever works.

0 Kudos
MarkBinder
Occasional Contributor

Do it turns out if I uninstall ArcGIS Desktop then Python 3.6 works. If I reinstall ArcGIS Desktop then PyCharm and Spyder try to use the Python 2.7 installation.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Just use spyder... you can use it for python programming in 2.7 and 3.6.  Worse case scenario you can install a separate spyder for arcmap.  There are a number of tips on how to use spyder for both and switch between them.

For example 

How to change python version in anaconda spyder - Stack Overflow 

0 Kudos
MarkBinder
Occasional Contributor

Unfortunately if I have Python 2.7 installed then my Python 3.6 installation tries to initialize with 2.7.

0 Kudos
DylanHarwell
Occasional Contributor

How are you installing Spyder? I'm thinking this could have something to do with it.. I would recommend doing a conda install from the 'arcgispro-py3' command prompt.

Dan has some awesome blog posts about using Spyder and Python 3. 

0 Kudos
MarkBinder
Occasional Contributor

That is how I installed Spyder; I have since uninstalled Spyder and ArcGIS Desktop.

0 Kudos
MarkBinder
Occasional Contributor

Do I need to edit something in the sys.path or someplace else?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Mark, depends on whether you are the master of your machine

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

plus some other tidbits

/blogs/dan_patterson/2018/12/13/spyder 

0 Kudos
DylanHarwell
Occasional Contributor

And I assume you're uninstalling through control panel or an uninstall wizard? It's been a while since I uninstalled Arc on my home computer, but I talked to tech support and was given a list of folder paths to check to make sure everything got removed, and I did find some things hanging around after the uninstall. Might not be a bad idea to also do a search on This PC for things like ESRI, ArcGIS, Python, etc and see what may be there still. Here is the list they gave me:

C:\Program Files (x86)\Esri
C:\Program Files (x86)\Common Files\ArcGIS
C:\Program Files (x86)\Common Files\Esri
C:\Program Files\ArcGIS
C:\Program Files\Esri
C:\Program Files\Common Files\ArcGIS
C:\Program Files\Common Files\Esri
C:\Program Data\Esri
C:\Program Data\ArcGIS
C:\Program Data\FLEXnet
C:\Users\<USERNAME>\AppData\Local\ESRI
C:\Users\<USERNAME>\AppData\Local\ArcGIS
C:\Users\<USERNAME>\AppData\Roaming\ESRI
C:\Users\<USERNAME>\AppData\Roaming\ArcGIS

MarkBinder
Occasional Contributor

Thanks for that list.

I have some control over install/uninstall. I am able to add/remove ArcGIS Desktop 10.6.1 but not ArcGIS Pro 2.3. I have asked the IT department to remove Pro. I'm hoping by removing all ESRI products and Python references I can start over.

0 Kudos