From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Python and NI

cancel
Showing results for 
Search instead for 
Did you mean: 

python modules with anaconda distribution

Hi there !
How can I use a python module like numpy within Labview ?
The anaconda distribution allows to build a python3.6 environment with all the required modules. 

The following code will fail as soon as the line "import numpy ..." is inserted
Spyder does execute this line without error though. 
What is wrong ?

 

import math
import numpy as np

def Add3(a, b, c):
return (a+b)+c;

 

The error is :

Function Name: Add3
Python returned the following error: <class 'ModuleNotFoundError'>
No module named 'numpy'

0 Kudos
Message 1 of 5
(4,350 Views)

I actually used python to get around purchasing labview.  Either way you may want to check out this site.  It contain modules to let python read NI drivers.  I run FFTs with strain gauge data and print the results to the console window in my case PS. This can also be done using C. That documentation comes with the NI drivers. 

 

https://nidaqmx-python.readthedocs.io/en/latest/  

Message 2 of 5
(4,322 Views)

Hi,

 

did you ever figure this out?  I'm having the same issue.  none of the modules are installed and, therefore, my python code won't run.

 

Thanks

 

0 Kudos
Message 3 of 5
(4,224 Views)

 vincentfournier,

try running python from 'cmd' shell.

see if you can 'import numpy' from that simple interpreter prompt

If yes, default labview call python .vi (sorry, don't remember name) should be able to do so also.

if not, you need to setup your PYTHONPATH env variable correctly so that you can.

0 Kudos
Message 4 of 5
(4,196 Views)

Hello everyone

 

First of all I'm sorry for using this already opened topic but I was avoiding to create a new one and my issue is related with the use of nidaqmx package in python, so I think it's not very far from the subjects being discussed in here.

 

I'm a newbie in python (and in labview, btw) but I have a project which involves the acquisition of 6 AI signals through a NI-USB-6009 hardware (infrared spectrometer). The labview programming is working but, since I need to run another piece of software downstream the acquisition path, I'm trying to program the data acquisition in python (in google colab and/or spyder) using the packages provided by NI. In colab, I followed the advised path ('

pip install nidaqmx') but when I try to import, I get the message 'Could not find an installation of NI-DAQmx'. This also happens with Spyder.
 
I would appreciate any help on this issue. After solving this frustrating problem I'm antecipating a new one which will be the acquisition of the 6 inputs from NI-USB-6009. But, one problem at a time.
 
Thank you so much for the help!
0 Kudos
Message 5 of 5
(3,151 Views)