arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.59k stars 395 forks source link

Tests fail to run: E _tkinter.TclError: no display name and no $DISPLAY environment variable #2341

Open yurivict opened 5 months ago

yurivict commented 5 months ago

Describe the bug

cd /usr/ports/math/py-arviz/work-py39/arviz-0.18.0 && /usr/bin/env -i HOME=/usr/ports/math/py-arviz/work-py39  PWD="${PWD}"  __MAKE_CONF=/nonexistent OSVERSION=1400509 PATH=/usr/local/libexec/ccache:/usr/ports/math/py-arviz/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin TERM=xterm-256color XDG_DATA_HOME=/usr/ports/math/py-arviz/work-py39  XDG_CONFIG_HOME=/usr/ports/math/py-arviz/work-py39  XDG_CACHE_HOME=/usr/ports/math/py-arviz/work-py39/.cache  HOME=/usr/ports/math/py-arviz/work-py39 PATH=/usr/local/libexec/ccache:/usr/ports/math/py-arviz/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin PKG_CONFIG_LIBDIR=/usr/ports/math/py-arviz/work-py39/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  " CCACHE_DIR="/tmp/.ccache" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts= 
==================================================================================== test session starts ====================================================================================
platform freebsd14 -- Python 3.9.18, pytest-7.4.4, pluggy-1.4.0 -- /usr/local/bin/python3.9
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/usr/ports/math/py-arviz/work-py39/arviz-0.18.0/.hypothesis/examples'))
rootdir: /usr/ports/math/py-arviz/work-py39/arviz-0.18.0
configfile: pytest.ini
plugins: anyio-4.3.0, time-machine-2.11.0, flaky-3.7.0, aspectlib-2.0.0, typeguard-4.1.5, hypothesis-6.98.18, xdoctest-1.1.2, xdist-3.5.0, cov-4.1.0, flakes-4.0.5, timeout-2.1.0, rerunfailures-11.1.2
collected 2922 items / 1 error / 6 skipped                                                                                                                                                  

========================================================================================== ERRORS ===========================================================================================
_____________________________________________________________ ERROR collecting arviz/tests/base_tests/test_plots_matplotlib.py ______________________________________________________________
arviz/tests/base_tests/test_plots_matplotlib.py:138: in <module>
    {"ax": plt.subplots(6, 3)[1]},
/usr/local/lib/python3.9/site-packages/matplotlib/pyplot.py:1598: in subplots
    fig = figure(**fig_kw)
/usr/local/lib/python3.9/site-packages/matplotlib/pyplot.py:934: in figure
    manager = new_figure_manager(
/usr/local/lib/python3.9/site-packages/matplotlib/pyplot.py:465: in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
/usr/local/lib/python3.9/site-packages/matplotlib/backend_bases.py:3396: in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
/usr/local/lib/python3.9/site-packages/matplotlib/backend_bases.py:3401: in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
/usr/local/lib/python3.9/site-packages/matplotlib/backend_bases.py:1785: in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
/usr/local/lib/python3.9/site-packages/matplotlib/backends/_backend_tk.py:486: in create_with_canvas
    window = tk.Tk(className="matplotlib")
/usr/local/lib/python3.9/tkinter/__init__.py:2270: in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
E   _tkinter.TclError: no display name and no $DISPLAY environment variable
================================================================================== short test summary info ==================================================================================
SKIPPED [1] arviz/tests/helpers.py:649: could not import 'bokeh.plotting': No module named 'bokeh'
SKIPPED [1] arviz/tests/external_tests/test_data_beanmachine.py:14: Ignore beanmachine tests until it supports pytorch 2
SKIPPED [1] arviz/tests/helpers.py:649: could not import 'emcee': No module named 'emcee'
SKIPPED [1] arviz/tests/helpers.py:649: could not import 'jax': No module named 'jax'
SKIPPED [1] arviz/tests/external_tests/test_data_pyjags.py:16: Uses deprecated numpy C-api
SKIPPED [1] arviz/tests/helpers.py:649: could not import 'torch': No module named 'torch'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 6 skipped, 1 error in 5.88s ================================================================================
*** Error code 2

The DISPLAY variable is set to a valid X11 server when tests are run.

Version: 0.18.0 Python-3.9 FreeBSD 14.0

To Reproduce Steps to reproduce the behavior. Ideally a self-contained snippet of code, or link to a notebook or external code. Please include screenshots/images produced with ArviZ here, or the stacktrace including arviz code to help.

Expected behavior A clear and concise description of what you expected to happen.

Additional context Versions of arviz and other libraries used, operating system used, and anything else that may be useful.

OriolAbril commented 5 months ago

v0.18.0no longer supoorts python 3.9. Is this specific to to 3.9 or does it happen with other versions?

yurivict commented 5 months ago

I have no easy way of verifying this, since we use packaged dependencies w/in the FreeBSD ports tree.

OriolAbril commented 5 months ago

The end of the command you shared is /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts=. Are you required to use this python executable? If so you can't use arviz 0.18.0 and have to use <0.18.0. We aim to roughly follow https://scientific-python.org/specs/spec-0000 guidelines for dropping support for python versions and versions of main scientific python libraries.