LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView and Python ... macOS edition

Hi,

 

I just installed LabView 2018 x64 bit (long time user) and Python 3.6 (total novice) on my Mac to streamline 2d curve fitting in LV.

 

I could make 2.7 version running, but 3.6 version still give 1663 error message.  Note that 2.7 version came with OS and is installed in /usr/bin directory while 3.6 was installed via macports and resides in /opt/local/bin (note that this directory is included in $PATH).  Is there a way to convince LV to scan this directory?

 

I have spent hours to make fitting routine work in 3.7 (and 3.6 ... I tried) so I really would like to make that version work with LV.

 

Any insight is appreciated.

 

Thanks,

Radek

0 Kudos
Message 1 of 7
(2,974 Views)

What's the error message that comes with the 1663 error code?

0 Kudos
Message 2 of 7
(2,910 Views)

Hi,

 

The explanation of error 1663 states:

 

"LabVIEW: (Hex 0x67F) Unable to load the Python interpreter of the specified version. Ensure that you install the supported versions of Python, and the bitness of Python matches the bitness of LabVIEW that opens the Python session."

 

I do have Python 3.6 installed via macports and is therefore located in /opt/local/bin instead of /usr/bin.  In recent versions of Mac OS the /usr/bin is protected and practically un-writable even with sudo command.  I have tried creating links in /usr/local/bin, but no luck there either.  I have checked my $PATH variable and all directories are included.  I have also checked bitness of both LabView and Python and they match.

 

I suppose my really question is:

Is it possible to point LabView's python node to /opt/local/bin instead of /usr/bin?

 

Thank you,

Radek

0 Kudos
Message 3 of 7
(2,904 Views)

Are you able to Python 2.7 as a temporary workaround? For now, I was unable to change where that Python Node points to in LabVIEW 2018. Unfortunately, I think you'll have to stick with 2.7. Keep us posted if you find anything though and I'll do the same on my end.

0 Kudos
Message 4 of 7
(2,892 Views)

Thanks for the reply.

 

I guess I would like the confirmation that python node in LB indeed looks ONLY in /usr/bin.  I did try creating a link (both ln and ln -s) in /usr/local/bin, but that failed as well.  Either let user specify path to executables or look in $PATH.  

 

I suppose there is one more option which I am going to try ... there is a way to disable the system protection which blocks me from creating a link in /usr/bin using a recovery mode.  I am planning to disable, create a link, and re-enable the system protection.  I hope that works.

 

Is there a way to submit a ticket to NI about fixing this?

 

Btw, 3.6 works under Windows just fine (I had to uninstall 3.7 as I was naively hoping to keep the same versions on my personal Mac and lab PC ... oh well).

 

Cheers,

Radek

0 Kudos
Message 5 of 7
(2,882 Views)

A quick update ...

 

I made things work ... kind of.

 

First of.  Linking python3.6 to /usr/bin does not work.  I finally realized that everything is installed in /System/Library/Frameworks/Python.framework/Versions/3.6 (or 2.7 etc.).  So I linked my Macports install to that directory and voila ... LabView can find and version 3.6 runs, except ...

 

As soon as I try to load libraries (such as Image from PILLOW) I get an error message that python is not installed as framework.  Here is the error message ...

 

Module Path: /Users/radek/Documents/LabVIEW Data/_VIs/first.py
Function Name: load_image
Python returned the following error: <class 'ImportError'>
Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
<traceback object at 0x112962148>


Call Stack information:
['Traceback (most recent call last):
', ' File "/Users/radek/Documents/LabVIEW Data/_VIs/first.py", line 4, in <module>
import matplotlib.pyplot as plt
', ' File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2371, in <module>
switch_backend(rcParams["backend"])
', ' File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
', ' File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
', ' File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 14, in <module>
from matplotlib.backends import _macosx
', "ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ f

 

I am not sure what to try next.  I noticed that "standard" python installer for Mac installs in /Library/Frameworks instead of /System/Library/Frameworks ... perhaps one more thing to try.

 

I would greatly appreciate any insights people might have.

 

Best,

Radek

0 Kudos
Message 6 of 7
(2,836 Views)

Are you able to work on the Windows machine as a work around?

0 Kudos
Message 7 of 7
(2,827 Views)