Splunk Dev

How to run python custom commands with cython dependencies?

joshiro
Communicator

We are trying to run some custom commands that requires cython, but Splunk's python doesnt support it.
We tried creating an anaconda environment inside the app, just like MLTK and Python for Scientific Computing apps, but some issues appeared regarding anaconda symlinks. This is beign discussed in another thread: https://community.splunk.com/t5/Developing-for-Splunk-Enterprise/Why-when-installing-custom-made-app...

¿Anyone managed to run python custom commands that required cython?

Labels (2)
0 Karma
1 Solution

joshiro
Communicator

We finally made it work using the Python for Scientific Computing app custom python environment, and then changing to it in runtime. Then we added the cython libs required and it worked.

We copied the exec_anaconda.py script into our app and modified it according to our needs.
Then we use it a python custom command script to load the PSC environment.
Finally we added the cython libs with:

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib", <path_to_libs>))

View solution in original post

0 Karma

joshiro
Communicator

We finally made it work using the Python for Scientific Computing app custom python environment, and then changing to it in runtime. Then we added the cython libs required and it worked.

We copied the exec_anaconda.py script into our app and modified it according to our needs.
Then we use it a python custom command script to load the PSC environment.
Finally we added the cython libs with:

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib", <path_to_libs>))
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...