Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing coremltools

I am looking at Core ML Apple iOS framework. I have read that to install coremltools to create own models. I have installed python sudo python /Users/administrator/Downloads/get-pip.py

As per document coreml installation I have downloaded coremltool file.

and then trying to install coremltools

https://pypi.python.org/pypi/coremltools

When I installed coremltools on my mac, i got the following error. Please suggest me to solve this error. so that i can work on coremltools

MyMacbook:~ administrator$ pip install -U /Users/administrator/Downloads/coremltools-0.3.0-py2.7-none-any.whl 
Processing ./Downloads/coremltools-0.3.0-py2.7-none-any.whl
Requirement already up-to-date: numpy>=1.6.2 in /Library/Python/2.7/site-packages (from coremltools==0.3.0)
Collecting protobuf>=3.1.0 (from coremltools==0.3.0)
Requirement already up-to-date: six>=1.9 in /Library/Python/2.7/site-packages/six-1.10.0-py2.7.egg (from protobuf>=3.1.0->coremltools==0.3.0)
Collecting setuptools (from protobuf>=3.1.0->coremltools==0.3.0)
  Using cached setuptools-36.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools, protobuf, coremltools
  Found existing installation: setuptools 18.5
    Uninstalling setuptools-18.5:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/var/folders/h1/z0gcmgkx6b9_l2_zpyzvl7tm0000gn/T/pip-DFHVSK-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
MyMacbook:~ administrator$ 
like image 927
Stella Avatar asked Jun 18 '17 08:06

Stella


2 Answers

You're trying to change your system Python. That's why it says [Errno 1] Operation not permitted. To avoid messing up system libraries, you need to create separate Python virtual environment. This is how to do it:

  1. Upgrade pip:

    pip install --upgrade pip
    
  2. Install virtual environment.

    pip install –U virtualenv
    
  3. Create new virtual environment:

    cd ~
    virtualenv coreml
    

    This creates folder ~/coreml/ and a local copy of Python, pip and all other stuff you need for work.

  4. To activate virtual environment:

    source coreml/bin/activate
    

    Now you see in your terminal (coreml) prepends your user name.

  5. In newly created virtual environment:

    pip install -U coremltools
    
  6. Check that library was installed successfully:

    python
    import coremltools
    

    There should not be any error messages.

  7. To deactivate virtual environment run:

    deactivate
    

Note: Never run pip with sudo. If you need sudo, 99% chance you're doing something wrong.

like image 169
Alexander Sosnovshchenko Avatar answered Oct 18 '22 22:10

Alexander Sosnovshchenko


Is their a specific reason, that you downloaded the .whl-file?

You cloud try to install directly from PyPI with:

pip install -U coremltools

This is the recommended way as shown in the link, you already posted.

Note: I know this is not a very sophisticated answer, but I do not have enough reputation to just comment.

like image 45
Lausbert Avatar answered Oct 18 '22 22:10

Lausbert