Splunk Dev

Adding external library to custom app

tmontney
Builder

I would like to use https://pypi.org/project/keyring/ in my custom app. I've been able to do it on Linux but unable to on Windows.

I need pip to install it. I tried calling python from the Splunk provided one, but it won't work. I ended up installing the latest Python on my server to pull it. Even when installed and I install keyring, it can't be found. I've tried using sys.path.append but has not helped. I've tried placing the downloaded package (from C:\Users\{username}\AppData\Local\Programs\Python\Python39\Lib\site-packages) in my bin folder.

When I run splunk cmd python myscript.py, I get

Traceback (most recent call last):
File "C:\Program Files\Splunk\etc\apps\customapp1\bin\myscript.py", line 10, in <module>
import keyring
File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\__init__.py", line 1, in <module>
from .core import (
File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\core.py", line 10, in <module>
from . import backend
File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\backend.py", line 42
class KeyringBackend(metaclass=KeyringBackendMeta):
^
SyntaxError: invalid syntax

I'll also note that splunk cmd python myscript.py only works if I specify the scripts full path. (This has no trouble on my Linux one.) Otherwise, I get python: can't open file 'myscript.py': [Errno 2] No such file or directory. I have a Windows environment variable named "SPLUNK_HOME" set to "C:\Program Files\Splunk".

Labels (2)
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 ...