I wrote a Python Toolbox that uses libraries not included in ESRI's python (PIL, piexif).
But I can't run the toolbox on another computer that doesn't have those libraries. Since I don't want to install those libraries for every client that will be using the toolbox, is there a way to package the libraries with the toolbox to avoid any missing dependencies?
1 Answer 1
With pure Python packages you can simply place their module folders (cloned from git or wherever) into the same folder as your script files, and then in the properties for your tool check the box to access the scripts using relative paths (i.e. don't import them into the toolbox).
An example folder structure might be:
my_special_tools\
scripts\
third_party_module\
...
my_script.py
my_special_toolbox.tbx
Then you can distribute that entire folder to others.
However 3rd party packages that rely on C libraries have to actually be built, so unfortunately they can't be included this way. In this case it's probably easiest just to write a bat file that pip installs the necessary dependencies.
-
Ahhh unfortunately, it is relying on C libraries :(TurboGraphxBeige– TurboGraphxBeige2017年06月01日 20:07:28 +00:00Commented Jun 1, 2017 at 20:07
-
1stackoverflow.com/a/32992714/7209558 try to build it and place it in a known location inside your toolbox folder. Then append a path to this module to sys.path and import it.Serge Norin– Serge Norin2017年06月02日 14:44:10 +00:00Commented Jun 2, 2017 at 14:44