Can't import arcpy within Flask

716
1
10-07-2020 06:25 AM
StabsstelleGIS
New Contributor III

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

0 Kudos
1 Reply
StabsstelleGIS
New Contributor III

Solved the problem with the help of this post https://community.esri.com/thread/260581-are-wfastcgi-python-api-compatible#comment-956114

Problem was with NTFS-Permissions.

0 Kudos