JYU-IBA / potku

Potku is analysis and simulation software for ToF-ERD measurements
https://www.jyu.fi/science/en/physics/research/infrastructures/accelerator-laboratory/pelletron/potku/
GNU General Public License v2.0
7 stars 7 forks source link

Update Python version #198

Closed tpitkanen closed 1 year ago

tpitkanen commented 3 years ago

Potku has been developed for Python 3.6, while Python 3.10 will be released on 2021-10-04. Potku's Python version should be updated at some point to get new Python features, such as:

Updating the Python version will require some code changes: at least on Python 3.8, some unit tests related to MCERD fail. Libraries (NumPy, Matplotlib etc.) should be updated too.

Also, the latest available Windows installer version of Python 3.6 is 3.6.8, while the newest release is 3.6.14.

tpitkanen commented 2 years ago

I tried out Python 3.10 and the newest libraries last week. Here are my findings.

I configured updates by editing the Pipfile like so:

After updating, remember to pin the versions again (for stability I guess?) and commit the new Pipfile.lock.

Minor issues

GUIReporter doesn't support floats anymore. Fix (widgets/gui_utils.py):

         def __update_func(value):
             # Callback function that will be connected to the signal
             if progress_bar is not None:
+                value = int(value)
                 progress_bar.setValue(value)

Unsupported version of NavigationToolbar2QT. Fix (widgets/matplotlib/base.py):

-from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT
+from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT

MCERD issue

MCERD doesn't start at all. Trying to run an element simulation throws an error code (that I can't remember right now, but the exact number seems to vary anyway). At least some of the other C programs work (get_espe at least, can't remember which others).

MCERD is the only part of Potku that uses rx (in mcerd.py and nsgaii.py), so I would look into that. The culprit may be elsewhere, so check the input data too.

Other possible issues

"tof_list|erd_depth pipeline returned an error code ..." used to be problematic. It may act up again.

Unit tests may reveal more issues, but I didn't have time to run them.

jaakkojulin commented 2 years ago

This is now quite important in my opinion, e.g. installing Python 3.6.15 or older versions via pyenv apparently does not work in latest versions of macOS, at least not without applying some patches.

samivout commented 1 year ago

Closing outdated issue, Python has been upgraded to 3.10.