Splunk Dev

How to install splunk python SDK under bulitin splunk python

cloud_cloud
Explorer

I tried install splunk python SDK with

python setup.py install

but unsuccessfully because on my linux box is python 2.4. and splunk python SDK require python 2.6+

Then I discovered that splunk have builtin python 2.6 and I tried install with

/opt/splunk/bin/splunk cmd python setup.py install

but again unsuccessfully. error: invalid command 'install'

I can't install python 2.6 on my linux box, but how install splunk python SDK under splunk python 2.6. ??

Tags (2)
1 Solution

ineeman
Splunk Employee
Splunk Employee

As you can see here, there is an issue with the Splunk version of distutils:
http://splunk-base.splunk.com/answers/6033/adding-python-module-to-splunk

There are ways around this, but feel free to get in touch with me at ineeman@splunk.com and we can try and work through the options, and then I'll post the final result here.

View solution in original post

badarsebard
Communicator

As an alternative, there is now a Splunk app called PyDen that allows you to use multiple Python versions, virtual environments, and PyPI packages. This means you could create a virtual environment of any version you want and install the Splunk SDK to it, and that environment can be used by any script in any app with the right import statement.

0 Karma

ineeman
Splunk Employee
Splunk Employee

As you can see here, there is an issue with the Splunk version of distutils:
http://splunk-base.splunk.com/answers/6033/adding-python-module-to-splunk

There are ways around this, but feel free to get in touch with me at ineeman@splunk.com and we can try and work through the options, and then I'll post the final result here.

ineeman
Splunk Employee
Splunk Employee

Steve - the easiest way is to simply include the splunklib directory of the SDK with your app. That way it will work the most reliably. Feel fee to get in touch if you have any questions.

0 Karma

bnorthway
Path Finder

is that an environment variable, or how exactly do you do that? Could someone update the official docs to explain how to set up a development environment? I have the exact same issue.

steve
Path Finder

Were you able to get the solution to this?

Thanks!

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...