Labelimg: Building labelImg (Python3 and Qt5) on Fedora

Created on 14 Jun 2018  路  2Comments  路  Source: tzutalin/labelImg

  • OS:: Fedora 28
  • PyQt version: Python 2.7.15 and Python 3.6.5

I would need help getting the latest labelImg up and running on my machine.
I couldn't find a linux binary of the latest version, and unfortunately I was not able to build/execute the sources provided.

Here is some output of my attempt to use pip3 to install labelImg (I ran the command without sudo before but of course it failed because of missing rights to write to /usr):

florian@t440-f25: ~/labelimg/labelImg $ sudo pip3 install labelImg
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting labelImg
  Downloading https://files.pythonhosted.org/packages/c1/5d/4b8a6dc5e352543199bc3991785af2e1cd58e50f1016e3725db826e3f4bb/labelImg-1.7.0.tar.gz (587kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 593kB 1.6MB/s 
Installing collected packages: labelImg
  Running setup.py install for labelImg ... done
Successfully installed labelImg-1.7.0
florian@t440-f25: ~/labelimg/labelImg $ labelImg 
build-tools/       data/              .eggs/             .gitignore         icons/             issue_template.md  libs/              Makefile           README.rst         setup.cfg          tests/
CONTRIBUTING.rst   demo/              .git/              HISTORY.rst        __init__.py        labelImg.py        LICENSE            MANIFEST.in        resources.qrc      setup.py           .travis.yml
florian@t440-f25: ~/labelimg/labelImg $ labelImg 
build-tools/       data/              .eggs/             .gitignore         icons/             issue_template.md  libs/              Makefile           README.rst         setup.cfg          tests/
CONTRIBUTING.rst   demo/              .git/              HISTORY.rst        __init__.py        labelImg.py        LICENSE            MANIFEST.in        resources.qrc      setup.py           .travis.yml
florian@t440-f25: ~/labelimg/labelImg $ labelImg 
build-tools/       data/              .eggs/             .gitignore         icons/             issue_template.md  libs/              Makefile           README.rst         setup.cfg          tests/
CONTRIBUTING.rst   demo/              .git/              HISTORY.rst        __init__.py        labelImg.py        LICENSE            MANIFEST.in        resources.qrc      setup.py           .travis.yml
florian@t440-f25: ~/labelimg/labelImg $ labelImg 
build-tools/       data/              .eggs/             .gitignore         icons/             issue_template.md  libs/              Makefile           README.rst         setup.cfg          tests/
CONTRIBUTING.rst   demo/              .git/              HISTORY.rst        __init__.py        labelImg.py        LICENSE            MANIFEST.in        resources.qrc      setup.py           .travis.yml
florian@t440-f25: ~/labelimg/labelImg $ labelImg 
Traceback (most recent call last):
  File "/usr/local/bin/labelImg", line 11, in <module>
    load_entry_point('labelImg==1.7.0', 'console_scripts', 'labelImg')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/site-packages/labelImg/labelImg.py", line 29, in <module>
    import resources
ModuleNotFoundError: No module named 'resources'

Some other questions:

  • Am I supposed to run it using pyhton 2?

  • What are the requirements/dependencies on a Fedora system to successfully build labelImg?

  • Where can I get support?

Most helpful comment

I actually managed to build labelImg from source. Here is what I did/had to do.

  1. ) Install required packages: sudo dnf install qt5 python-qt5 python3-lxml
    2.) Clone github repo: git clone https://github.com/tzutalin/labelImg (git was installed)
    3.) cd labelImg
    4.) make qt5py3
    pyrcc5 -o resources.py resources.qrc

5.) python3 labelImg.py throws an error:

Traceback (most recent call last):
  File "labelImg.py", line 15, in <module>
    from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "labelImg.py", line 24, in <module>
    import sip
ModuleNotFoundError: No module named 'sip'

So, PyQt5 is missing. I used the pip3 command to install it. I should have maybe tried to use dnf to find the package (have heard that using pip/pip3 can cause hiccups for dnf later)

6.) $pip3 install PyQt5 --user

Collecting PyQt5
  Using cached https://files.pythonhosted.org/packages/e4/15/4e2e49f64884edbab6f833c6fd3add24d7938f2429aec1f2883e645d4d8f/PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting sip<4.20,>=4.19.4 (from PyQt5)
  Using cached https://files.pythonhosted.org/packages/8a/ea/d317ce5696dda4df7c156cd60447cda22833b38106c98250eae1451f03ec/sip-4.19.8-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: sip, PyQt5
Successfully installed PyQt5-5.10.1 sip-4.19.8

Finally I am able to execute the build:

7.) python3 labelImg.py

It works just fine. Install process is a bit different from the Ubuntu installation since packages have different names...

All 2 comments

It looks like the "Get from PyPI" install instructions are out of date, thanks for bringing that to our attention.

In the meantime, I recommend building labelImg from source. Can you elaborate on the issues you faced when you attempted to do so?

Other questions:

  • I find that labelImg actually works smoother with Python3 and Qt5

  • I haven't tried running it on Fedora, but I can't imagine that it's very different from the Ubuntu setup

  • The only place atm is here

I actually managed to build labelImg from source. Here is what I did/had to do.

  1. ) Install required packages: sudo dnf install qt5 python-qt5 python3-lxml
    2.) Clone github repo: git clone https://github.com/tzutalin/labelImg (git was installed)
    3.) cd labelImg
    4.) make qt5py3
    pyrcc5 -o resources.py resources.qrc

5.) python3 labelImg.py throws an error:

Traceback (most recent call last):
  File "labelImg.py", line 15, in <module>
    from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "labelImg.py", line 24, in <module>
    import sip
ModuleNotFoundError: No module named 'sip'

So, PyQt5 is missing. I used the pip3 command to install it. I should have maybe tried to use dnf to find the package (have heard that using pip/pip3 can cause hiccups for dnf later)

6.) $pip3 install PyQt5 --user

Collecting PyQt5
  Using cached https://files.pythonhosted.org/packages/e4/15/4e2e49f64884edbab6f833c6fd3add24d7938f2429aec1f2883e645d4d8f/PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl
Collecting sip<4.20,>=4.19.4 (from PyQt5)
  Using cached https://files.pythonhosted.org/packages/8a/ea/d317ce5696dda4df7c156cd60447cda22833b38106c98250eae1451f03ec/sip-4.19.8-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: sip, PyQt5
Successfully installed PyQt5-5.10.1 sip-4.19.8

Finally I am able to execute the build:

7.) python3 labelImg.py

It works just fine. Install process is a bit different from the Ubuntu installation since packages have different names...

Was this page helpful?
0 / 5 - 0 ratings