Import arcpy (Py2.7.16 x32Arc107) or arcgis (Py3.6.2-x64Pro)

322
3
Jump to solution
11-20-2019 03:38 PM
Highlighted
New Contributor III

dear Readers,

thanks for taking the time to read through my question.  I am trying to start with a sample code with python script.

Question:

  1. Which python interpreter should be used 2.7.x (32 bit) that came with ArcGIS 10.x (6 or higher) or Py 2.7 (x64)?
    1. will import arcpy work on that? 
    2. I am unable to import ArcGIS module or use 'from ArcGIS.gis import GIS'
  2. if I make ArcGIS module work by changing it to 3.6.2 (conda) version then my arcPy goes away.

I have both ArcGIS pro and ArcGIS desktop advanced suite running on my workstation and virtual machine.  yes, I am beginner in Python but many years experience with ESRI objects and 'ArcObjects'.

any documentation or guidance would be great.

thanks for your help.

regards

ravi kaushika

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

Whether you clone or not, you will have to install or associate a python IDE with ArcGIS Pro

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

/blogs/dan_patterson/2019/06/28/arcgis-pro-24-installation-package-updates-and-installs 

/blogs/dan_patterson/2018/07/01/arcgis-pro-your-conda-environments 

And I prefer spyder for my python IDE whether in the base environment or in a clone.

I also have Jupyter console, Jupyter Notebook, JupyterLab and PythonWin installed and running

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

And yes... leave ArcMap and python 2.7, 

Python 3 is almost 10 years old and 3.9 is in development.  Current ArcGIS Pro version (2.5 beta) is python 3.6.9

View solution in original post

3 Replies
Highlighted
Occasional Contributor III

Hey Ravi,

In your title you ask about (Py2.7.16 x32Arc107) or arcgis (Py3.6.2-x64Pro). Python 2.7 will no longer be getting updates, bug fixes or security fixes as of 1 Jan 2020. (Python 2.7 Countdown ) So my first recommendation for someone getting started with python is Python 3.

If you open up ArcGIS Pro and Click on Project in the toolbar then Click Python you can see where ArcGIS Pro installs its version of Python.  There is lots of information here Python in ArcGIS Pro—ArcPy Get Started | ArcGIS Desktop 

If you run this version of python you will be able to 'import arcpy' and 'from ArcGIS.gis import GIS' (This won't work due to the case sensitivity of python! Use from 'arcgis.gis import GIS' instead!)

Good luck with python, its one of my favorite programming languages as it simplifies a lot of things!

Thanks

Ben

Highlighted
New Contributor III

Ben,

Sorry, I could not mark your answer correct. I made it helpful and liked.

thanks for the prompt reply.

regards

ravi.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Whether you clone or not, you will have to install or associate a python IDE with ArcGIS Pro

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

/blogs/dan_patterson/2019/06/28/arcgis-pro-24-installation-package-updates-and-installs 

/blogs/dan_patterson/2018/07/01/arcgis-pro-your-conda-environments 

And I prefer spyder for my python IDE whether in the base environment or in a clone.

I also have Jupyter console, Jupyter Notebook, JupyterLab and PythonWin installed and running

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

And yes... leave ArcMap and python 2.7, 

Python 3 is almost 10 years old and 3.9 is in development.  Current ArcGIS Pro version (2.5 beta) is python 3.6.9

View solution in original post