labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

Macbook m1 support

Open santhoshnumberone opened this issue 2 years ago • 6 comments

I am unable to install labelImg on Macbook M1 Pro

Can anyone help me install it, can't find any method online to do this

santhoshnumberone avatar Apr 29 '22 18:04 santhoshnumberone

what error did you have?

tzutalin avatar Apr 30 '22 06:04 tzutalin

using pip3 inside conda env

pip3 install labelImg

I get this error

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting labelImg
  Using cached labelImg-1.8.6.tar.gz (247 kB)
  Preparing metadata (setup.py) ... done
Collecting pyqt5
  Using cached PyQt5-5.15.6.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 51, in build_wheel
          project = AbstractProject.bootstrap('pep517')
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 594, in setup
          self.apply_user_defaults(tool)
        File "project.py", line 63, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 241, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-9en_fni5/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 67, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

MacOS type Python 3 + Qt5

pip3 install pyqt5 lxml

Error

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting pyqt5
  Using cached PyQt5-5.15.6.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 51, in build_wheel
          project = AbstractProject.bootstrap('pep517')
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 594, in setup
          self.apply_user_defaults(tool)
        File "project.py", line 63, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 241, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/private/var/folders/k4/fvzdvb452y13m1kmf4vfvd5c0000gn/T/pip-build-env-ci_dumhn/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 67, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I don't know how to run on docker image

santhoshnumberone avatar Apr 30 '22 08:04 santhoshnumberone

Hi, I had the same error. From what I searched (https://stackoverflow.com/questions/69510029/no-compiler-can-produce-code-for-this-qt-version-apple-silicon) pyqt5 is not supported by M1. Only pyqt6.

So, instead of doing this

pip3 install pyqt5 lxml

do this:

pip3 install pyqt6 lxml

and that error should no longer appear.

However, the error that will appear instead is my next problem: the labelImg code is done to cover only pyqt5. 😔 I created a new issue in https://github.com/tzutalin/labelImg/issues/873

rita-carv avatar May 03 '22 17:05 rita-carv

You can try branch pyside6, it works for me on MacBook Pro with M1 Max: https://github.com/tzutalin/labelImg/tree/pyside6

mbv avatar May 14 '22 12:05 mbv

At the moment a possible solution is to open the terminal using Rosetta:

  1. go to the Application folder
  2. locate Terminal.app and press "cmd+i"
  3. mark "Open using Rosetta"

In this way, you are "using" i386 architecture and everything should work.

Suggestion: in order to have a double choice, duplicate the Terminal.app application.

giova86 avatar Jul 11 '22 09:07 giova86

conda install -c conda-forge labelimg this worked well for me

HawkingRadiation42 avatar Aug 30 '23 07:08 HawkingRadiation42