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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...