Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Python nidaqmx crashes when trying to use along side kvaser canlib

I have been successfully using the nidaqmx Python package to run a cDaq-9174 with multiple modules. I also have another successful Python application that uses Kvaser canlib for CAN communications. When I try to add this CAN communications functionality to the working application I've been using with the cDaq-9174, I get an error of:

nidaqmx.errors.DaqError: The specified software component is not available. The component was not loaded.

 

I also get:

ResourceWarning: Task of name "ni9205" was not explicitly closed before it was destructed. Resources on the task
device may still be reserved.

 

This error occurs on the following line that has previously been working correctly:

nitask.ai_channels.add_ai_voltage_chan(channel,terminal_config=TerminalConfiguration.DIFF)
 
What I have tried:
1. Commented out all of my code that was added for the CAN functionality except for the following lines:
from canlib import kvadblib
from canlib import canlib
2. I changed the above to:
import canlib.kvadblib as kvlib
import canlib.canlib as kvcan
3. I removed the import lines all together, and the application starts working as normal again.
At this point I am thinking that perhaps both the kvaser driver and the NI drivers are trying to perhaps use the same host machine resource. Is there a way to specify or to read the port being used by the cDaq programatically in Python? Both the Kvaser and cDaq are USB devices. Any other ideas?
0 Kudos
Message 1 of 4
(1,095 Views)

What if you use only nidaqmx with python and kvaser software, or kvaser can with python and Test Panels?

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 4
(1,091 Views)

Thanks for the tip. I tried that. I am able to access the Kvaser with CAN King while my nidaqmx app is running without either crashing. Also, looks like they are on different ports. So it's not a port conflict. 

 

I did find an article talking about dependency conflicts. If two packages use the same dependencies but different versions of that dependency, that can cause this because only one version of a dependency package can be loaded at a time. Now I am digging into what dependencies nidaqmx and canlib have to see if I can see if there are conflicts.

0 Kudos
Message 3 of 4
(1,085 Views)

I am adding an example script that demonstrates the error I am encountering. The attached script runs as expected until I uncomment either of the import lines for canlib components.

0 Kudos
Message 4 of 4
(1,029 Views)