All Apps and Add-ons

How to import non native python libraries like pyMC in Splunk?



I am working on building some Bayesian model in Splunk which requires non native libraries to be imported like pyMC.
Has anyone tried out something like this and help me with ways to achieve this in Splunk? Also, I would like to know in which directory can I find the native libraries in PSC add-on.
Splunk version 7.1.2
ML Toolkit version 3.4
PSC version 1.3



This question has been asked in various ways over the years and the answer in the past has inevitably been some variant of "bundle the library in your app". There are numerous reasons these solutions are problematic and I encourage you to read through some of the past answers to better understand.

However, driven by the desire to solve this problem for myself, I've recently released a new app on Splunkbase called PyDen which allows a developer to create Python virtual environments of varying versions (2.7, 3.5-3.7) and install PyPI packages to them for use by other Python scripts. Scripts will run under these virtual environments instead of the built-in Python Splunk uses allowing you to leverage any version of Python and libraries you'd like.

The app is still in early development and I'm looking for feedback so please let me know if it satisfies your needs!


Hi @MousumiChowdhury,
If you need to download third-party library in your case pyMC and you need to put that within, $SPLUNK_HOME$/etc/app//bin , if you want to use throughout multiple apps you can use $SPLUNK_HOME$/Python-2.7/Lib/site-packages.

Directory for third-party library needs to have file, then you can import that with just writing import pyMC.
I'm assuming directory library is having name pyMC and it had init file.

Don’t Miss Global Splunk
User Groups Week!

Free LIVE events worldwide 2/8-2/12
Connect, learn, and collect rad prizes and swag!