LabVIEW vs. Python

Introduction

The use case described herein involves prototype and manufacturing test applications almost exclusively. I do not intend to suggest that Python can or should replace LabVIEW in all applications, but I have found that, in this particular use case, Python is particularly well suited.

I am an electrical engineer. When I first started learning Python, I had already deployed a few LabVIEW programs to production. Initially, I really loved it, but as time passed, I found that the time dedicated to maintenance and refactoring was surprisingly high. As a result, I found myself looking for other options and it took me a while to realize that Python is a potential replacement.

This series of articles is going to show you how I have made the transition from LabVIEW to Python and have been able to successfully deploy low-maintenance, high-performing automated test programs to engineering and manufacturing environments.

Overview

  • Why build with Python instead of Labview?
  • Hardware considerations
  • Software that you may want to get a handle on
  • Test methods and the need for a framework
  • User interaction
  • Deployment & Maintenance

Why Bother?

Perhaps the best question is "Why would you want to replace LabVIEW with Python?"

Great question! First, let's take a look at the pros and cons. I'm assigning points based on the things that I value thate most and on the relative strength. Take the numbers with a pinch - bag? - of salt.

Attribute Comparison LabVIEW Python
Cost LabVIEW costs annually about $2k / license for each seat. Python sticker price is $0. +2
Introductory GUI LabVIEW's drag and drop GUI interface makes the first "hello, world" GUI a breeze. Programming your first GUI in Python requires quite a bit more training and knowledge. +3
Standard Library LabVIEW and Python both have very good standard libraries. +1 +1
External Libraries LabVIEW has some libraries out there, but a quick perusal of PyPI shows 219k `pip`-installable libraries that have been community developed ready to be installed. Many more are available on GitHub. +5
Community LabVIEW has some communities out there, but they tend to be relatively small and somewhat isolated. The ease of picking up Python has made it one of the easiest languages to extend and with tools such as `pip` coming on the scene in the last couple of decades, Python is a *strong* competitor. +2
Ease of Deployment LabVIEW has some cool installers available. They tend to be gigabytes, but they also tend to work pretty well.. Python itself doesn't have a lot of deployment strength on its own, but packages such as PyInstaller have made deployment in linux and windows a breeze. +2
Ease of Maintenance With PyInstaller, maintenance is a breeze. One can deploy multiple executables "compiled" with different versions of Python without them interfering with one another. I haven't had to actually install Python to any of my target machines because of the method that PyInstaller utilized to package the interpreter with the executable. +3
Open Source If you care about open source, Python is, LabVIEW isn't. +1
Speed I haven't done a speed comparison so I can't say what the relative speeds of performing the same task might be. Perhaps someone else could shed some light on this? ? ?
Platforms I haven't tried LabVIEW on linux, but I know that Python works on all major platforms. There are instructions regarding the installation of LabVIEW available from National Instruments, so it appears that the platform is not a limitation with either. 0 0
Source Control Python, being a text language, works quite well with Git, Subversion, etc. LabVIEW *can* work, but doesn't really shine since its VIs are binary files. +2
Professional Image Knowledge of Python transfers well to other problem domains, such as web development and data science. LabVIEW is used primarily to control and read instrumentation, limiting its broader appeal. +3
Hardware Support Since National Instruments makes a lot of hardware for LabVIEW, hardware support is definitely a strength. Community-contributed packages for Python such as pyvisa have closed the gap. Anything that has a C API (all NI hardware) also can be used in Python, but not as easily. As a result, I have started looking for instruments that have a text-based command and written classes to use them more intuitive. Because of the ease of use of the NI hardware, LabVIEW has a bit of an edge here. +2

Clearly, Python has some serious advantages! My take on this...

Reasons to go with LabVIEW

  • You already have experience with LabVIEW and you've already paid for it
  • You like maintenence and fees
  • Easy GUIs! "Hello, World" is likely the easiest drag and drop of just about any GUI in any language
  • Quick access to hardware through well-defined virtual instruments

Reasons to go with Python

  • You're broke and don't have the option anyway
  • There is currently no established language or platform (new business)
  • Low maintence is a primary requirement
  • There is already some Python knowledge internally (data scientist, for instance)
  • Developer wants to have more transferrable skills
  • Open source matters
  • Community strength matters

How to make the Switch from LabVIEW to Python?

The remainder of the articles will focus on different aspects of making the switch to Python.



© by Jason R. Jones 2016
My thanks to the Pelican and Python Communities.