AnsweredAssumed Answered

Can't import arcpy within Flask

Question asked by HOKis on Oct 7, 2020
Latest reply on Oct 19, 2020 by HOKis

Hi,

 

I set up FastCGI in IIS and got the HelloWorld.py working properly. I also cloned conda env with Python-Package-Manager inside ArcGIS Pro for installing further 3rd party packages like pyodbc, etc. Inside my Flask.app I can't import arcpy, though all necessary paths are listed in sys.path. Everything I get is 500 Internal Server Error, nothing else.

 

I think I have to activate the conda environment, right?

I can successfully import arcpy within a standalone script and run it in VS Code Terminal. There, it seems to activate the conda environment BEFORE running the script. I see <PYTHONPATH>/activate.bat in the Terminal. It also works per cmd. So my question is, how do I activate the conda env before running the flask script?

 

Is there another way to use arcpy from arcgis pro with flask?

 

Any help is appreciated.

 

Andre

Outcomes