Splunk Search

How to install a custom python library for a app with a lot of dependencies?

ConsoleBotTryPC
Path Finder

Hi,

Hope you'll are having a great day!

Coming to the question: How can I install Python libraries for usage in scripts under an app?

Basically, I have created an external lookup script, and it requires the following modules:
msgraph-sdk, azure-identity

I easily installed them for testing on my local system by using pip. Now I want to make it work on Splunk.

I researched a bit, and pretty much all the solutions mainly say to create a lib folder under etc/apps/<appName>/lib
And then copy and paste the external library folder in there.

The thing is, these libraries have a lot of dependencies with them, which get auto-installed when we do it with pip install.

So my question is, does there exist a more sophisticated and straightforward way to install these large libraries without copy-pasting potentially 100s of libraries?


Any help would be appreciated!


Thank youu,

Best,
Jay

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

This is about PIP install, not Splunk search. (And perhaps more suited for All Apps and Add-ons and Installation forums.)  A little googling shows https://stackoverflow.com/a/2916320/17164801 by Ian Bicking.

Use:

pip install --install-option="--prefix=$PREFIX_PATH" package_name

You might also want to use --ignore-installed to force all dependencies to be reinstalled using this new prefix. You can use --install-option to multiple times to add any of the options you can use with python setup.py install (--prefix is probably what you want, but there are a bunch more options you could use).


Hope this helps.

0 Karma

ConsoleBotTryPC
Path Finder

Alright, thanks a lot for the help.

Appreciate the help and advice for the right forum. 

Have a nice day.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...