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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 1, 2017 at 18:45

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.

answered Jun 1, 2017 at 19:24
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.