f90/Wave-U-Net

ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12

loretoparisi opened this issue ยท 6 comments

This is another potential issue when in macOS that can be handled changing matplotlib settings in ~/.matplotlib/matplotlibrc: with

backend : MacOSX
f90 commented

Can you confirm this permanently fixed your issue with matplotlib in your case? If so, I will add that into the Known issues / Troubleshooting section of the Readme for people who might encounter the same problem, since unfortunately it cannot be fixed on my end. Except if I ported the whole Project to Python >=2.8, but this seems overblown for this easily fixable problem on a specific platform.

@f90 Yes I confirm, this is a well known issue with matplotlib when on macOS.

f90 commented

OK thanks, I will link to this issue in the README. Closing this then.

@f90 I can be more precise. When on macOS you have two options. If python is installed as a framework you can choose backend: MacOSX. If not, you have to choose backend: TkAgg.
This means that if you are in virtualenv, at the end you MUST use this last one option. Outside virtualenv it's ok the first (!)

See here for more info https://markhneedham.com/blog/2018/05/04/python-runtime-error-osx-matplotlib-not-installed-as-framework-mac/

And here https://stackoverflow.com/a/21353372/758836

That's weird, isn'it? ๐Ÿ‘

f90 commented

Thanks.. Thats' awkward, so I will link to this info from the README for future people to avoid confusion

@f90 by the way there is another trick!!! You can even define your local matplotlibrc. I have just realized this (I was not aware this from the docs actually), because if you run Jupyter, and this is normally outside virtualenv, you need MacOSX backend ๐Ÿ‘ฏโ€โ™‚๏ธ

ip-192-168-22-127:Notebooks loretoparisi$ python --version
Python 2.7.15
ip-192-168-22-127:Notebooks loretoparisi$ cat ~/.matplotlib/matplotlibrc:
cat: /Users/loretoparisi/.matplotlib/matplotlibrc:: No such file or directory
ip-192-168-22-127:Notebooks loretoparisi$ cat ~/.matplotlib/matplotlibrc
backend : TkAgg
ip-192-168-22-127:Notebooks loretoparisi$ ls
README.md       data            hello.py        pandas.py       pima.py         simple.py
ip-192-168-22-127:Notebooks loretoparisi$ touch matplotlibrc
ip-192-168-22-127:Notebooks loretoparisi$ echo "backend : MacOSX" >> matplotlibrc
ip-192-168-22-127:Notebooks loretoparisi$

So I run in VSCode Juypyter but I had to overwrite locally this file ๐Ÿ—ก just commited this change!

schermata 2018-11-16 alle 10 36 03