I have installed the Python for Scientific Computing App into Splunk Enterprise. It seems to have installed correctly, as I can make use of the ML toolkit.
I was expecting to be able to use numpy in my custom search commands outside of the ML toolkit App as well, but this is not the case. In custom search commands numpy cannot be imported ( ImportError: No module named numpy
).
How can I enable numpy/the Scientific Computing App in other apps or, alternatively, how can I install numpy there?
What worked for me was copying the exec_anconda.py
file included with the Python for Scientific Computing Addon into the folder of my app and than, as instructed, add
import exec_anaconda
exec_anaconda.exec_anaconda()
import numpy as np
import pandas as pd
at the top of my python file.
I than hit the ImportError: No module named ssl Error, which I could fix with this patch for the python sdk (which nowadays needs to be trivially adapted to the latest version of the SDK).
What worked for me was copying the exec_anconda.py
file included with the Python for Scientific Computing Addon into the folder of my app and than, as instructed, add
import exec_anaconda
exec_anaconda.exec_anaconda()
import numpy as np
import pandas as pd
at the top of my python file.
I than hit the ImportError: No module named ssl Error, which I could fix with this patch for the python sdk (which nowadays needs to be trivially adapted to the latest version of the SDK).
Thanks for these pointers. I managed to get all the way to
@geier If your problem is resolved, please accept an answer to help future readers.
@geier Could you please explain more widely how to solve the problem with " ImportError: No module named ssl Error"
I can't actually see my own links here (perhaps they are not shown because I don't have the necessary karma?). The patch I was talking about is this one:
Copy your required packages/files from /usr/local/lib/python2.7/dist-packages
to /opt/splunk/lib/python2.7/site-packages/
Numpy is not included in Splunk internal python, but you can either call an external python with numpy or build an egg which includes numpy.
See the following answer:
https://answers.splunk.com/answers/484021/help-in-import-of-numpy-in-splunk.html#answer-483810