07-16-2024 08:00 AM
Hello!
I'm running NI LabVIEW 2024 Q1 (64-bit) on Windows 10 with Python 3.12 via Anaconda to run a simple VI that takes three inputs to produce one output. The code used is proprietary so I have attached a simple code to serve as a placeholder along with the VI. My problem is that the "Open Python Session" node fails to execute when the VI is running and displays Error 1671. The only fix I've found is to delete the node, replace it, and rewire it with the same inputs for "Python path" and "Python version". It will run seamlessly for a few rounds of operation and then throw the same error.
What kinds of workarounds have people used to solve this issue in the past? Any input on how to solve this would be much appreciated!
Python Code:
def calculator(a, b, c):
return a + b + c
Best regards,
asb328
Solved! Go to Solution.
07-17-2024 12:19 PM
@asb328 wrote:
Hello!
I'm running NI LabVIEW 2024 Q1 (64-bit) on Windows 10 with Python 3.12 via Anaconda to run a simple VI that takes three inputs to produce one output. The code used is proprietary so I have attached a simple code to serve as a placeholder along with the VI. My problem is that the "Open Python Session" node fails to execute when the VI is running and displays Error 1671. The only fix I've found is to delete the node, replace it, and rewire it with the same inputs for "Python path" and "Python version". It will run seamlessly for a few rounds of operation and then throw the same error.
What kinds of workarounds have people used to solve this issue in the past? Any input on how to solve this would be much appreciated!
Python Code:
def calculator(a, b, c):
return a + b + c
Best regards,
asb328
I cant see your code (If you can save it to LV 2020 I can open it, or post a snipit) Do you close the python session between each "round of operation"?
07-18-2024 08:34 AM
Hello,
I've attached the VI again saved for LabVIEW 2020, let me know if you're able to access it.
Yes, we run the VI for about 16 hours a day, stop it, then restart it the next morning.
Best,
asb328
07-18-2024 10:52 AM
@asb328 wrote:
Hello,
I've attached the VI again saved for LabVIEW 2020, let me know if you're able to access it.
Yes, we run the VI for about 16 hours a day, stop it, then restart it the next morning.
Best,
asb328
Hello abs,
Thanks for saving the vi in 2020, I can see it now. I think there are multiple issues that are happening:
1) Because I am running an older version of LabVIEW I might not be seeing the same thing as you. This is what I see:
and calling it like this will probably have issues since python 3.12 is not actually supported, see here: https://www.ni.com/en/support/documentation/supplemental/18/installing-python-for-calling-python-cod...
2) I believe based on documentation, you need to open a virtual session to interact with the anaconda python environment. You might be doing this but because I have an older LV version I don't have this option so it just shows up as shown above, see here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000gPVVCA2&l=en-US
3) And this is my opinion as a python developer; if you can, don't use anaconda, it adds a an un-necessary layer of complexity to anything you do with python. 10 years ago anaconda was a great option because it made installing python packages easy, now you can pip install anything you like and don't need the extra anaconda baggage. As you can see with your code now you have to worry about labview, python, and anaconda. It would be much easier if you only had to worry about labview and python.
So possible solutions:
1) use the VI you posted and replace the string version string with 3.10. This has a high likely hood of working correctly. Labview will never ship with latest version of python, a they need time to implement and test (hopefully) it. So its a trade off, you can have stability or the latest version, your choice.
2) Break out your leet dev skills and use the existing setup with anaconda and python 3.12 and start pouring over logs to see why after some time labview cant connect to the venv. A simple check would be to see if the venv is running when you try to open it in labview resulting in an error.
07-19-2024 08:13 AM
Thank you very much for the tips and documentation! This was very helpful 🙂 I'll check to see which of your recommended actions works.