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!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...