Intel® Distribution for Python*
Support and discussions for achieving faster Python* applications and core computational packages.

Problem with matplotlib

guo_z_
Beginner
759 Views

I am a user of latest version of intel distribution for python. But I find problem of using matplotlib.

My OS is Ubuntu 64bit 16.04. Because I don't like the default backend of matplotlib, so I chang it from WebAgg to Qt4Agg and I get the flowing error messages:

-------------------------------------------

(idp) colafish@Dell:~$ python
Python 2.7.12 |Intel Corporation| (default, Aug 15 2016, 04:18:18) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import matplotlib.pyplot as plt
>>> plt.plot()
Fontconfig error: Cannot load default config file
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.

(python:15563): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-fcitx.so) initialization check failed: GLib version too old (micro mismatch)

(python:15563): Gtk-WARNING **: Loading IM context type 'fcitx' failed

(python:15563): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-fcitx.so) initialization check failed: GLib version too old (micro mismatch)

(python:15563): Gtk-WARNING **: Loading IM context type 'fcitx' failed

(python:15563): Gtk-WARNING **: GModule (/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-fcitx.so) initialization check failed: GLib version too old (micro mismatch)

(python:15563): Gtk-WARNING **: Loading IM context type 'fcitx' failed
[]
>>> plot.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'plot' is not defined
>>> plt.show()
>>> 

-------------------------------------------

I install intel distribution for python using conda.

I install idp on the latest version debian, I got the "Fontconfig error: Cannot load default config file" too.

0 Kudos
6 Replies
guo_z_
Beginner
759 Views

I install intel python distribution on centos 7 64bit. when I change the back end from WebAgg to TkAgg, The same Fontconfg error emerge again.

Christophe_H_Intel2
759 Views

Hello,

Thanks for bringing this issue to our attention. I was able to install Continuum's pyqt package into a conda environment with Intel Python and successfully change the backend to Qt4Agg.

# Create a conda environment with Intel Python and Intel's matplotlib and tornado packages
$ conda create -n mpl -c intel --override-channels matplotlib tornado
# Activate the environment
$ source activate mpl
# Install Continuum's pyqt package into the Intel environment
$ conda install pyqt=4
# Run python, change the backend and show a simple plot
$ python

>>>import matplotlib

>>>matplotlib.use('Qt4Agg')

>>>import matplotlib.pyplot as plt

>>>plt.plot([1,2,3,4])

>>>plt.show()

I did see the Fontconfig error you pointed out, but matplotlib seems to work fine otherwise.  Are you able to see plots after you get the Fontconfig error?

guo_z_
Beginner
759 Views

Dear Christopher H thanks for your replying. I will test matplotlib  according to your instruction.

Now if I install intel distribution for python by the pack download from intel web site. I do not using conda to manage python environment. when I use pip to install pyqt4, however, there is no pack name pyqt4 to install. How can I install pyqt package?

And why the intel distribution for python matplotlib do not use Qt4agg as the default backend?

 

guo_z_
Beginner
759 Views

how to make the qt4agg as the default backend?

Christophe_H_Intel2
759 Views

Hi Guo,

To set your default backend to Qt4Agg, you can modify the matplotlibrc file located in <PY_INSTALL_PATH>/lib/python<VERSION>/site-packages/matplotlib/mpl-data/matplolibrc.

Change

backend : WebAgg

to

backend : Qt4Agg

If you already have a matplotlibrc file in ~/.config/matplotlib, it will read that one first, so you can set the default backend there instead of the site-packages folder.

After you've set the backend, you should see

python -c "import matplotlib; matplotlib.get_backend()"
> 'Qt4Agg'

I hope that helps.

Chris

sylvian_k_
Beginner
759 Views

I did what is in Christopher post above and I got some error concerning the MKL library (bellow)

 

Reply