<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add libraries to Install Python for Scientific Computing in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431898#M52987</link>
    <description>&lt;P&gt;Actually my case is different from the root cause point of view.&lt;/P&gt;

&lt;P&gt;I run the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index="_audit" | fit LinearRegression linecount from _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So 'fit' fails in case PYTHONUNBUFFERED env var is set and does not fail if it is not set.&lt;/P&gt;

&lt;P&gt;Versions are Splunk 8.0.1, MLTK 5.0.0, PSC 2.0.0 with python 3.7.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 15:43:01 GMT</pubDate>
    <dc:creator>simonyi</dc:creator>
    <dc:date>2020-02-10T15:43:01Z</dc:date>
    <item>
      <title>Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431893#M52982</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;
I want to add an algorithm to Splunk, more specifically the Prophet from Facebook.&lt;/P&gt;

&lt;P&gt;How can i add modules to Python Scientific Computing, since this module is not available by default?&lt;/P&gt;

&lt;P&gt;I tried add this code before importing and use other python from my computer, but i get a lot of errors&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys
sys.path.append('/home/myuser/anaconda2/lib/python2.7')
sys.path.append('/home/myuser/anaconda2/lib/python2.7/site-package
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The error when the search with the algorithm fail:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Error in 'fit' command: Invalid message received from external search command during search, see search.log.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The Job Inspector show this message:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;This search did not successfully execute. Any results returned from this job are not consistent and should not be used.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;And looking in the search.log through Job Inspector, I found these errors:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;04-25-2019 10:06:21.321 ERROR ChunkedExternProcessor - stderr: ERROR:fbprophet.plot:Importing matplotlib failed. Plotting will not work.&lt;BR /&gt;
04-25-2019 10:06:21.371 ERROR ChunkedExternProcessor - stderr: /home/myuser/.local/lib/python2.7/site-packages/fbprophet/forecaster.py:794: FutureWarning: Series.nonzero() is deprecated and will be removed in a future version.Use Series.to_numpy().nonzero() instead&lt;BR /&gt;
04-25-2019 10:06:21.371 ERROR ChunkedExternProcessor - stderr:   min_dt = dt.iloc[dt.nonzero()[0]].min()&lt;BR /&gt;
04-25-2019 10:06:21.402 ERROR ChunkedExternProcessor - Failed attempting to parse transport header: Initial log joint probability = -2.68685&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Does anyone know how to fix these, or have a new way to add a library? &lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:16:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431893#M52982</guid>
      <dc:creator>mhsilva</dc:creator>
      <dc:date>2020-09-30T00:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431894#M52983</link>
      <description>&lt;P&gt;I've just run into the same issue while I wanted to run a 'fit' command with Splunk Machine Learning Toolkit 4.5.0, though I could not reproduce it with MLTK 4.0.0.&lt;BR /&gt;
It seems that the problem comes up when PYTHONUNBUFFERED environmental variable is set. There is no error if the env var is not set.&lt;/P&gt;

&lt;P&gt;In my case stderr stream is handled somehow as transport header:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;02-10-2020 10:05:07.837 INFO  ChunkedExternProcessor - Running process: /opt/splunk/bin/python3.7 /opt/splunk/etc/apps/Splunk_ML_Toolkit/bin/fit.py
02-10-2020 10:05:07.870 ERROR ChunkedExternProcessor - Failed attempting to parse transport header: INFO Running /opt/splunk/etc/apps/Splunk_SA_Scientific_Python_linux_x86_64/bin/linux_x86_64/bin/python /opt/splunk/etc/apps/Splunk_ML_Toolkit/bin/fit.py &amp;lt;_io.TextIOWrapper name='&amp;lt;stderr&amp;gt;' mode='w' encoding='UTF-8'&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I guess the INFO part of the printout is supposed to be directed to stderr.&lt;/P&gt;

&lt;P&gt;Can you Splunk guys investigate the above one?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 12:01:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431894#M52983</guid>
      <dc:creator>simonyi</dc:creator>
      <dc:date>2020-02-10T12:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431895#M52984</link>
      <description>&lt;P&gt;There are no "Splunk guys" here.  We're all fellow users.  If you need help from Splunk then you should open a support request.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 13:56:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431895#M52984</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-02-10T13:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431896#M52985</link>
      <description>&lt;P&gt;Thanks richgalloway, I was hoping someone from the authors reading this. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431896#M52985</guid>
      <dc:creator>simonyi</dc:creator>
      <dc:date>2020-02-10T14:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431897#M52986</link>
      <description>&lt;P&gt;I am not a subject expert on this but if look like the error message say it doesnt find matplotlib library which fbprophet use&lt;BR /&gt;
As this is reported to stderr , that goes up to the fit command which complain &lt;BR /&gt;
Also , please make sure you choose the appropriate version of mltk &lt;BR /&gt;
if the algo you wish add is made for python 3, you probably need to be using mltk 5.0 + splunk 8.0 + adapt the path to not use python 2.x)&lt;BR /&gt;
If the version are unaligned, that could explain the lib not found error.&lt;BR /&gt;
What are the versions you are playing with ?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431897#M52986</guid>
      <dc:creator>maraman_splunk</dc:creator>
      <dc:date>2020-02-10T14:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431898#M52987</link>
      <description>&lt;P&gt;Actually my case is different from the root cause point of view.&lt;/P&gt;

&lt;P&gt;I run the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search index="_audit" | fit LinearRegression linecount from _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So 'fit' fails in case PYTHONUNBUFFERED env var is set and does not fail if it is not set.&lt;/P&gt;

&lt;P&gt;Versions are Splunk 8.0.1, MLTK 5.0.0, PSC 2.0.0 with python 3.7.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/431898#M52987</guid>
      <dc:creator>simonyi</dc:creator>
      <dc:date>2020-02-10T15:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add libraries to Install Python for Scientific Computing</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/697260#M81006</link>
      <description>&lt;P&gt;I managed to add extra python modules to Python for Scientific Computing by building it from source.&lt;BR /&gt;In my case I added xgboost for Linux (64-bit)&lt;BR /&gt;Cloned the GitHub repo: &lt;A href="https://github.com/splunk/Splunk-python-for-scientific-computing" target="_self"&gt;https://github.com/splunk/Splunk-python-for-scientific-computing&lt;/A&gt;&lt;BR /&gt;Just for increased stability I checked out the latest available git tag (currently 4.2.1, this step might not be necessary)&lt;BR /&gt;I then added in environment.nix.yml the python module that I want (in my case: - xgboost=2.1.1)&lt;BR /&gt;Afterwards, followed the readme and run: make freeze make build make dist&lt;BR /&gt;Finally copied the tarball from the build directory to the user_apps directory on Splunk (substituting the existing Python for Scientific Computing app if already installed).&lt;/P&gt;&lt;P&gt;When using Python for Scientific Computing copy the exec_anaconda and util python scripts to the bin directory of your app. Also copy the lib/splunklib from Python for Scientific Computing to the bin directory of your app.&lt;BR /&gt;Add these lines to the start of your script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import exec_anaconda
exec_anaconda.exec_anaconda()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 09:19:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Add-libraries-to-Install-Python-for-Scientific-Computing/m-p/697260#M81006</guid>
      <dc:creator>garrets</dc:creator>
      <dc:date>2024-08-26T09:19:44Z</dc:date>
    </item>
  </channel>
</rss>

