Unable to install tfcoreml (specifically coremltoo

2019-09-20 12:18发布

问题:

I've tried a virtualenv, changing my python type to 2.7x, and installing it manually.

However, I keep getting the error of

Could not find a version that satisfies the requirement coremltools>=0.8 (from tfcoreml) (from versions: ) No matching distribution found for coremltools>=0.8 (from tfcoreml)

When I search using pip search coremltools for the versions I only get coremltools (2.1.0) - Community Tools for CoreML and it still won't let me get that version.

I need help. Can somebody either tell me what I am doing wrong or walk me step-by-step of how I can install this properly?

Thanks.

回答1:

Just worked my way through the same error, in which coremltools==0.8 showed up as a dependency for turicreate.

The problem is that for coremltools >= 6.2, the versions pip can see are pre-built and are only available for Mac OSX >= 10.12 and Linux.

(I'm running Mac OSX 10.11, and I suspect the error is Apple's way of trying to encourage an upgrade.)

I was able to build and install coremltools from source by downloading the appropriate release from https://github.com/apple/coremltools/releases and following its README.

In particular, this meant:

  • Manually install dependencies:

    pip install numpy>=1.10
    pip install protobuf>=3.1
    
  • I did not have the command cmake, so I downloaded it from https://cmake.org. Inside the GUI were directions for installing its symlinks into /usr/local/bin:

    sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
    
  • From the coremltools source directory, run:

    cmake . -DPYTHON=$(which python) -DPYTHON_CONFIG=$(which python-config)
    make
    

    and

    python setup.up install
    

Pip could then see coremltools and it carried on with installing turicreate.



回答2:

I had this same problem for "coremltools". The issue was the python version.

I could successfully install in a 3.6 environment.

There are no wheels for python 3.7+

(Thank you "|fried|" for the links ...)