worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.36k stars 1.43k forks source link

Error - trying to open display #88

Closed aemerich closed 7 years ago

aemerich commented 8 years ago

I'm getting this error:

from dejavu import Dejavu Traceback (most recent call last): File "", line 1, in File "dejavu/init.py", line 3, in import fingerprint File "dejavu/fingerprint.py", line 3, in import matplotlib.pyplot as plt File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 78, in new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/lib64/python2.6/site-packages/matplotlib/backends/init.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 8, in import gtk; gdk = gtk.gdk File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/init.py", line 64, in _init() File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/init.py", line 52, in _init _gtk.init_check() RuntimeError: could not open display

Can anyone help me?

thesunlover commented 8 years ago

Hi, @aemerich did you use the proper version of Python?

thesunlover commented 8 years ago

most of the depencies require Python 2.7 / Python 3

soruly commented 8 years ago

Running without a GUI would result in such error. You have to set matplotlib to use non-interactive backend. Try modifying the first few lines of fingerprint.py fixes this for me

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

https://github.com/worldveil/dejavu/issues/29