Select to view content in your preferred language

Packaging arcgis python library into an executable

617
4
Jump to solution
10-31-2023 03:49 PM
ArcDevelopment
Emerging Contributor

Has anyone managed to bundle the arcgis(v2.2.0) python library into an executable? I've found that this code runs fine as separate python files but once bundled with pyinstaller into a .app file ends up in a crash on the first use of the library 

 

https://pypi.org/project/arcgis/ 

Error: 

`ModuleNotFoundError: No module named 'arcgis.gis._impl._portalpy'`

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DavidSolari
Frequent Contributor

If pyscripter doesn't pick up on an import (pretty common with complex libraries like arcgis) you'll have to tweak the hidden imports for your build. Start with something high up in the import path (e.g. "arcgis.gis") and then get more specific until it works.

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

It isn't designed to be included in an executable.  It is designed to run in a python environment


... sort of retired...
0 Kudos
DavidSolari
Frequent Contributor

If pyscripter doesn't pick up on an import (pretty common with complex libraries like arcgis) you'll have to tweak the hidden imports for your build. Start with something high up in the import path (e.g. "arcgis.gis") and then get more specific until it works.

EarlMedina
Esri Regular Contributor

There's probably a lot in the API you just don't need that will add a lot size and introduce a few problems. I would consider the pieces you actually a need and maybe write something custom (if it's going to get repeated use) or else see how far you can get with the --no-deps option when installing.

ArcDevelopment
Emerging Contributor

Had some luck with just importing the offending 'arcgis._impl' import into my app but yes if we had more time something more tailored would likely be the best approach 

0 Kudos