Snap Stor
Snap Stor

Reputation: 41

I can't install lableImg Annotation tool in M1 Mac

While installing LabelImg in M1 Mac using below command

pip install pyqt5 lxml

This is the error I got

ERROR: pyqt5 from https://files.pythonhosted.org/packages/7c/5b/e760ec4f868cb77cee45b4554bf15d3fe6972176e89c4e3faac941213694/PyQt5-5.14.0.tar.gz#sha256=0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72 has a pyproject.toml file that does not comply with PEP 518: 'build-system.requires' contains an invalid requirement: 'sip >=5.0.1 <6'

How to install lableImg annotation tool in M1 Mac?

Upvotes: 4

Views: 7929

Answers (8)

Rishi
Rishi

Reputation: 11

Anyone still (as of Jul 2023) trying to run on an arm7 machine:

pip install labelImg

and still get multiple errors like PyQt5 related, here is what I did:

  1. Checked my homebrew installation place for x86 and arm7. - Made alias for homebrew in zsh file (More reference by Nigel Davies)
alias ibrew='arch -x86_64 /usr/local/bin/brew'
alias mbrew='arch -arm64e /opt/homebrew/bin/brew'
  1. Used ibrew to install python3
ibrew install python3
  1. Next was to create virtual environment
/usr/bin/python3 -m venv env
  1. Activate the virtual env
source env/bin/activate 
  1. Then installed PyQt5
pip install PyQt5
  1. Head to cloned repository for labelImg
 cd path/to/labelImg
 pip3 install pyqt5 lxml
 make qt5py3
  1. Run the labelImg.py
 python labelImg.py

Upvotes: 0

Nick P
Nick P

Reputation: 511

The answer by AAA and this answer got me the closest. I don't have pipenv installed but do have a regular venv activated. In full, and even with qt6 installed already:

python3.10 -m pip install --upgrade pip

brew install libxml2
brew install pyqt@5

# check the path with `brew --prefix qt5`
export PATH="/opt/homebrew/opt/qt5/bin:$PATH"

# The following will take a while:
pip3 install pyqt5 --config-settings --confirm-license --verbose

pip3 install labelImg

You need the full confirm-license command above to avoid getting stuck later.

Upvotes: 0

Aditya Kakkar
Aditya Kakkar

Reputation: 41

https://anaconda.org/conda-forge/labelimg

Install anaconda on m1 mac first

https://www.anaconda.com/products/distribution

Make sure python and pip is installed using following commands

python --version 
pip --version
conda --version

open terminal

conda install -c conda-forge labelimg
labelImg

Upvotes: 2

AAA
AAA

Reputation: 61

I got it to work by using the following commands

brew install pyqt@5
pip install labelimg

And that's it, it just works You just need to type labelimg in the Terminal and the app will start running

I don't know why they don't tell you this in the installation guide

Upvotes: 6

Jay Rajput
Jay Rajput

Reputation: 1

Using Conda

  1. Create a virtual environment in conda and activate it
conda create -n venv
conda activate venv
  1. Install pyqt using conda
conda install pyqt
  1. Install lxml using pip
pip install lxml
  1. Change directory to the downloaded/cloned labelImg folder
cd path/to/labelImg/folder/
  1. Make qt5py3
make qt5py3
  1. Run LabelImg
python labelImg.py

Upvotes: 0

Tados
Tados

Reputation: 31

Alrighty!

On MacOS Monterey, none of the other solutions posted here solved this problem for me. However, I managed to easily solve the issue, without a virtual environment or too much fiddling about like so:

Firstly, you have to download all labelImg packages from this link:

https://github.com/tzutalin/labelImg#macos

(You can download it as a .zip file or clone it)

Unzip and then in your terminal cd into whatever directory you downloaded the above files to.

Then run the following commands in order:

    pyrcc5 -o libs/resources.py resources.qrc

Then,

    pip3 install lxml

Finally,

   python3 labelImg.py

It should run without an issue now.

Upvotes: 3

DC. Cheng
DC. Cheng

Reputation: 13

This is my note.

I just succeed on my Mac M1 Chip

CHECK THIS OUT!

LabelImg

Installation of labelimg on mac m1 chip


my first reference
my second reference

First, you must use terminal with rosetta version

Then, you already have python3

Then...

[Done]

# check where python3 is
$ where python3

# create env
$ /usr/bin/python3 -m venv env

# check env is
$ where env

# activate env list
$ source env/bin/activate 

# updated to the newest
$ pip install --upgrade pip

# installation of PyQt5
$ pip install PyQt5

# start to run labelImg.py
$ cd Documents/repos/labelImg
$ pip3 install pyqt5 lxml
$ make qt5py3

# [run ok!!]
$ python3 labelImg.py 

Upvotes: 0

ssarkar
ssarkar

Reputation: 135

You can go one of two ways:

Using brew:

You can use homebrew to install the dependencies - like qt and libxml2. This will let your package manager handle everything and generally should solve the problem with the . Then you can run

    python3 labelimg.py

Using Virtual Environments:

This is the more recommended way to go about in such cases. You can use conda, pipenv or venv to create a virtual environment which is isolated from your system python installation. Then you can try to install it as explained in the README.rst in the root of the repository:

brew install python3
pip3 install pipenv
pipenv run pip install pyqt5==5.12.1 lxml
pipenv run make qt5py3
pipenv run python3 labelImg.py
[Optional] rm -rf build dist; python setup.py py2app -A;mv "dist/labelImg.app" /Applications

You can try the two methods and and get back with the errors if there are any.

Upvotes: 0

Related Questions