Home > Back-end >  How do I install coremltools version 4.0 using pip without install errors on my mac?
How do I install coremltools version 4.0 using pip without install errors on my mac?

Time:05-15

I have used pyenv to create a shell environment of python 2.7.13 but when I do pip install 'coremltools==4.0' I get five error messages as below;

ERROR: Exception:
Traceback (most recent call last):
  File "/Users/MyUsername/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/Users/MyUsername/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/Users/MyUsername/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 321, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/Users/MyUsername/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 180, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/Users/MyUsername/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 419, in _resolve_one
    assert req_to_install.user_supplied
AssertionError

I think there is some compatibility issue between Python 2.7.13 and coremltools 4.0.

I am following Angela Yu's course on iOS Development and I am at the section on machine learning where she uses Python 2.7 and coremltools to convert a Caffe model into a .mlmodel file. But the course is nearly 3 years old and my mac doesn't have the same version of Python and coreltools.

I am completely unfamiliar with Python and I would really appreciate some help.

CodePudding user response:

This error is from environment itself and does not look specific to coremltools. Could you please follow steps from https://coremltools.readme.io/docs/installation and see if you find any issues?

CodePudding user response:

Which version of pip are you using? It works for me with

$ pip --version
pip 19.3.1 from /Users/guyr/miniconda3/envs/stef/lib/python2.7/site-packages/pip (python 2.7)

So perhaps when creating your environment you should (if using conda)

$ conda create --yes --name foo python=2.7.13 pip=19.3.1
$ conda activate foo
$ conda install coremltools==4.0
  • Related