Splunk Dev

Unable to import python splunk-sdk and splunklib packages.

Prathyusha891
Explorer

Unable to import splunk-sdk  and splunklib python. Here are the error's I'm getting while importing. Any suggestions? 

 

splunklib:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycrypto
Running setup.py clean for pycrypto
Failed to build pycrypto
ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects

 

splunk-sdk :

line 18, in <module>
from splunklib.six.moves import map
ModuleNotFoundError: No module named 'splunklib.six.moves'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

Labels (5)
Tags (2)

isoutamo
SplunkTrust
SplunkTrust
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@Prathyusha891 - FYI splunklib doesn't come built in with Splunk. In your App you need to put the Splunklib explicitly, mostly in the bin folder of your App.

pip install splunk-sdk --target ./bin

 

I hope this helps!!! Kindly upvote if it does!!!

0 Karma

Gr0und_Z3r0
Contributor

Hi @Prathyusha891 

A quick search on stackoverflow yields this. Try the steps mentioned in here to resolve the pycrypto dependency.
https://stackoverflow.com/questions/50080459/failed-installing-pycrypto-with-pip 

 

If the reply helps, a Karma upvote would be appreciated.

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk Enterprise 9.4: Tools for Digital Resilience

What’s New in Splunk Enterprise 9.4: Tools for Digital ResilienceTune in to What’s New in Splunk Enterprise ...

Get Schooled with Splunk Education: Explore Our Latest Courses

At Splunk Education, we’re dedicated to providing incredible learning experiences that cater to every skill ...

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...