LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView NXG 5.0 Python Node

Solved!
Go to solution

Hello together

 

I'm working with LabView NXG 5.0 and there is a "python node" available. I would like to to execute following Python-Code in the Python-Node in LabView NXG:


def ReadData():
    import obspy as ob
    st = ob.read("C:/Users/Basil/Downloads/DT0321__.BBN")
    array = st[0].data
return array

 

The function "ReadData" should read the data from a MiniSEED file. MiniSEED files are used for seismic data recordings. In this function, I use the function "read" from the Obspy-Package. This package is imported with "import obspy". This small programm works in the Python IDE, but if I execute it in LabVIEW NXG 5.0 I get following Error-Code 1671. A printscreen of my VI is attached.

 

*******************************************************************************************
Python-Funktion aufrufen in Function.gvi<APPEND>
Module Path: C:\Users\Basil\Documents\pythonProject\main.py
Function Name: ReadData
Python returned the following error: <class 'ModuleNotFoundError'>
No module named 'obspy'
Call Stack information:
File "C:\Users\Basil\Documents\pythonProject\main.py", line 2, in ReadData
import obspy as ob
ModuleNotFoundError: No module named 'obspy'
*******************************************************************************************

 

Is there an addition step, which I have to do so that I can use functions from a python library like Obspy? Does somebody know what could be wrong?


Thanks for your answer or hints

 

Best regards

Basil

0 Kudos
Message 1 of 5
(2,880 Views)

Hi BasilB,

 

Have you download the module/library at cmd or powershell of your window by key in:

' pip install obspy ' ?

0 Kudos
Message 2 of 5
(2,826 Views)

Hi WaiLee

 

I'm working with the Python IDE PyCharm. Due to my few experience in development Python code until now, I took the example from the Obspy homepage and just run it in the Python IDE. By the first excution, there was the hint that obspy isn't installed and then i could click on "install" in this message. Afterwards the library was downloaded and installed. 

So I didn't use PowerShell. 

 

I hope my answer give you some further infos. 

 

Regards

Basil

0 Kudos
Message 3 of 5
(2,819 Views)

Hi WaiLee

 

Or can you give my a short instructions how do I install a Python library correctly? So I could uninstall Python and begin again.

 

Regards

BasilB

0 Kudos
Message 4 of 5
(2,744 Views)
Solution
Accepted by topic author BasilB

Hi BasilB,

 

Sorry for the late reply.

I remember when I download the Python from the official website, this https://www.python.org/downloads/

After I clicked download, I make sure the 'PIP' is installed by ticking the optional feature box, but normally PIP will automatically installed along with the main program.

Optional Feature Box.png

 

Why PIP is important? PIP is a package manager for Python. That means it's a tool that allows you to install and manage additional libraries and dependencies that are not distributed as part of the standard library.

Once you done the download process, go to window search box, find 'cmd' which is the command prompt and open it. Type 'pip install _____' (the name of the library you wanted to download) eg. 'pip install pandas' and you have done the library download process.

For more information, you may refer to this website as I found it useful:

https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-comman...

0 Kudos
Message 5 of 5
(2,733 Views)