Error and solution when trying to run a classifier made with Labellio with my own ubuntu

background

I wanted to put a model made using aplaca's Labellio convenient service on my server, but I was addicted to it when Caffe was installed (?). So make a note of the solution.

Caution

We have not been able to investigate the cause. I don't think it's good to publish ambiguous information in such a state, but there may be people who are in trouble in the same state, so I will publish it as a remedy.

Flow of environment construction & encountering problems

  1. I made a classifier with labbelio
  2. I want to publish the created model on the Web (Click here for how to publish (http://blog-jp.alpaca.ai/entry/2015/06/30/135214))
  3. I don't have ubuntu server --I tried to do my best with CentOS6, but I was frustrated --I borrowed ubuntu 14.04 at konoha -This article was installed as a reference. --Caffe was installed ("make runtest" passed) --When I run app.py, I get this error
Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Traceback (most recent call last):
  File "app.py", line 8, in <module>
    from labellio import Classifier, Config, ImageLoader, Label
  File "/usr/local/lib/python2.7/dist-packages/labellio/__init__.py", line 2, in <module>
    from labellio.classifier import Classifier
  File "/usr/local/lib/python2.7/dist-packages/labellio/classifier.py", line 6, in <module>
    from labellio.net import Net
  File "/usr/local/lib/python2.7/dist-packages/labellio/net.py", line 4, in <module>
    import caffe
  File "/root/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/root/caffe/python/caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "/root/caffe/python/caffe/io.py", line 2, in <module>
    import skimage.io
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 15, in <module>
    reset_plugins()
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 93, in reset_plugins
    _load_preferred_plugins()
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 73, in _load_preferred_plugins
    _set_plugin(p_type, preferred_plugins['all'])
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 85, in _set_plugin
    use_plugin(plugin, kind=plugin_type)
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 255, in use_plugin
    _load(name)
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/manage_plugins.py", line 299, in _load
    fromlist=[modname])
  File "/usr/local/lib/python2.7/dist-packages/skimage/io/_plugins/matplotlib_plugin.py", line 3, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 11, in <module>
    from . import backend_gtk3
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 58, in <module>
    cursors.MOVE          : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
TypeError: constructor returned NULL

solution

https://github.com/BVLC/caffe/issues/861 With reference to this, it worked as ** Add MPLBACKEND = Agg ** at runtime.

Like this → "** MPLBACKEND = Agg python app.py **"

Recommended Posts

Error and solution when trying to run a classifier made with Labellio with my own ubuntu
I got an error when trying to install Xgboost and its solution
[python] A note when trying to use numpy with Cython
A program that failed when trying to create a linebot with reference to "Dialogue system made with python"
What I was addicted to when I built my own neural network using the weights and biases I got with scikit-learn's MLP Classifier.
Error and solution when installing python3 with homebrew on mac (catalina 10.15)
I get an error when trying to install maec 4.0.1.0 with pip
[Python] Error and solution memo when using venv with pyenv + anaconda
UnicodeEncodeError when trying to run radon
A story about trying to run JavaScripthon on Windows and giving up.
[Python / Pandas] A bug occurs when trying to replace a DataFrame with `None` with` replace`
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
I made a system that automatically decides whether to run tomorrow with Python and adds it to Google Calendar.
Workaround if you get an error when trying to install PySide with pip
I got an error when trying to run Hello World in Go language
An error occurs when trying to import scikit-learn after connecting to Oracle with SQLAlchemy
Problems and solutions when trying to put rbenv with git submodule (also pyenv)
Build a flask app made with tensorflow and dlib to work on centos7
A story that I was addicted to when I made SFTP communication with python
Error when installing a module with Python pip
Compile and run Rust with a single command
Error when trying to install psycopg2 in Python
A story that required preparation when trying to do a Django tutorial with plain centos7
A story that failed when trying to remove the suffix from the string with rstrip
I made a program to convert images into ASCII art with Python and OpenCV
A story of trial and error trying to create a dynamic user group in Slack
I got stuck when trying to specify a relative path with relative_to () in python
Connect realsense D435 to a PC with ubuntu 16.04 installed and save depth videos with python
A memo of misunderstanding when trying to load the entire self-made module with Python3
What to do if you run python in IntelliJ and end with an error
When writing to a csv file with python, a story that I made a mistake and did not meet the delivery date