Skip to content

pandas tests fail when matplotlib is headless #18513

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

Closed
1kastner opened this issue Nov 27, 2017 · 5 comments
Closed

pandas tests fail when matplotlib is headless #18513

1kastner opened this issue Nov 27, 2017 · 5 comments
Labels
Testing pandas testing functions or related to the test suite Windows Windows OS

Comments

@1kastner
Copy link

Reproduce

Run pandas in a Windows Subsystem Linux and have matplotlib installed.

Problem description

Several tests fail with _tkinter.TclError: no display name and no $DISPLAY environment variable. Sometimes try/catch blocks are nested in a way that (most likely for the same reason) variables are not declared etc.

Expected Output

Skip matplotlib tests or set up a functioning backend when issues with its setup are detected.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: 8a2176d
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-43-Microsoft
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.22.0.dev0+292.g8a2176d
pytest: 3.2.5
pip: 9.0.1
setuptools: 36.7.2
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.5
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@1kastner 1kastner changed the title pandas tests fail when matplotlib is not completely set up pandas tests fail when matplotlib is headless Nov 27, 2017
@jbrockmendel
Copy link
Member

I’ve had the same issue. The fix I use is to import matplotlib before pandas, then do “matplotlib.use(‘agg’)”, then import pandas and run pd.test(). No idea how windows will affect things.

@gfyoung gfyoung added Testing pandas testing functions or related to the test suite Windows Windows OS labels Nov 27, 2017
@gfyoung
Copy link
Member

gfyoung commented Nov 27, 2017

@1kastner : I think the error message gives you a good way to check this:

https://stackoverflow.com/questions/8257385/automatic-detection-of-display-availability-with-matplotlib

That being said, we should make sure that checking for DISPLAY isn't going to accidentally affect how tests are run on Travis, Appveyor, and Circle.

The other thing is that you should try is to install X server if you haven't so already:

https://askubuntu.com/questions/823352/windows-10-bash-cannot-connect-to-display

@1kastner
Copy link
Author

But don't you think that this dependency is a bit strict? It is great that pandas can visualize something using matplotlib but for testing purposes I'd rather encapsulate it or make it skippable like the slow tests or the network tests.

@WillAyd
Copy link
Member

WillAyd commented Dec 13, 2017

Are you still having this issue on master? Curious if it was resolved by #18427

@1kastner
Copy link
Author

It is solved now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Windows Windows OS
Projects
None yet
Development

No branches or pull requests

4 participants