LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Python Node in LV2018

Hi luboss333,

 

I get the same error.  I've been reading a little bit about Python matplotlib backends, but I do not have the solution yet.  Would you be willing to begin a new discussion forum post to get more visibility on that error?  Perhaps someone else has already solved it!

 

I'm glad that numpy, scipy, and matplotlib are working for you otherwise.  I'll be sure to follow the new post. 

 

Best regards!

Chad

0 Kudos
Message 11 of 41
(10,097 Views)

Hello luboss333 and chericks,

although I don't know a solution to solve Qt platform plugin error in windows, there is one simple way how to avoid it and display your graph in new window by labview. You must switch backend in matplotlib in your python function, for example to "TKAgg". Refer to https://matplotlib.org/faq/usage_faq.html#what-is-a-backend for more info about backends. I have attached example .py and VI which are modified versions of chericks.

 

Regards

Lukas

Download All
Message 12 of 41
(10,064 Views)

Hi Lukas,

 

Thanks for your reply. I ran your example. "TKAgg" worked for me as well.

 

Well done!

Chad

 

0 Kudos
Message 13 of 41
(10,056 Views)

Thank you Lukas 

it works great 🙂

0 Kudos
Message 14 of 41
(10,032 Views)

Hi chericks,

 

I am using Python 2.7 and get the same error.

I have Anaconda directory in User variables and System variables: 

C:\Users\San\Anaconda

However, the VI still doesn't work. You have any idea why.

Thanks,

San

0 Kudos
Message 15 of 41
(10,020 Views)

Hi San,

 

Sorry for the delay.  You mentioned the VI doesn't work.  What error message do you see?

 

Questions:

- Do you have multiple versions of Python installed?

- Which IDE do you use for Python development? 

 

Perhaps I can create a new image, install LabVIEW and your Python version / IDE, to reproduce and overcome the issue.

 

Best regards,

Chad

0 Kudos
Message 16 of 41
(10,007 Views)

Hi Chad, 

Thanks so much for your reply!

My error message is the same as the error above: "No module named numpy".

 

I only have one version of python which is 2.7.

My IDE is Anaconda 2.3.0. 

My PC is 32 bit.

 

Best regards,

 

San

 

 

0 Kudos
Message 17 of 41
(9,998 Views)

Thank you for your example. I just tried it.
Just to make it clear you can call the funktion with parameters. And it is possible to have a complex return value, for example in json.


2018-08-29 13_12_04-simple EXE - Microsoft Visual Studio.png

I would like to hear about use cases of other users.

0 Kudos
Message 18 of 41
(9,882 Views)

what if I want to send a numpy array to labview

assume I have an array called ko

if I use :

ko.append(30)

it will successfully send 30 to labview

but

numpy.append(ko,30)

won't do it.

any ideas?

0 Kudos
Message 19 of 41
(9,827 Views)

Hi everyone,

 

I had the same issue with python node trying to import numpy library, everytime I ran a code with numpy LabVIEW responded with the 'ModuleNotFoundError' error No module named 'numpy'.
My computer is configured with Anaconda3. To resolve this problem, I install python3.6 in addition of the python installed in Anaconda but be careful on the bitness of your LabVIEW. If you are using labVIEW 32bits, install python 3.6-32bits. And if you install LabVIEW 64bits, Python 3.6-64bits evenwhile LabVIEW will not succeed to find the interpreter of Python.
Also take care of the library that you are using, for my part, I was using numpy but also Keras with tensorflow for Deep Learning example. The problem is that tensorflow is just compatible with Python 64bits.

So what I have done is that I installed python 3.6.6 for 64bits without adding Python 3.6 to the environment variable.
The first time I run the code of chericks, LabVIEW responded with the 'ModuleNotFoundError' error No module named 'numpy' even if I had python 3.6 installed. So when I went to the installation folder "C:\Users\user\AppData\Local\Programs\Python\Python36" I saw that the numpy library was not here.
I decided to install the library in it.
But another problem appears when I use the command "python -m pip install numpy" in command prompt, a message appeared "Requirement already satisfied: numpy in c:\users\user\anaconda3\lib\site-packages (1.14.5)".
I couldn't install numpy because numpy was already installed in anaconda (the solution of putting the Path of Anaconda in User variable and Environment variable didn't work for me).

 

After a long time of research, I found the solution :
1. in the command prompt write "cd C:\Users\user\AppData\Python36-32\Scripts" so all the other command will occur in this folder.
2. type "pip install numpy" and the other libraries that you want. I installed matplotlib, scipy, scikit-learn, pillow, pandas, tensorflow (compatible just with Python 64bits) and keras.

 

After these steps you will be able to run the codes which use your libraries.

Message 20 of 41
(9,734 Views)