poetry: Error occurs when installing bertopic (sub-dependency llvmlite)

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Installing BERTopic with poetry add bertopic results in an error. BERTopic depends on llvmlite. The error occurs when installing that sub-dependency. See the error message below for more details (the verbose error was too large to include).

$ poetry add bertopic     
Using version ^0.10.0 for bertopic

Updating dependencies
Resolving dependencies... (59.6s)

Writing lock file

Package operations: 18 installs, 5 updates, 0 removals

  • Installing llvmlite (0.34.0): Failed

  EnvCommandError

  Command ['/Users/my-username/Code/my-project-name/.venv/bin/pip', 'install', '--no-deps', 'file:///Users/my-username/Library/Caches/pypoetry/artifacts/49/df/e0/694d912a8276f46ee1f2185bcaff0c82689123b6963fadf3c2f306f7ff/llvmlite-0.34.0.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/my-username/Library/Caches/pypoetry/artifacts/49/df/e0/694d912a8276f46ee1f2185bcaff0c82689123b6963fadf3c2f306f7ff/llvmlite-0.34.0.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Building wheels for collected packages: llvmlite
    Building wheel for llvmlite (setup.py): started
    Building wheel for llvmlite (setup.py): finished with status 'error'
    error: subprocess-exited-with-error
    
    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [26 lines of output]
        running bdist_wheel
        /Users/my-username/Code/my-project-name/.venv/bin/python /private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py
        LLVM version... Traceback (most recent call last):
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 105, in main_posix
            out = subprocess.check_output([llvm_config, '--version'])
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
            return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
            with Popen(*popenargs, **kwargs) as process:
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
            self._execute_child(args, executable, preexec_fn, close_fds,
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, 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/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 191, in <module>
            main()
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 185, in main
            main_posix('osx', '.dylib')
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/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/my-username/Code/my-project-name/.venv/bin/python' 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
    Running setup.py clean for llvmlite
  Failed to build llvmlite
  Installing collected packages: llvmlite
    Running setup.py install for llvmlite: started
    Running setup.py install for llvmlite: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Running setup.py install for llvmlite did not run successfully.
    │ exit code: 1
    ╰─> [31 lines of output]
        running install
        /Users/my-username/Code/my-project-name/.venv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        running build
        got version from file /private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/llvmlite/_version.py {'version': '0.34.0', 'full': 'c5889c9e98c6b19d5d85ebdd982d64a03931f8e2'}
        running build_ext
        /Users/my-username/Code/my-project-name/.venv/bin/python /private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py
        LLVM version... Traceback (most recent call last):
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 105, in main_posix
            out = subprocess.check_output([llvm_config, '--version'])
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
            return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
            with Popen(*popenargs, **kwargs) as process:
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
            self._execute_child(args, executable, preexec_fn, close_fds,
          File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, 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/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 191, in <module>
            main()
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/ffi/build.py", line 185, in main
            main_posix('osx', '.dylib')
          File "/private/var/folders/h2/43rsy7m12cs6mp6d5y141cnc0000gn/T/pip-req-build-f_shax42/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/my-username/Code/my-project-name/.venv/bin/python' failed with exit code 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: legacy-install-failure
  
  × Encountered error while trying to install package.
  ╰─> llvmlite
  
  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.
  WARNING: You are using pip version 22.0.3; however, version 22.1.2 is available.
  You should consider upgrading via the '/Users/my-username/Code/my-project-name/.venv/bin/python -m pip install --upgrade pip' command.
  

  at ~/.poetry/lib/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):


Failed to add packages, reverting the pyproject.toml file to its original content.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

^3.9 is equivalent to >=3.9,<4.0. What that line says is that you want poetry to find a solution that’s valid for that entire range - this is independent of you current environment.

llvmlite declares that it’s not compatible with that entire range.

Try changing the python version in the suggested way

(or force poetry to choose a newer llvmlite by requiring it explicitly, and see what conflict it reports / what else gets forced to a lower version)

Did you try installing it via pip in a separate environment?

As there is no wheel for MacOS 12, poetry is trying to build llvmlite from the source. Looks like it fails to build it because there is no llvm-config. Do you have LLVM installed locally? You might also want to report the lack of wheel for MacOS 12 in llvmlite repo. Right now I don’t believe this is a bug on the Poetry side, rather a lack of required packages to build it on your machine. Please try installing it with pip and report back how it went.