poetry: Cannot Install tensorflow 2.9.1

  • 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

Here is the issue: I am not able to install tensorflow with poetry. If I run poetry add tensorflow I get the following error

uilding 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
    ╰─> [11 lines of output]
        running bdist_wheel
        /Users/oscardefelice/miniconda3/envs/tempr/bin/python /private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py
        LLVM version... Traceback (most recent call last):
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 220, in <module>
            main()
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 214, in main
            main_posix('osx', '.dylib')
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 134, in main_posix
            raise RuntimeError(msg) from None
        RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
        error: command '/Users/oscardefelice/miniconda3/envs/tempr/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
    ╰─> [16 lines of output]
        running install
        /Users/oscardefelice/miniconda3/envs/tempr/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/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/llvmlite/_version.py {'version': '0.38.0', 'full': 'f0365b91ce1e1f74c68785c6d0067f32f89857d9'}
        running build_ext
        /Users/oscardefelice/miniconda3/envs/tempr/bin/python /private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py
        LLVM version... Traceback (most recent call last):
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 220, in <module>
            main()
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 214, in main
            main_posix('osx', '.dylib')
          File "/private/var/folders/gc/5dj19dqj64ddh8_sw790yqtr0000gn/T/pip-req-build-zd1dtsv2/ffi/build.py", line 134, in main_posix
            raise RuntimeError(msg) from None
        RuntimeError: Could not find a `llvm-config` binary. There are a number of reasons this could occur, please see: https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#using-pip for help.
        error: command '/Users/oscardefelice/miniconda3/envs/tempr/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.

I am looking around for this error, but I do not find anything useful.

While if I run poetry install I got the even less clear error

RuntimeError

   Unable to find installation candidates for tensorflow (2.9.1)

   at /usr/local/lib/python3.9/site-packages/poetry/installation/chooser.py:72 in choose_for
      68│ 
      69│             links.append(link)
      70│ 
      71│         if not links:
→  72│             raise RuntimeError(
     73│                 "Unable to find installation candidates for {}".format(package)
     74│             )
     75│ 
     76│         # Get the best link

About this issue

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

Most upvoted comments

Closing as this is an issue with available wheels for the concrete versions Poetry is trying to install according to package constraints – tensorflow-macos looks to be a suitable substitute for anyone running into this.

Not sure if this helps but I’ve had some success using the tensorflow-macos library to get arm based wheels. It’s a fork by Apple that supports M1. Inside poetry we used something like:

tensorflow = {version = ">=2.9.1", markers = "sys_platform != 'darwin'"}
tensorflow-macos = {version = ">=2.9.1", markers = "sys_platform == 'darwin'"}

which we’re still tweaking so that it runs as expected on different platforms. This may require some system dependencies that I’ve forgotten about.

There’s an Apple guide here although we didn’t do step 1 and just installed tensorflow-macos and tensorflow-metal.

Thanks - per my last I suspect that the issue Unable to find installation candidates for tensorflow (2.9.1) was indeed simply that no such packages are available for the reporter’s platform, and there’s nothing much poetry can do about this.

If Apple are maintaining a version of tensorflow for this exact purpose then that does seem like a good bet.

Anyway OP seemed to lose interest in getting to the bottom of this, suggest closing.