Flair issue: No module named 'matplotlib'

Deer Fluke experts,

I was running Flair, with python27, gcc10 Xcode 9.4.1in my MaCBook Air (High Sierre v10.13.6).
I decide to update the system move to python 39 and the last version of Flair. I also updated the ports “sudo port selfupdate” and “port upgrade outdated”.

Now flair is giving this error :

./flair-3.1/flair
Traceback (most recent call last):
File “/Users/matteovolpi/./flair-3.1/flair.py”, line 113, in
import MPPlot
File “/Users/matteovolpi/flair-3.1/MPPlot.py”, line 20, in
import matplotlib
ModuleNotFoundError: No module named ‘matplotlib’

I try to clean and reinstall all the ports as suggested in the flair recommendation manual
http://flair.web.cern.ch/flair/download.html

But it looks like OpenBLAS is broken
sudo port install py39-matplotlib +tkinte
—> Computing dependencies for OpenBLAS
—> Fetching archive for OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc10+lapack.darwin_17.x86_64.tbz2 from Index of /OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc10+lapack.darwin_17.x86_64.tbz2 from Index of /macports/packages/OpenBLAS/
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc10+lapack.darwin_17.x86_64.tbz2 from Index of /mirror/macports/packages/OpenBLAS/
—> Building OpenBLAS
Error: Failed to build OpenBLAS: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_OpenBLAS/OpenBLAS/main.log for details.
Error: Unable to execute port: upgrade py39-numpy failed

Here you can see the log file:

Cheers and thank you very much in advance.

Matteo

Hello @mvolpi ,

I do not have a machine with your setup but it looks like you have a Macports installation problem.

When you cleaned up the old installation, have you run this command
port uninstall installed?

Cheers, Luigi

HI Luigi,

Thank you for your help, I tried several time “port uninstall installed”.
But it fails when I rebuild OpenBlas , for example when I installed py39-numpy:

—> Computing dependencies for py39-numpy
The following dependencies will be installed:
OpenBLAS
cython_select
fftw-3
py39-cython
Continue? [Y/n]: y
—> Fetching archive for OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /macports/packages/OpenBLAS/
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /mirror/macports/packages/OpenBLAS/
—> Building OpenBLAS
Error: Failed to build OpenBLAS: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_OpenBLAS/OpenBLAS/main.log for details.
Error: Follow MacPorts Guide if you believe there is a bug.
Error: Processing of port py39-numpy failed"

The log file is here: Dropbox - File Deleted - Simplify your life

I also check “port echo requested”
gcc11 @11.1.0_2
gnuplot @5.4.2_0+aquaterm+luaterm+pangocairo+wxwidgets+x11
pkgconfig @0.29.2_0
py39-Pillow @8.2.0_0
py39-tkinter @3.9.6_0
python39 @3.9.6_0
xorg @20090316_0
xorg-server @1.20.11_1

I tried gcc10 but I got the same results.

Ciao

Matteo

Hello @mvolpi ,

I do not believe that the problem is related to gcc version (although I would not recommend you to use gcc11 since we had some problems in the past).

I tested your MacPorts configuration on my machine and I’m not able to reproduce your error.
However, I have a different version of the OS (Big Sur version 11.4) and Command Line Tools (version 2384)

Since your XCode version is old, I would suggest updating the Command Line Tools.
It can be done this way:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Cheers Luigi

Hello Luigi,

Thank you again for your help, I update Xcode, cleaned the old installations and reinstalled gcc10.

port echo requested
gcc10 @10.3.0_0
gnuplot @5.4.2_0+aquaterm+luaterm+pangocairo+wxwidgets+x11
pkgconfig @0.29.2_0
py39-Pillow @8.2.0_0
py39-tkinter @3.9.6_0
python39 @3.9.6_0
xorg @20090316_0
xorg-server @1.20.11_1

But I get the same issue with OpenBLAS.
I noticed that OpenBlas required gcc11.

"sudo port install py39-numpy
—> Computing dependencies for py39-numpy
The following dependencies will be installed:
OpenBLAS
cython_select
fftw-3
gcc11
py39-cython
Continue? [Y/n]: y
—> Fetching archive for gcc11
—> Attempting to fetch gcc11-11.1.0_2.darwin_17.x86_64.tbz2 from Index of /gcc11
—> Attempting to fetch gcc11-11.1.0_2.darwin_17.x86_64.tbz2.rmd160 from Index of /gcc11
—> Installing gcc11 @11.1.0_2
—> Activating gcc11 @11.1.0_2
—> Cleaning gcc11
—> Fetching archive for OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /OpenBLAS
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /macports/packages/OpenBLAS/
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11+lapack.darwin_17.x86_64.tbz2 from Index of /mirror/macports/packages/OpenBLAS/
—> Building OpenBLAS
Error: Failed to build OpenBLAS: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_OpenBLAS/OpenBLAS/main.log for details.
Error: Follow MacPorts Guide if you believe there is a bug.
Error: Processing of port py39-numpy failed

Log file here: Dropbox - main.log - Simplify your life

Maybe my OS is to old for the new versions, should I install back python27 and the old ports?

Cheers and thank you for your time.

Matteo

That’s strange Matteo.

I do not have the gcc11 port installed, but only gcc10.

Have you updated the port definition?
sudo port selfupdate?

Hi Luigi,

Thank you, after the selfupdate I finally installed openblas and all the ports:
It was fetching OpenBLAS-0.3.16 instead of 0.3.17, still with gcc11
—> Attempting to fetch OpenBLAS-0.3.16_0+gcc11

Now I have all the ports
port echo requested
gcc10 @10.3.0_0
gdb @10.2_0
ghostscript @9.54.0_0+x11
gnuplot @5.4.2_0+aquaterm+luaterm+pangocairo+wxwidgets+x11
pkgconfig @0.29.2_0
py39-matplotlib @3.4.2_0+tkinter+webagg
py39-numpy @1.21.0_0+gfortran+openblas
py39-Pillow @8.2.0_0
py39-pip @21.1.3_0
py39-pydicom @2.1.2_0
py39-scipy @1.7.0_0+gfortran+openblas
py39-tkinter @3.9.6_0
python39 @3.9.6_0
xorg @20090316_0
xorg-server @1.20.11_1

But still get the same error when I run flair

./flair-3.1/flair
Traceback (most recent call last):
File “/Users/matteovolpi/./flair-3.1/flair.py”, line 113, in
import MPPlot
File “/Users/matteovolpi/flair-3.1/MPPlot.py”, line 20, in
import matplotlib
ModuleNotFoundError: No module named ‘matplotlib’

Thank you again.

Matteo

Hi @mvolpi ,

what is the output of the command which python3?

Cheers Luigi

HI @luillo,

Sorry for the late answer I am probably in a different time zone (Melbourne).
This is what I get:
which python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

Cheers

Matteo

Hi @mvolpi

you’re not using python3 from the MacPorts installation.

Try to launch flair with the following command
$> PYTHON=/opt/local/bin/python3 PATH_FLAIR/flair

where PATH_FLAIR is the directory path where Flair was expanded.

This should fix the problem.
Let me know if it works.

Cheers, Luigi

Hi @luillo

It works ! Thank you very much !

Matteo