<?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: JMP crashes and closes immediately upon running Python Init. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821571#M100060</link>
    <description>&lt;P&gt;I wish it is up to me so I can upgrade it, but the company I work for always gets the new software updates at least a year late.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2024 23:22:37 GMT</pubDate>
    <dc:creator>scyrt</dc:creator>
    <dc:date>2024-12-09T23:22:37Z</dc:date>
    <item>
      <title>JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821417#M100054</link>
      <description>&lt;P&gt;I'm experiencing issues integrating Python with JMP 17. Despite following the recommended steps, JMP crashes every time I run&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Python Init&lt;/CODE&gt;. Here are the details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;System Setup:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;JMP Version: 17&lt;/LI&gt;&lt;LI&gt;Python Version: 3.9.13 (64-bit) (tried v3.13.1 as well)&lt;/LI&gt;&lt;LI&gt;OS: Windows 10 (64-bit)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Steps Taken:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Installed Python 3.9.13 and added it to the PATH.&lt;/LI&gt;&lt;LI&gt;Installed required Python packages: numpy, pandas, matplotlib, scipy, PyQt5.&lt;/LI&gt;&lt;LI&gt;Set the environment variable&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;JMP_PYTHON_MODULE_PATH&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;C:\Program Files\Python39\python39.dll&lt;/CODE&gt;.&lt;/LI&gt;&lt;LI&gt;Verified Python installation and package installations via Command Prompt.&lt;/LI&gt;&lt;LI&gt;Tried running a simple JSL script to initialize Python:&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&lt;CODE class="language-jsl"&gt;// Initialize Python with the specified path
Python Init( Path( "C:\\Program Files\\Python39\\python39.dll" ) );

// Simple Python code to test initialization
python_code = "
print('Hello from Python!')
";

// Run the Python code
Python Submit(python_code);

// Close the Python session
Python Term();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;JMP crashes and closes immediately upon running&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Python Init&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Troubleshooting Steps Taken:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Verified the Python path and DLL file location.&lt;/LI&gt;&lt;LI&gt;Uninstalled other Python versions to avoid conflicts.&lt;/LI&gt;&lt;LI&gt;Reinstalled JMP 17.&lt;/LI&gt;&lt;LI&gt;Checked JMP logs for error messages (none found).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Despite these efforts, the issue persists. Has anyone else encountered this problem or have any suggestions on how to resolve it?&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 21:47:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821417#M100054</guid>
      <dc:creator>scyrt</dc:creator>
      <dc:date>2024-12-09T21:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821569#M100059</link>
      <description>&lt;P&gt;Do you have the possibility to update to JMP18.&lt;BR /&gt;the update is free of charge for every user.&lt;BR /&gt;&lt;BR /&gt;Besides many gret improvements, JMP + Python interact as a charm now : )&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 22:52:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821569#M100059</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-09T22:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821571#M100060</link>
      <description>&lt;P&gt;I wish it is up to me so I can upgrade it, but the company I work for always gets the new software updates at least a year late.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 23:22:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821571#M100060</guid>
      <dc:creator>scyrt</dc:creator>
      <dc:date>2024-12-09T23:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821614#M100068</link>
      <description>&lt;P&gt;ouch!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 10:03:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821614#M100068</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-10T10:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821630#M100073</link>
      <description>&lt;P&gt;I would contact JMP Support directly an put in a trouble ticket.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;support@jmp.com&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 12:21:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821630#M100073</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-12-10T12:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821798#M100096</link>
      <description>&lt;P&gt;As mentioned by others, JMP 18 makes your life much easier with respect to Python. &amp;nbsp;JMP installs a private embedded &amp;nbsp;Python 3.11 that works out of the box with JMP. &amp;nbsp;Getting Python working with JMP 14-17 can be challenging, and was the major reason JMP now ships with Python. &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First remove the environment variable.&amp;nbsp;&lt;STRONG&gt;JMP_PYTHON_MODULE_PATH&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Second, are you running Python.org or Anaconda? &amp;nbsp;&lt;STRONG&gt;Use Python.org.&lt;/STRONG&gt; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Third, JMP 17 is 64-bits, you must be using 64-bit Python.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;I was able to make Anaconda work, but only by stepping through JMP source code in the debugger to properly configure the Python Init.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also JMP 14-17 is not designed to work with virtual environments (&amp;nbsp;&lt;EM&gt;venv ).&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Python Connect() and Python Init() functions take a variety of parameters that can solve the problem.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The simplest to try is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Python Init ( Use Python Version("3.9") );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You have already tried the:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Python Init ( 
    Path("C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll") &lt;BR /&gt;);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Finally, the 'brute force' way is to specify both the path to the dll, and the full Python sys.path as a JSL list. &amp;nbsp;Launch Python from the command line and run the following.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import sys
print ( sys.path )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Giving the following on my machine:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import sys
&amp;gt;&amp;gt;&amp;gt; print(sys.path)
['', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\_me_\\panels\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\_me_\\AppData\\Roaming\\Python\\Python39\\site-packages', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\win32', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\win32\\lib', 'C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\Pythonwin']
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now you can take the Python list [ ... ] and create a JSL list from that to pass to Python Init() as shown below. &amp;nbsp;Here the two differ since the script below is pasted from a script I ran some time ago. &amp;nbsp;I ran the above Python today. &amp;nbsp;When in doubt use everything that Python itself returns for its sys.path.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Python Init(
    Path("C:\\Users\\_me__\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll"),
    Python Sys Path(
    {
	  "",
	  "C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip", 
	  "C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\DLLs",
	  "C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib",
	  "C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39",
	  "C:\\Users\\_me_\\AppData\\Roaming\\Python\\Python39\\site-packages",
	  "C:\\Users\\_me_\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages"
    }	
  )
);

Python Submit("\[

import sys
print(sys.path)
print(sys.version)

]\");

x1 = [1, 2, 3];
Python Send( x1 );
x1 = [3,2,1];
x2 = Python Get( x1 );
Show( x1, x2 );
dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );

Python Send( dt1 );
dt2 = Python Get( dt1 );
dt2 &amp;lt;&amp;lt; New Data View;
Close( dt1 );
//Python Term();

Python Submit("\[
print(dt1)
]\");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Beyond that... Upgrade to JMP 18.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 19:02:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821798#M100096</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2024-12-10T19:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: JMP crashes and closes immediately upon running Python Init.</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821830#M100104</link>
      <description>&lt;P&gt;thanks, removing env variable and passing the sys.path list to the Python Init worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 00:46:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-crashes-and-closes-immediately-upon-running-Python-Init/m-p/821830#M100104</guid>
      <dc:creator>scyrt</dc:creator>
      <dc:date>2024-12-11T00:46:18Z</dc:date>
    </item>
  </channel>
</rss>

