All Apps and Add-ons

Splunk installing pandas -Ubuntu 18.0.4

giatuanh
Engager

I have a problem with running python on the Linux environment, where I try to appoint splunk's python to recognize another path for site-packages, where I can pip install ... but for some reason I have recalled with some other errors too.

I know I can use Splunk_SA_Scientific_Python_linux_x86_64 to bypass issues pandas and numpy but I ran into problems with requests like ImportError: No module named ssl_ OR 'NoneType' object has no attribute 'wrap_socket'

Therefore, I force to set splunk's python to recognize another path follow by this article: https://answers.splunk.com/answers/484369/how-can-i-add-python-modules-to-the-splunk-environ-1.html

But I am running to this error: Original error was: /usr/local/lib/python2.7/dist-packages/numpy/core/_multiarray_umath.so: undefined symbol: PyUnicodeUCS4_FromObject

import sys
sys.path.append('/usr/bin/python2.7')
sys.path.append('/usr/local/lib/python2.7/dist-packages')

import numpy as np
import pandas as pd 
import bs4
import lxml
import requests 
0 Karma

badarsebard
Communicator

Typically there are more packages than what's in the dist-packages, or even what's in the python2.7 directory. In order to do what you're trying to achieve this way you'd need to find all of those locations and add them to your sys.path.

What might be a better approach is to look at using the PyDen app: https://splunkbase.splunk.com/app/4322/. This app (and it's companion PyDen Manager) will allow you to create Python virtual environments of any version you can compile on your system (including version 3.5+) that can be used inside of Splunk. The app comes with a pip tool that will allow you to install and PyPI package to a specific virtual environment and there are examples scripts of how to activate the virtual environments from your Python scripts.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...