The error when run flair

Versions

Please provide the used software versions.

FLUKA:4-5.1
Flair:3-3.1
Operating system:ubuntu20.04

Description

Please describe the issue. In case of reporting a bug, please provide step-by-step instructions for reproducing the error.

Input files

Please upload all relevant files. (FLUKA input file, Flair project file, user routines, and data files)

rtqc@ubuntu:~$ flair
Traceback (most recent call last):
File “/usr/local/flair/flair.py”, line 88, in
import inputs
File “/usr/local/flair/inputs.py”, line 18, in
import fluka
File “/usr/local/flair/fluka/init.py”, line 31, in
from .input import Fluka, LowNeutMaterial
File “/usr/local/flair/fluka/input.py”, line 245, in
class Fluka(Input):
File “/usr/local/flair/fluka/input.py”, line 260, in Fluka
abundances : dict[int,list[tuple[int,float]]] = {}
TypeError: ‘type’ object is not subscriptable

After update the flair, when running flair, the error message reported. Could you please advise how to solce it? thank you in advanced.

Dear Jilong,

Please confirm that you are getting the error with the latest Flair version, 3.4-5.2.

Cheers,
David

rtqc@ubuntu:~/Downloads$ sudo dpkg -i flair_3.4-5.2_ubuntu20.04_all.deb
(Reading database … 192056 files and directories currently installed.)
Preparing to unpack flair_3.4-5.2_ubuntu20.04_all.deb …
Unpacking flair (3.4-5.2) over (3.4-5.2) …
Setting up flair (3.4-5.2) …
Processing triggers for shared-mime-info (1.15-1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu3) …
Processing triggers for mime-support (3.64ubuntu1) …
rtqc@ubuntu:~/Downloads$ flair
Traceback (most recent call last):
File “/usr/local/flair/flair.py”, line 88, in
import inputs
File “/usr/local/flair/inputs.py”, line 18, in
import fluka
File “/usr/local/flair/fluka/init.py”, line 31, in
from .input import Fluka, LowNeutMaterial
File “/usr/local/flair/fluka/input.py”, line 245, in
class Fluka(Input):
File “/usr/local/flair/fluka/input.py”, line 260, in Fluka
abundances : dict[int,list[tuple[int,float]]] = {}
TypeError: ‘type’ object is not subscriptable

Thank you. I deleted the previous flair (/usr/local/ and re-download and installed it, but the problem still persists.

Dear Jilong,

Please check what your Python version is.

Flair (or at least the line causing the error) requires version 3.9 to work correctly.

Cheers,
David

Thank you, David.

It’s a problem with the Python version. Currently, on the Ubuntu system, the version is Python 3.8. Thank you.

Dear Jilong,

You may try to install Python 3.9, but I’m not sure all packages needed for Flair are available for this version of Python on Ubuntu 20.04.

Instead, I would recommend upgrading your Ubuntu version to at least 22.04, since the normal support for Ubuntu 20.04 ended in May last year.

Cheers,
David

Thank you for your reminder. I will also consider upgrading the system. Thank you.