<?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: Switching to Python3 in Splunk 8 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485902#M193620</link>
    <description>&lt;P&gt;Thank you - this was very helpful&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 17:11:16 GMT</pubDate>
    <dc:creator>rwellum</dc:creator>
    <dc:date>2020-01-22T17:11:16Z</dc:date>
    <item>
      <title>Switching to Python3 in Splunk 8</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485900#M193618</link>
      <description>&lt;P&gt;I am testing my custom app, which I have converted to be compatible with python2 and python3, on a Splunk 8.0.1 instance.&lt;/P&gt;

&lt;P&gt;To force Splunk into using Python3 the documentation[1] states:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Splunk Enterprise version 8.0 include a global setting, python.version, to specify which Python interpreter to use across an instance. The global setting resides in the server.conf file, located in $SPLUNK_HOME/etc/system/local/. The stanza that controls Python version is [general]. For more information how Splunk Enterprise uses configuration files, see About configuration files.&lt;BR /&gt;
python.version is set to python2 by default in Splunk Enterprise version 8.0. To specify Python 3, set python.version = python3. These settings specify the interpreter to use if a script-level setting has not been specified, but script-level settings take precedence over the global setting, except if Python 3 is forced.&lt;BR /&gt;
To force Splunk Enterprise to use only the Python 3 interpreter regardless of script-level setting, set python.version = force_python3. Use this setting if you cannot run Python 2.7 past its EOL date of January 1, 2020, or if your Splunk Enterprise deployment and all Splunk apps and add-ons are fully migrated and ready to run Python 3 only&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I copied the default server.conf to the local directory and made the change and then restarted splunk with: '/opt/splunk/bin/splunk restart':&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[splunk@rich-splunk-centos ~]$ grep python ./splunk/etc/system/local/server.conf&lt;BR /&gt;
python.version = python3&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Afterwards however Splunk default still appears to be python2:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;/opt/splunk/bin/splunk cmd python --version&lt;BR /&gt;
Python 2.7.16&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I've repeated with python = force_python3 as the documentation states with the same results.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;[splunk@rich-splunk-centos ~]$ grep python ./splunk/etc/system/local/server.conf&lt;BR /&gt;
python.version = force_python3&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I've repeated as well changing: '/opt/splunk/etc/system/local/server.conf' equivalently (in case this was the true splunk home). Again no change.&lt;/P&gt;

&lt;P&gt;I've verified a lot of my functionality by running my commands manually like this:&lt;/P&gt;

&lt;P&gt;'/opt/splunk/bin/splunk cmd python3 ' - and this is working.&lt;/P&gt;

&lt;P&gt;What am I missing? Wondering if the &lt;STRONG&gt;&lt;EM&gt;splunk cmd python --version&lt;/EM&gt;&lt;/STRONG&gt; is misleading - because I'm explicitly calling python2 here...&lt;/P&gt;

&lt;P&gt;What am I doing wrong? How should I verify which python version is actually running by default?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:42:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485900#M193618</guid>
      <dc:creator>rwellum</dc:creator>
      <dc:date>2020-09-30T03:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Switching to Python3 in Splunk 8</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485901#M193619</link>
      <description>&lt;P&gt;If you look into Splunk/bin directory, you will see python, python2 and python3 executables. Running splunk cmd python uses the python executable, which gives you version 2.7.16. Running splunk cmd python3 --version should show the correct python version.&lt;/P&gt;

&lt;P&gt;This does not prove that you run the correct version. You can check what version splunk is running as by checking which configuration is active. Doing a splunk btool server list, piping it and select-string/grep for "python" should show you which version Splunk is running as.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 09:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485901#M193619</guid>
      <dc:creator>hakon_nor</dc:creator>
      <dc:date>2020-01-22T09:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Switching to Python3 in Splunk 8</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485902#M193620</link>
      <description>&lt;P&gt;Thank you - this was very helpful&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:11:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Switching-to-Python3-in-Splunk-8/m-p/485902#M193620</guid>
      <dc:creator>rwellum</dc:creator>
      <dc:date>2020-01-22T17:11:16Z</dc:date>
    </item>
  </channel>
</rss>

