5

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?

7

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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