diff --git a/docs/installation.rst b/docs/installation.rst index 8efaac2e..446f9cb9 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,7 +1,7 @@ Installation ============ -The easiest way to install OCRmyPDF to follow the steps for your operating system/platform. +The easiest way to install OCRmyPDF to follow the steps for your operating system/platform. If you want to use the latest version of OCRmyPDF, your best bet is to install the most recent version your platform provides, and then upgrade that version by installing the Python binary wheels. @@ -23,7 +23,7 @@ To see what versions are available, check the `Debian Package Tracker `_, and both the input and output file must be inside the writable volume. This example command uses the current working directory as the writable volume: .. code-block:: bash docker run --rm -v "$(pwd):/home/docker" ocrmypdf -In this worked example, the current working directory contains an input file called ``test.pdf`` and the output will go to ``output.pdf``: +In this worked example, the current working directory contains an input file called ``test.pdf`` and the output will go to ``output.pdf``: .. code-block:: bash @@ -167,11 +167,11 @@ Install or upgrade the required Homebrew packages, if any are missing: brew install python3 brew install libxml2 libffi leptonica brew install unpaper # optional - + Python 3.5 and 3.6 are supported. Install the required Tesseract OCR engine with the language packs you plan to use: - + .. code-block:: bash brew install tesseract # Option 1: for English, French, German, Spanish @@ -192,15 +192,13 @@ You can then install OCRmyPDF from PyPI, for the current user: .. code-block:: bash - pip3 install --user ocrmypdf[fitz] + pip3 install --user ocrmypdf or system-wide: .. code-block:: bash - pip3 install ocrmypdf[fitz] - -``[fitz]`` includes the optional dependency on PyMuPDF, which improves OCRmyPDF's output in many cases. + pip3 install ocrmypdf The command line program should now be available: @@ -221,12 +219,12 @@ install the system version to get all the dependencies: ocrmypdf \ python3-pip -Then install ocrmypdf 6.1.5 for the local user and set the user's ``PATH`` to check for the user's Python packages. +Then install the most recent ocrmypdf for the local user and set the user's ``PATH`` to check for the user's Python packages. .. code-block:: bash export PATH=$HOME/.local/bin:$PATH - pip3 install --user ocrmypdf[fitz] + pip3 install --user ocrmypdf Installing on Ubuntu 16.04 LTS @@ -249,13 +247,13 @@ If you wish install OCRmyPDF for the current user: .. code-block:: bash - pip3 install --user ocrmypdf[fitz] + pip3 install --user ocrmypdf Alternately, system-wide. Note that this may modify the system Python environment: .. code-block:: bash - sudo pip3 install ocrmypdf[fitz] + sudo pip3 install ocrmypdf If you wish to install OCRmyPDF to a virtual environment to isolate the system Python, you can follow these steps. @@ -263,10 +261,7 @@ If you wish to install OCRmyPDF to a virtual environment to isolate the system P python3 -m venv venv-ocrmypdf source venv-ocrmypdf/bin/activate - pip3 install ocrmypdf[fitz] - -``[fitz]`` includes the optional dependency on PyMuPDF, which improves OCRmyPDF's output in many cases. - + pip3 install ocrmypdf Installing on Ubuntu 14.04 LTS ------------------------------ @@ -316,7 +311,7 @@ Now we need to install ``pip`` and let it install ocrmypdf: .. code-block:: bash curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip - pip3.6 install ocrmypdf[fitz] + pip3.6 install ocrmypdf The ``wget`` command will download a program and run it. @@ -398,7 +393,7 @@ The following dependencies are recommended: - unpaper 6.1 - PyMuPDF 1.12.5 or newer -These are in addition to the Python packaging dependencies, meaning that unfortunately, the ``pip install`` command cannot satisfy all of them. +These are in addition to the Python packaging dependencies, meaning that unfortunately, the ``pip install`` command cannot satisfy all of them. Python 3.6 and Tesseract 4.0.0-beta.1 are recommended for best OCR results and best performance. diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 8cd748fa..3e23ab36 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -116,7 +116,7 @@ v6.1.1 v6.1.0 ------ -- PyMuPDF is now an optional but recommended dependency, to alleviate installation difficulties on platforms that have less access to PyMuPDF than the author anticipated. Install OCRmyPDF with ``pip install ocrmypdf[fitz]`` to use it to its full potential. +- PyMuPDF is now an optional but recommended dependency, to alleviate installation difficulties on platforms that have less access to PyMuPDF than the author anticipated. (For version 6.x only) install OCRmyPDF with ``pip install ocrmypdf[fitz]`` to use it to its full potential. - Fix ``FileExistsError`` that could occur if OCR timed out while it was generating the output file. (`#218 `_) diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py index 52ed7482..bc8d21c8 100755 --- a/src/ocrmypdf/__main__.py +++ b/src/ocrmypdf/__main__.py @@ -40,7 +40,6 @@ from .pdfa import file_claims_pdfa from .helpers import is_iterable_notstr, re_symlink, is_file_writable, \ available_cpu_count from .exec import tesseract, qpdf, ghostscript -from .lib import fitz from . import PROGRAM_NAME, VERSION from .exceptions import ExitCode, ExitCodeException, MissingDependencyError, \ @@ -750,11 +749,6 @@ def preamble(_log): _log.debug('ocrmypdf ' + VERSION) _log.debug('tesseract ' + tesseract.version()) _log.debug('qpdf ' + qpdf.version()) - if fitz: - _log.debug('PyMuPDF ' + fitz.version[0]) - _log.debug('libmupdf ' + fitz.version[1]) - else: - _log.debug('PyMuPDF not installed') def check_environ(options, _log): diff --git a/test_requirements.txt b/test_requirements.txt index e3c24956..10a71ae9 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -6,3 +6,4 @@ pytest-timeout python-xmp-toolkit # requires apt-get install libexempi3 # or brew install exempi PyPDF2 >= 1.26.0 +#PyMuPDF == 1.13.4 # optional diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 5abb3fbe..4322fb70 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -23,7 +23,11 @@ from datetime import timezone from ocrmypdf.pdfa import file_claims_pdfa, encode_pdf_date, decode_pdf_date from ocrmypdf.exceptions import ExitCode -from ocrmypdf.lib import fitz + +try: + import fitz +except ImportError: + fitz = None # pytest.helpers is dynamic # pylint: disable=no-member