SiLab-Bonn / basil

A data acquisition framework in Python and Verilog.
BSD 3-Clause "New" or "Revised" License
40 stars 29 forks source link

Pyserial module not listed in the requirements #188

Open Giakou opened 1 year ago

Giakou commented 1 year ago

Hi, is there any reason why pyserial is not listed in the requirements.txt? I have never used basil before, but I just cloned it in development mode and tried to execute a copy of basil/examples/lab_devices/xray_tube.py. This is the traceback:

Traceback (most recent call last):
  File "/home/pxd9/basil/basil/dut.py", line 255, in _factory
    mod = import_module(importname)
  File "/home/pxd9/anaconda3/envs/mosfet_irrad/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/pxd9/basil/basil/TL/Serial.py", line 9, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pxd9/mosfet_irrad/irrad/xray_irrad.py", line 35, in <module>
    device = Dut('xray_basil_config.yaml')
  File "/home/pxd9/basil/basil/dut.py", line 101, in __init__
    self.load_hw_configuration(self._conf)
  File "/home/pxd9/basil/basil/dut.py", line 200, in load_hw_configuration
    self._transfer_layer[intf['name']] = self._factory('basil.TL.' + intf['type'], *(), **kargs)
  File "/home/pxd9/basil/basil/dut.py", line 259, in _factory
    mod = import_module(importname)
  File "/home/pxd9/anaconda3/envs/mosfet_irrad/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'Serial'
Giakou commented 1 year ago

This is what pipreqs would give me:

bitarray==2.6.0
cocotb==1.7.1
cocotb_bus==0.2.1
crcmod==1.7
numpy==1.23.4
pyserial==3.5
pytest==7.2.0
pyvisa==1.12.0
PyYAML==6.0
sensirion_shdlc_driver==0.1.5
sensirion_shdlc_sensorbridge==0.1.1
setuptools==65.5.1
six==1.16.0
sphinx_rtd_theme==1.1.1
leloup314 commented 1 year ago

Hi, in general the basil.TL implementations which are build on top of existing modules, such as pyvisa or pyserial are not listed in the requirements it seems. I do not know if this was an intentional design choice at the time to only list core requirements in the .txt and have users install additional things if they need to use corresponding basil parts but one can argue for both. We could think about adding certain things to the requirements

Giakou commented 1 year ago

I think that since basil is on PyPi it would make sense to install at least the basic requirements (maybe not their dependencies). But, this is just my opinion.