0

I have cloned the default python env that installs with ArcGIS Server using conda create in the python command window using:

conda create --clone arcgispro-py3 -p"C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\py3_envclone2"

I activated the cloned env and installed jenkspy

(py3_envclone2) C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\py3_envclone2>conda install -c conda-forge jenkspy
Fetching package metadata ...............
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\py3_envclone2:
#
jenkspy                   0.2.0            py37hcc03f2d_1    conda-forge

I then spun up the python console using python.exe in command window and then tested imports of my modules without fail:

>>> import arcpy
>>> import jenkspy
>>> import json
>>> import arcgis
>>>

However, when I run from my script:

# need to call pyhton from the environment where ArcGIS allows third party library installs to access all the necessary modules in the script

import sys
    
sys.path.append(r'C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\py3_envclone2')
    
# import remaining modules
    
import arcpy, json, jenkspy, arcgis

I get this error:

Traceback (most recent call last): File

"C:\Desktop\MyScript.py", line 10, in <module>
    import arcpy, json, jenkspy, arcgis
ImportError: No module named jenkspy

What am I doing wrong?

6
  • I think you should remove the try from the code that you present so that we can see the error message and line number that it is coming from. Also, the error seems to be coming from your from arcgis import GIS so to simplify the code that you present, I think you should use a single import arcgis (and nothing else) in the code that you present.
    – PolyGeo
    Aug 9, 2022 at 23:40
  • 1
    Remove sys.path.append from script and then activate your clone before running the script.
    – user2856
    Aug 10, 2022 at 0:07
  • @PolyGeo made the changes you suggested and updated post. Now getting import eror on jenkspy and I assume I would get the error on arcgis subsequently.
    – geoJshaun
    Aug 10, 2022 at 17:37
  • @user2856 removed sys.path.append after activating library and still got the import error (see edited post). Even if this had worked it probably wouldn't be the right solution for me as I need this to run on a scheduled batch.
    – geoJshaun
    Aug 10, 2022 at 17:39
  • 2
    And make sure you are using the python exe in your env, i.e C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\py3_envclone2\python.exe
    – user2856
    Aug 10, 2022 at 22:33

0

Your Answer

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