Since you’re using the ArcGIS Python interpreter, you’ll have to refer to the documentation for ArcGIS Pro, e.g. https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/add-a-package.htm
Since you’re using the ArcGIS Python interpreter, you’ll have to refer to the documentation for ArcGIS Pro, e.g. https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/add-a-package.htm
I have a clone of my ArcGIS Python Interpreter with the extra libraries, which i use for my non FME Python scripts. There i can import and use pymssql but i am not able to tell FME Server to use this clone.
I read with a loop and sys.path all paths and the paths are:
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\python37.zip
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\DLLs
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages
C:\Program Files\ArcGIS\Pro\bin
C:\Program Files\ArcGIS\Pro\Resources\ArcToolbox\Scripts
C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\future-0.18.2-py3.7.egg
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\pytz-2020.1-py3.7.egg
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\win32
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\win32\lib
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\Pythonwin
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\pywin32_ctypes-0.2.0-py3.7.egg
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\pywin32security
D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\lib\site-packages\sympy-1.5.1-py3.7.egg
Then with sys.append(...) i add all of the listed paths in my FME shutdownscripts but i am not able to import pymssql in the startup/shutdown scripts.
You’ll have to specify the ArcGIS Python interpreter in the workspace itself:
https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Workbench/Python-Compatibility.htm
Simply adding to sys.patht] is most probably not going to work.
You mean under Workspace Parameters\Scripting\Python Compatibility?
I already tried all modes.
i can import arcpy, but when i try to add pymssql i get the error:
60 2024-4-16 13:50:23 | Python Exception <ModuleNotFoundError>: No module named 'pymssql._pymssql'
61 2024-4-16 13:50:23 | Traceback (most recent call last):
62 2024-4-16 13:50:23 | File "<string>", line 37, in input
63 2024-4-16 13:50:23 | File "D:\Apps\PYScripts\ArcGISPro_Environments\arcgispro-py3-processingserver\Lib\site-packages\pymssql\__init__.py", line 3, in <module>
64 2024-4-16 13:50:23 | from ._pymssql import *
65 2024-4-16 13:50:23 | ModuleNotFoundError: No module named 'pymssql._pymssql'
But when i run a python script in pycharm and load pymssql it works, so it is in this directory and it is properly installed.
I assume that ArcPython is still a regular Python inside.
We’ve had success in expanding the availables standard libraries with QGIS by utilizing the standard Python APPDATA (roaming) locations, e.g. %APPDATA%/Python/Python39 (for 3.9.x) and %APPDATA%/Python/Python312 (for 3.12), to store extra modules (pythonnet in our case).
Just install them normally in a site-packages subfolder.
Maybe this’ll work for ArcPython too ?