Hi,
I am using Ubuntu 20.04
I installed the u3 (u3-lv) accurding to the instractions.
When I tried to import the u3 library in python I get:
$ python
Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import u3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'u3'
On the other hand, I can get the example to run:
exodriver-master/examples/U3$ ./u3BasicConfigU3
Results of ConfigU3:
FirmwareVersion = 1.46
BootloaderVersion = 0.27
HardwareVersion = 1.30
SerialNumber = 320090844
ProductID = 3
LocalID = 1
TimerCounterMask = 64
FIOAnalog = 0
FIODireciton = 0
FIOState = 255
EIOAnalog = 0
EIODirection = 0
EIOState = 255
CIODirection = 0
CIOState = 15
DAC1Enable = 1
DAC0 = 0
DAC1 = 0
TimerClockConfig = 2
TimerClockDivisor = 0
CompatibilityOptions = 0
VersionInfo = 2
DeviceName = U3-LV
I installed the LabJackPython folder
LabJackPython-2.0.4$ sudo python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying src/LabJackPython.py -> build/lib.linux-x86_64-2.7
copying src/Modbus.py -> build/lib.linux-x86_64-2.7
copying src/u3.py -> build/lib.linux-x86_64-2.7
copying src/u6.py -> build/lib.linux-x86_64-2.7
copying src/ue9.py -> build/lib.linux-x86_64-2.7
copying src/u12.py -> build/lib.linux-x86_64-2.7
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/LabJackPython-2.0.4.egg-info
Writing /usr/local/lib/python2.7/dist-packages/LabJackPython-2.0.4.egg-info
I tried to run the python command on python version 3.8, 3.6 and 2.7 and I get the same command.
Will appriciate any help,
Nachshon
That ModuleNotFoundError when importing the u3 module indicates LabJackPython and its modules are not installed for Python 3.6, or couldn't be found. The install output mentions installation to Python 2.7, and you are trying to run it in Python 3.6 when running python and its interactive console. Likely when running the examples with "./" it is using Python 2.7. Python module installation is not global to all Python versions, so make sure to install for the version of Python you want to use when there are multiple versions on your system.
I am unsure why on your system "sudo python setup.py install" and "python" are using different versions of Python, but if you want to install to Python 3.6, from the LabJackPython folder try the command:
sudo python3.6 setup.py install
If python3.6 is not found, you can check the python binaries on your system with:
ls -l /usr/bin/python*
Thanks for the quick replay.
I installed using python 3.8, but I get the same error:
$ sudo python3.8 setup.py install
running install
running build
running build_py
creating build/lib
copying src/LabJackPython.py -> build/lib
copying src/Modbus.py -> build/lib
copying src/u3.py -> build/lib
copying src/u6.py -> build/lib
copying src/ue9.py -> build/lib
copying src/u12.py -> build/lib
running install_lib
copying build/lib/Modbus.py -> /usr/local/lib/python3.8/dist-packages
copying build/lib/u6.py -> /usr/local/lib/python3.8/dist-packages
copying build/lib/ue9.py -> /usr/local/lib/python3.8/dist-packages
copying build/lib/u3.py -> /usr/local/lib/python3.8/dist-packages
copying build/lib/u12.py -> /usr/local/lib/python3.8/dist-packages
copying build/lib/LabJackPython.py -> /usr/local/lib/python3.8/dist-packages
byte-compiling /usr/local/lib/python3.8/dist-packages/Modbus.py to Modbus.cpython-38.pyc
byte-compiling /usr/local/lib/python3.8/dist-packages/u6.py to u6.cpython-38.pyc
byte-compiling /usr/local/lib/python3.8/dist-packages/ue9.py to ue9.cpython-38.pyc
byte-compiling /usr/local/lib/python3.8/dist-packages/u3.py to u3.cpython-38.pyc
byte-compiling /usr/local/lib/python3.8/dist-packages/u12.py to u12.cpython-38.pyc
byte-compiling /usr/local/lib/python3.8/dist-packages/LabJackPython.py to LabJackPython.cpython-38.pyc
running install_egg_info
Writing /usr/local/lib/python3.8/dist-packages/LabJackPython-2.0.4.egg-info
~/LabJackPython$ python
Python 3.8.5 (default, Aug 5 2020, 08:36:46)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import u3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'u3'
What if you run:
python3.8
Does the "import u3" work then?
I have managed to get it to work under python3.8 but not under 3.6 -> with is the version I need for anothert package
$ sudo python3.6 setup.py install
running install
running bdist_egg
running egg_info
writing src/LabJackPython.egg-info/PKG-INFO
writing dependency_links to src/LabJackPython.egg-info/dependency_links.txt
writing top-level names to src/LabJackPython.egg-info/top_level.txt
reading manifest file 'src/LabJackPython.egg-info/SOURCES.txt'
writing manifest file 'src/LabJackPython.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
copying build/lib/Modbus.py -> build/bdist.linux-x86_64/egg
copying build/lib/u6.py -> build/bdist.linux-x86_64/egg
copying build/lib/ue9.py -> build/bdist.linux-x86_64/egg
copying build/lib/u3.py -> build/bdist.linux-x86_64/egg
copying build/lib/u12.py -> build/bdist.linux-x86_64/egg
copying build/lib/LabJackPython.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/Modbus.py to Modbus.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/u6.py to u6.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/ue9.py to ue9.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/u3.py to u3.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/u12.py to u12.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/LabJackPython.py to LabJackPython.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying src/LabJackPython.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/LabJackPython.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/LabJackPython.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying src/LabJackPython.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/LabJackPython-2.0.4-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing LabJackPython-2.0.4-py3.6.egg
Removing /usr/local/lib/python3.6/site-packages/LabJackPython-2.0.4-py3.6.egg
Copying LabJackPython-2.0.4-py3.6.egg to /usr/local/lib/python3.6/site-packages
LabJackPython 2.0.4 is already the active version in easy-install.pth
Installed /usr/local/lib/python3.6/site-packages/LabJackPython-2.0.4-py3.6.egg
Processing dependencies for LabJackPython==2.0.4
Finished processing dependencies for LabJackPython==2.0.4
(Psypy) ~$ python3.6
Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import u3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'u3'
Strange. I wonder if you have multiple versions of Python 3.6 installed.
Try installing with:
sudo /usr/bin/python3.6 setup.py install
And run Python with the following so you can try the import u3:
/usr/bin/python3.6
To help figure this out further, let me know the results of this command:
ls -l /usr/bin/python*
And in the interactive console where the import is failing, run the following to see directory paths on your system for that version of Python:
import sys
print(sys.path)
In particular we are trying to see if the site-packages directory is the same as where the installation installs it.
Also, run:
sudo python3.6
To see what version of Python it is and if it matches:
Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
[GCC 7.3.0] on linux