On Thursday, August 10, 2023 at 9:45:48 AM UTC-6 Mari wrote:
Hi All, I have a job running on Jenkins server, which builds python script. The script has to display a bar chart as final output. The build agent I am using on Jenkins appears to have python installed. I confirmed this by adding a build step as python3 —version and the result was: Python 3.6.8. Why then do I have this error showing. Do I need to install a plugin? Kind regards Mari Traceback (most recent call last) File "newjenkins.py", line 7, in <module> import matplotlib.pyplot as plt File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 97, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/usr/lib64/python2.7/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCAnvasGTK, \ File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line 13, in <module> import gtk, gdk = gtk.gdk File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module> _init() File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init _gtk.init_check() RuntimeError: could not open display That output indicates that the program is choosing to run Python 2 packages (like gtk) with Python 3. You probably need Python 3 packages to run with Python 3.6.8. Installing a plugin won't help. Python 2 reached end of life in 2020, per https://www.python.org/doc/sunset-python-2/ -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/74a3b800-028f-47ce-b915-086046be13ecn%40googlegroups.com.