2

I have ArcGIS API for Python installed and when I use below line, am getting error as

ModuleNotFoundError: No module named arcgis

from arcgis.gis import GIS

Please refer to Imagec

3
  • How did you install arcgis? Do you have different Python installations on your machine? Also, when pasting errors or code on this page I recommend you paste the text and format the code using the { } button rather than pasting images. Aug 20, 2019 at 15:45
  • look at this community.esri.com/thread/…
    – Fran Raga
    Aug 20, 2019 at 15:46
  • Which product are you using? Python with arcgis pro is anaconda based and Python is 3.6. Also you have to Start pyscripter with a batch File, activating the anaconda Environment. Aug 21, 2019 at 6:06

1 Answer 1

2

When using PyScripter with arcgis pro you should call the IDE with a batch script, to activate the anaconda environment. There are batch files shipped with arcgis pro which i use to call PyScripter:

@echo off
set pyhome=%PROGRAMFILES%\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
set pyscrpt=%~pd0\PyScripter\PyScripter.exe

if not exist "%pyhome%" (
    echo Can't find "%%pyhome%%". Can't start PyScripter.
    pause
    goto eof
)

if not exist "%pyscrpt%" (
    echo Can't find "%%pyscrpt%%". Can't start PyScripter.
    pause
    goto eof
)

call "%PROGRAMFILES%\ArcGIS\Pro\bin\Python\Scripts\activate"
start "PyScripter" "%pyscrpt%" --PYTHON36 --pythondllpath="%pyhome%"

So in the first two lines (after the @echo off) I declare the locations (directories) as variables. They have to match your own installation, of course

  • The first (%pyhome%) defines the Python directory, which comes with arcgis pro
  • The second (%pyscrpt%) is the path to the PyScripter executable: pysripter.exe

I run PyScripter with start and the given commandline options to use the correct python version and path. Currently this is Python3.6.

Screenshot of PyScripter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.