06-09-2021 02:12 PM
I am trying to call some python code from LabVIEW, and the code needs to import pythonnet. When running the python code from PyCharm it uses venv (virtual environment) to add the dependent libraries. I was watching "Webinar Reminder: [AMER] Python and NI: Using Python with NI Hardware and Software" today and they said that virtual environments aren't supported in LabVIEW, but that there was a work around. I can't find that workaround documented anywhere. Does someone have an example?
06-09-2021 08:41 PM
This isn't that helpful yet, but maybe this is illustrative of part of the workaround: Python Virtual Environments - Beta Forum.
It uses the new (as yet unreleased) LabVIEW 2021 beta Python node, which allows you to pass a path for the python executable.
I suspect, although I haven't tried, that if you added the necessary paths for your venv environment to your OS, and removed the paths to the system installation, that you might be able to do this... but changing between different environments would be a non-starter in that case (because you can't easily change your paths via e.g. environment variable and have them affect the running LabVIEW process - you have to restart LabVIEW).
06-11-2021 07:35 AM
Thanks I'll look into that. Not a great workaround, but maybe a start. If their is an NI supporter on the thread, could they go ask the presenter Kevin Flanagan if this is what he meant by workaround for completeness.
06-17-2021 09:59 AM
So maybe not monitoring the forum. If there is anyone interested I think the solution is the use a shebang (#!) but I haven't quite yet gotten it to work.
07-01-2021 09:48 AM
Bump. Anyone at NI going to follow-up up with the presenters to see what they have to say?
10-12-2022 05:57 AM
did you ever find the answer to your question?
10-12-2022 07:29 AM
Nope. I had to give up due to lack of RT support, but I haven't looked in a while so maybe that changed.