matiasandina / FEDWatcher

Software and Hardware to connect FED3 devices over serial on Raspberry Pi 4
MIT License
4 stars 1 forks source link

Support for python 3.9 and raspbian bullseye #36

Closed matiasandina closed 2 years ago

matiasandina commented 2 years ago

There were issues with installing the software in raspbian bullseye. After a simple import numpy:

(fedwatcher) pi@raspberrypi:~/FEDWatcher $ python3 fedwatcher/GUI.py 
Traceback (most recent call last):
  File "/home/pi/FEDWatcher/fedwatcher/GUI.py", line 5, in <module>
    import pandas as pd
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "/home/pi/FEDWatcher/fedwatcher/bin/python3"
  * The NumPy version is: "1.21.6"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
matiasandina commented 2 years ago

This first issue gets resolved with

sudo apt-get install libatlas-base-dev

Which is a dependency that needs to be installed for numpy to work.

matiasandina commented 2 years ago

Second error is

(fedwatcher) pi@raspberrypi:~/FEDWatcher $ python3 fedwatcher/GUI.py 
Traceback (most recent call last):
  File "/home/pi/FEDWatcher/fedwatcher/GUI.py", line 5, in <module>
    import pandas as pd
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/__init__.py", line 22, in <module>
    from pandas.compat import (
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/compat/__init__.py", line 15, in <module>
    from pandas.compat.numpy import (
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
    from pandas.util.version import Version
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/util/__init__.py", line 1, in <module>
    from pandas.util._decorators import (  # noqa
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/util/_decorators.py", line 14, in <module>
    from pandas._libs.properties import cache_readonly  # noqa
  File "/home/pi/FEDWatcher/fedwatcher/lib/python3.9/site-packages/pandas/_libs/__init__.py", line 13, in <module>
    from pandas._libs.interval import Interval
  File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject

I cannot import pandas in the virtual environment either. Get the same error.

matiasandina commented 2 years ago

After upgrading numpy via pip3 install -U numpy, error disappeared.

I'm not closing this until it can be replicated in a different environment.

image

suttonak commented 2 years ago

This solved the problem for me!!!

matiasandina commented 2 years ago

Issues continue:

There's probably an adjustment needed on f strings here.

Process Process-2:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/FEDWatcher/fedwatcher/src/fedwatcher.py", line 217, in runHelper
    self._save_all_df()
  File "/home/pi/FEDWatcher/fedwatcher/src/fedwatcher.py", line 403, in _save_all_df
    self._save_to_csv(df_data)
  File "/home/pi/FEDWatcher/fedwatcher/src/fedwatcher.py", line 368, in _save_to_csv
    filename = f"FED{df_data[0]['Device_Number']:03d}_{timestr}_{self.session_num:02d}.csv"
ValueError: Unknown format code 'd' for object of type 'str'
matiasandina commented 2 years ago

explicit int conversion solved the problem

image

There is still some corruption of strings, but this was present before #29