Skip to content
New issue

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

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

Already on GitHub? # to your account

RuntimeError: could not open display #226

Closed
vlad-wonderkidstudio opened this issue Jun 13, 2017 · 9 comments
Closed

RuntimeError: could not open display #226

vlad-wonderkidstudio opened this issue Jun 13, 2017 · 9 comments

Comments

@vlad-wonderkidstudio
Copy link

After installed on the command line CentOS server, when I try to run any OCRopus command, I get the following error:

$ ./ocropus-nlbin -h
Traceback (most recent call last):
 File "./ocropus-nlbin", line 5, in <module>
   from pylab import *
 File "/usr/lib64/python2.7/site-packages/pylab.py", line 1, in <module>
   from matplotlib.pylab import *
 File "/usr/lib64/python2.7/site-packages/matplotlib/pylab.py", line 265, in <module>
   from matplotlib.pyplot import *
 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

Expected Behavior

On my home Ubuntu within Gnome command line it works just fine.

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

  1. Install on CentOS command-line only server (without display)
  2. Run any command, like $ ./ocropus-nlbin -h
  3. Get the error

Your Environment

  • Python version: 2.7.5
@zuphilip
Copy link
Collaborator

The error looks like the display is not found for matplot, and indeed you write that you are using ocropy on the command line CentOS server. You can try to set export MPLBACKEND="agg" as it is also done in the CircleCI file.

@vlad-wonderkidstudio
Copy link
Author

vlad-wonderkidstudio commented Jun 14, 2017

I tried to do so. After this I launched:
./ocropus-nlbin -h
And it just hangs (I can type texts in the console and anything, but no answer from the program).
After I pressed CTRL+C I got this message:

Traceback (most recent call last):
  File "./ocropus-nlbin", line 5, in <module>
    from pylab import *
  File "/usr/lib64/python2.7/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 151, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line 20, in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line 52, in <module>
    import numpy as np
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 153, in <module>
    import polynomial
  File "/usr/lib64/python2.7/site-packages/numpy/polynomial/__init__.py", line 18, in <module>
    from polynomial import Polynomial
  File "/usr/lib64/python2.7/site-packages/numpy/polynomial/polynomial.py", line 54, in <module>
    """
KeyboardInterrupt

@zuphilip
Copy link
Collaborator

Hm... I have no experience with CentOS. Maybe @kba has some ideas?

@kba
Copy link
Collaborator

kba commented Jun 14, 2017

Hard to say w/o running a CentOS image. numpy/scipy/matplotlib can be tricky at times because of location of compiled libs etc.

Maybe run ocropus w/ docker?

@stweil
Copy link
Contributor

stweil commented Jun 14, 2017

Isn't it normal behavior that no display is found if you run on a host which only has command line installed? If I have a program which requires a display I'd install display support (for example X Windows on Linux).

@kba
Copy link
Collaborator

kba commented Jun 14, 2017

Isn't it normal behavior that no display is found if you run on a host which only has command line installed?

That was the initial issue, solved by setting Matplotlib's backend. The second issue is something different.

@vlad-wonderkidstudio
Copy link
Author

@kba
How can I run it with docker?

@zuphilip
Copy link
Collaborator

You can use this docker image: https://hub.docker.com/r/kbai/ocropy/

@zuphilip
Copy link
Collaborator

@vlad-wonderkidstudio Did you find a solution for your CentOS?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants