09-17-2020 07:59 AM - edited 09-17-2020 08:07 AM
I use Python through a package installer (scoop), and was not able to get the LabVIEW Python node to work on my system. Searching the forums and KnowledgeBase articles, I found other users were having problems when Python was not installed using the standard online installer from Python.org.
Through some trial and error, I figured out the minimum environment configuration that LabVIEW needs to successfully run the Python node. I'm posting it here hoping it may help others with non-standard Python installations (e.g. Anaconda).
For 32-bit LabVIEW and Python version X.Y, only three things are needed:
1. PythonXY.dll file
2. Python standard library (/Lib folder)
3. The following registry keys:
[HKEY_CURRENT_USER\Software\Python\PythonCore\X.Y-32\InstallPath]
Set the default value here to the path to the folder containing PythonXY.dll
Example: C:\Users\user\scoop\apps\python\3.8.5
[HKEY_CURRENT_USER\Software\Python\PythonCore\X.Y-32\PythonPath]
Set the default value here to the path to the standard library (/Lib) folder
Example: C:\Users\user\scoop\apps\python\3.8.5\Lib
After pointing these registry keys to the corresponding files in my installation, the Python node works on my system. I tried deleting all the files in the installation except the DLL and the standard library, and it still worked. It looks like Python does not even need to be in the PATH.
02-08-2021 03:58 PM
Hi NBBlguy,
I wonder if you have ever tested 64-bit LabVIEW with 64-bit Anaconda (subsequently 64-bit python?). Much appreciated!
02-23-2021 10:24 PM - edited 02-23-2021 10:25 PM
Thanks for posting. This should help since Anaconda is a very common and useful installation.
I had to install python from python.org to get LabVIEW python node working.
But then how to install modules?
here are some instructions from windows command prompt
change directory to standard python installation . example below
cd C:\Users\username\AppData\Local\Programs\Python\Python36
install pandas module with pip and "-t ." to install in current target directory
C:\Users\username\AppData\Local\Programs\Python\Python36>pip install pandas -t .
The above installed pandas module into the same directory and import of pandas module starts working with LabVIEW python node
The same procedure can be used to install other modules as well in the same python directory to allow imports to work
This worked for me but if somebody has a better more python "compliant" way to install modules , please comment .
02-24-2021 05:11 PM
Seems like C:\Users\username\Anaconda3\Lib\site-packages or ..\Lib\site-packages is the place to do target directory module installs
03-18-2021 01:22 PM - edited 03-18-2021 01:28 PM
Unfortunately this doesn't work for me.
I created an encironment with anaconda and directed to it via PATH and the above mentioned reg keys. But LabVIEW won't take it.
The only way that works on my system is to use the installer from python.org (I used 3.6.8). And what is very interesting is the fact, that I can uncheecked everything the installer asks for. So it is the most minimal installation possible with that installer.
So my conclusion: python has to be in the standard installation paths (for user or system) of the python.org installers.
EDIT: What I totally can confirm is that it only need the standard lib folder and the pythonXY.dll (not the pythonX.dll and no python.exe)
03-19-2021 04:35 AM
After further testing we also need the DLLs folder to run our python tool.
And I don't get it running if I use the python36.dll which is created with an anaconda environment.
06-01-2021 07:16 AM
Thank you very much! I was trying all day to play with environment variables without any success... Thanks to your comment I realized LabVIEW does not import packages from virtual or conda environments, but from the generic python library located in the local AppData.