ocropus-archive / DUP-ocropy

Python-based tools for document analysis and OCR
Apache License 2.0
3.42k stars 591 forks source link

Installing on Mac OS El Capitan #308

Closed tim401 closed 5 years ago

tim401 commented 6 years ago

Expected Behavior

Current Behavior

When installing on OS X El Capitan the installation fails because of the System Integrity Protection (SIP) with the following error: changing mode of /usr/local/bin/ocropus-visualize-results to 755 running install_data creating /System/Library/Frameworks/Python.framework/Versions/2.7/share error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted

Possible Solution

I could temporarily disable SIP, but that doesn't seem like a good idea. I tried temporarily removing sip from the needed files, but when booting into recovery mode they aren't even loaded and available to remove the restricted flag.

brew is a possible solution, but there are no packages for matplotlib or lxml.

Steps to Reproduce (for bugs)

  1. Installed new clean copy of MacPorts and updated it
  2. sudo port install py27-scipy py27-matplotlib py27-lxml
  3. curl -O http://www.tmbdev.net/en-default.pyrnn.gz
  4. mv en-default.pyrnn.gz models/
  5. sudo python setup.py install

Your Environment

zuphilip commented 6 years ago

Do I understand correctly that just the last step setup python setup.py install does not work? If yes, then you can also try to start the ocropus-commands directly, i.e. ./ocropus-nlbin etc. Does this work?

tim401 commented 6 years ago

Yes that is correct, just the last step fails. But when I call the command directly I get different errors.

./ocropus-nlbin tests/ersch.png -o book Traceback (most recent call last): File "./ocropus-nlbin", line 15, in import ocrolib File "/Users/user/ocropy-master/ocrolib/init.py", line 14, in from common import * File "/Users/user/ocropy-master/ocrolib/common.py", line 26, in import PIL ImportError: No module named PIL

zuphilip commented 6 years ago

Okay, you need also the Python packages from requirements.txt. Install with

pip install -r requirements.txt

or

conda install --file requirements.txt
tim401 commented 6 years ago

Alright, I don't have either pip or condo but I used macports to install the two packages that are listed in the requirements file but not in the PACKAGES file by the following: sudo port install py27-Pillow py27-numpy But I still get the exact same error as above, including the last line ImportError: No module named PIL

Pillow is obviously supposed to be a fork of PIL, but it doesn't seem to be cooperating.

I also get the same error if I uninstall Pillow and install py27-pil.

zuphilip commented 6 years ago

You need to install these packages within python and macports is only installing packages within your system. Try to install pip (or conda) first and then proceed with the line above.

zuphilip commented 5 years ago

Closing this issue because of inactivity. @tim401 If the problem remains, then feel free to reopen it.