Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matplotlib raises error #1215

Closed
rtotheb2000 opened this issue Nov 3, 2016 · 5 comments
Closed

matplotlib raises error #1215

rtotheb2000 opened this issue Nov 3, 2016 · 5 comments

Comments

@rtotheb2000
Copy link

Hi,

I am trying to install matplotlib on a fresh conda installation, which throws:

Linking packages ...
[COMPLETE]|###################################################################| 100%
dbus post-link :: /etc/machine-id not found ..
dbus post-link :: .. using /proc/sys/kernel/random/boot_id

.

Information about the os:

lsb_release -a

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: Scientific
Description: Scientific Linux release 6.8 (Carbon)
Release: 6.8
Codename: Carbon

Using matplotlib.pyplot in a script then leads to

QXcbConnection: Could not connect to display

and trying to set

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

raised

python3.5/site-packages/matplotlib/__init__.py:1357: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen;

Can someone help with this error? I am sorry, if that is not actually a bug and I am just to uninformed to understand the issue. But setting up a new env and only trying to install matplotlib created the exact same behavior.

@rtotheb2000 rtotheb2000 changed the title installing matplotlib raises linking error installing matplotlib raises error Nov 3, 2016
@ccordoba12
Copy link

@mingwandroid?

@mingwandroid
Copy link

The text is informative only, nothing to worry about.

How are you using matplotlib? From with Spyder? If so, this may be useful:

http://stackoverflow.com/questions/23452550/spyder-matplotlib-userwarning-this-call-to-matplotlib-use-has-no-effect-becau

@rtotheb2000
Copy link
Author

rtotheb2000 commented Nov 4, 2016

@mingwandroid I do not use it from any IDE (spyder or any other), I just run a script python test.py importing pyplot as specified above and it raises the described error.

Minimal example that raises the error:

import matplotlib.pyplot as plt
plt.plot()

python test.py
QXcbConnection: Could not connect to display localhost:0.0
Aborted (core dumped)

@rtotheb2000
Copy link
Author

rtotheb2000 commented Nov 4, 2016

This seems to work:

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
plt.ioff() #http://matplotlib.org/faq/usage_faq.html (interactive mode)

source: Stackoverflow - Problem running python/matplotlib in background after ending ssh session

And this warning

python3.5/site-packages/matplotlib/__init__.py:1357: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen;

goes away when I import matplotlib first (before numpy, pandas, seaborn, etc.). So my guess is that maybe seaborn or pandas sets some kind of matplotlib env already.

@rtotheb2000 rtotheb2000 changed the title installing matplotlib raises error matplotlib raises error Nov 4, 2016
@mingwandroid
Copy link

Ah yes, of course. Thanks for updating us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants