Select to view content in your preferred language

How to add the Arcpy module to the Spyder ? #python3.7

10913
5
Jump to solution
11-07-2019 11:28 PM
OrkhanAbdullayev
Occasional Contributor

Hello.

I have an issue with the arcpy module to run standalone scripts.

I have installed the latest version of ArcGIS Pro and ArcMap desktop.

Also, installed the latest version of Spyder (Anaconda)(64-bit,python3.7).

I have tested "import arcpy" and it says ***ModuleNotFoundError: No module named 'arcpy' ***

Had some search on the internet how to add the arcpy module to the spyder but could not fix it. (by browsing the path of python folder)

please, can you help me to figure out how it works?

note: as I know if I have ArcGIS pro I can use Python 3.7, not 2.7 (attached, how my python folder looks like)

#python-package#arcpy scripting#spyder#arcpy scripting

0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

I know I have come late to the conversation, but I very recently had to install spyder so I decided to create a mini-blog with a step-by-step guide to help future users, it is here.

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

You should have used the conda distribution that comes with ArcGIS Pro which is 'pinned' to python 3.6.  You probably tried to download anaconda for python 3.7 from the anaconda site which isn't going to be the same as the distribution that came with Pro.  A number of packages won't work with that distribution... arcpy is one.

The solution is to completely remove all vestiges of what you have done and install spyder in a clone or in the default esri distribution if you have full administrator rights.  Skip python 3.7 for now (I have looked into this BTW)

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

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

OrkhanAbdullayev
Occasional Contributor

Thank you Dan, I want to ask about ArcMap desktop for 10.3-10.7 versions, can I use spyder for this also? if yes, how?

(ArcGIS pro, I tried and it is working, but most of the codes that I found is for python 2.7)

great thanks for your valuable information

0 Kudos
DanPatterson_Retired
MVP Emeritus

I don't use arcmap anymore, but when I did, I used python 3.  For the most part, you just need to be careful that 'print' is now different but it can be handled with … from __future__ import print_statement, division

and a few others

What is __future__ in Python used for and how/when to use it, and how it works - Stack Overflow 

There a few differences in arcpy between arcmap and ArcGIS pro, but they can be readily caught using the code snippets in the 10.x and Pro help files.

It would be a pain to set up another installation... however, you can set up spyder to run different pythons... refer to their website, I just never tried it 

0 Kudos
DuncanHornby
MVP Notable Contributor

I know I have come late to the conversation, but I very recently had to install spyder so I decided to create a mini-blog with a step-by-step guide to help future users, it is here.

OrkhanAbdullayev
Occasional Contributor

I had followed the mentioned guide by you and it works well. Thank you.