Import Arcpy Module Failing - PyScripter

1.7k Views Asked by At

I am trying to use PyScripter however I can import certain modules however I am unable to successfully import the arcpy library.

I have tried configuring the Environment Variables PYTHONPATH without any success. I know I'm missing something with the the correct path to the python executable.

Thanks for your assistance in advance

The Desktop10.8pth references the following

C:\Program Files (x86)\ArcGIS\Desktop10.8\bin
C:\Program Files (x86)\ArcGIS\Desktop10.8\ArcPy
C:\Program Files (x86)\ArcGIS\Desktop10.8\ArcToolBox\Scripts

Pyscripter is returning the following

import arcpy

ModuleNotFoundError: No module named 'arcpy'

IDLE Shell is returning Traceback (most recent call last): File "<pyshell#0>", line 1, in import arcpy ModuleNotFoundError: No module named 'arcpy'

Enviromental Varibles Program Files 86 to ArcGIS

Pyscripter Path

Pyscripter Path Additional

Python Structure Python27

1

There are 1 best solutions below

0
Terry Jan Reedy On

The message ModuleNotFoundError: No module named 'arcpy' comes from whatever pythonx.y you are running. Do you have more than one python installed on your system? If so, the common error is to install something for one python and try to import it with another.

What you call the 2.7 structure shows Python39-32. Does arcpy run with that version?

If you are trying to run arcpy with python x.y, the pythonx.y directory Lib/site-packages/ must contain the arcpy package or a .pth file pointing to its location. Is Desktop10.8pth a typo version of Desktop10.8.pth. If so, then one of the directories, most likely the one ending in ArcPy must contain either an arcpy package directory or an arcpy.py file.