danielgatis / rembg

Rembg is a tool to remove images background
MIT License
17.16k stars 1.88k forks source link

[BUG] llvmlite fails building upon pip install #670

Open blurridge opened 2 months ago

blurridge commented 2 months ago

Describe the bug I've tried pip installing both on my docker container and my local machine and llvmlite does not build. Also already tried updating pip

To Reproduce Steps to reproduce the behavior:

  1. Create an environment with Python 3.10
  2. Pip install rembg

Expected behavior Successful pip install

Images Input images to reproduce.

OS Version: Mac OS Sonoma 14.6.1

Rembg version: v2.0.59

Additional context

note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for numba
  Building wheel for llvmlite (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for llvmlite (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      running bdist_wheel
      /Users/blurridge/Documents/Coding/fsl-backend/env/bin/python3.10 /private/var/folders/js/n5lc337x5sd6y0sqph8lr6gm0000gn/T/pip-install-gyhwh4ko/llvmlite_ac3d895caafe49ab9a581b2fec787acb/ffi/build.py
      LLVM version... Traceback (most recent call last):
        File "/private/var/folders/js/n5lc337x5sd6y0sqph8lr6gm0000gn/T/pip-install-gyhwh4ko/llvmlite_ac3d895caafe49ab9a581b2fec787acb/ffi/build.py", line 105, in main_posix
          out = subprocess.check_output([llvm_config, '--version'])
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 501, in run
          with Popen(*popenargs, **kwargs) as process:
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 966, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1842, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/private/var/folders/js/n5lc337x5sd6y0sqph8lr6gm0000gn/T/pip-install-gyhwh4ko/llvmlite_ac3d895caafe49ab9a581b2fec787acb/ffi/build.py", line 191, in <module>
          main()
        File "/private/var/folders/js/n5lc337x5sd6y0sqph8lr6gm0000gn/T/pip-install-gyhwh4ko/llvmlite_ac3d895caafe49ab9a581b2fec787acb/ffi/build.py", line 185, in main
          main_posix('osx', '.dylib')
        File "/private/var/folders/js/n5lc337x5sd6y0sqph8lr6gm0000gn/T/pip-install-gyhwh4ko/llvmlite_ac3d895caafe49ab9a581b2fec787acb/ffi/build.py", line 107, in main_posix
          raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
      RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
      error: command '/Users/blurridge/Documents/Coding/fsl-backend/env/bin/python3.10' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llvmlite
Failed to build numba llvmlite
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (numba, llvmlite)
github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

haroon423 commented 1 month ago

Hi there,

Thank you for reporting the installation issue with rembg. It seems like you're encountering a problem while trying to install llvmlite, which is required for numba, in your environment.

Bug Description: When trying to install rembg using pip in a Python 3.10 environment, the installation fails with the following error messages:

FileNotFoundError: llvm-config not found. RuntimeError: llvm-config failed executing, indicating that the environment cannot locate the LLVM configuration. Steps to Reproduce:

Create a virtual environment with Python 3.10. Attempt to install rembg using pip install rembg. Environment Details:

OS Version: Mac OS Sonoma 14.6.1 Rembg Version: v2.0.59 Error Output: The error log indicates issues related to llvm-config, which is essential for building llvmlite. The specific error reads: RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config

Install LLVM: Ensure that LLVM is installed on your system. You can install it using Homebrew: brew install llvm

blurridge commented 1 month ago

Hi there,

Thank you for reporting the installation issue with rembg. It seems like you're encountering a problem while trying to install llvmlite, which is required for numba, in your environment.

Bug Description: When trying to install rembg using pip in a Python 3.10 environment, the installation fails with the following error messages:

FileNotFoundError: llvm-config not found. RuntimeError: llvm-config failed executing, indicating that the environment cannot locate the LLVM configuration. Steps to Reproduce:

Create a virtual environment with Python 3.10. Attempt to install rembg using pip install rembg. Environment Details:

OS Version: Mac OS Sonoma 14.6.1 Rembg Version: v2.0.59 Error Output: The error log indicates issues related to llvm-config, which is essential for building llvmlite. The specific error reads: RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config

Install LLVM: Ensure that LLVM is installed on your system. You can install it using Homebrew: brew install llvm

Hello! This does not account for the fact though that it doesn't run on docker since I'm using the python3.10-slim image which is a debian image. Thanks though!

Youjin1985 commented 3 weeks ago

llvmlite requires at most llvm@10, but sonoma only has llvm@11 and above 😡

m-aherron commented 4 days ago

A variation on the same issue - that is the dependency on numba:

❯ uv pip install 'rembg>=v2.0.60'
Resolved 29 packages in 136ms
  × Failed to download and build `numba==0.53.1`
  ╰─▶ Build backend failed to determine requirements with `build_wheel()` (exit code: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "C:\Python\uv\cache\builds-v0\.tmp7PNbyA\Lib\site-packages\setuptools\build_meta.py", line 334, in
      get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Python\uv\cache\builds-v0\.tmp7PNbyA\Lib\site-packages\setuptools\build_meta.py", line 304, in
      _get_build_requires
          self.run_setup()
        File "C:\Python\uv\cache\builds-v0\.tmp7PNbyA\Lib\site-packages\setuptools\build_meta.py", line 522, in
      run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Python\uv\cache\builds-v0\.tmp7PNbyA\Lib\site-packages\setuptools\build_meta.py", line 320, in
      run_setup
          exec(code, locals())
        File "<string>", line 50, in <module>
        File "<string>", line 47, in _guard_py_ver
      RuntimeError: Cannot install on Python version 3.12.6; only versions >=3.6,<3.10 are supported.

  help: `numba` (v0.53.1) was included because `rembg` (v2.0.60) depends on `pymatting` (v1.1.13) which depends
        on `numba`