6

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

8

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.

2
  • Ahhh unfortunately, it is relying on C libraries :( Commented Jun 1, 2017 at 20:07
  • 1
    stackoverflow.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. Commented Jun 2, 2017 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.