Installing docling on macOS (Intel)
This guide provides a comprehensive walkthrough for installingdocling on an Intel-based macOS machine. This process addresses potential compatibility issues with PyTorch and other dependencies.
Prerequisites
- Homebrew: Ensure you have Homebrew installed on your system. If not, you can install it by following the instructions on the official Homebrew website.
- Python 3.12 or lower:
doclingrequires a Python version of 3.12 or lower. This guide will assume you have it installed.
Installation Steps
-
Create a Dedicated Directory: It’s good practice to create a dedicated directory for your
doclingprojects and virtual environment. You can create a directory in your home folder: -
Create a Virtual Environment: To avoid conflicts with other Python projects, it’s highly recommended to use a virtual environment. Create a new virtual environment named
docling-venvusingpython3.12: -
Activate the Virtual Environment: Before installing any packages, you need to activate the virtual environment:
Your terminal prompt should now be prefixed with
(docling-venv), indicating that the virtual environment is active. -
Install PyTorch: Install the compatible version of PyTorch (
2.2.2) before installingdocling. This is a crucial step to avoid compilation errors on Intel-based Macs. -
Install docling with All Dependencies: Now, you can install
docling. We will use the--prefer-binaryflag to instructpipto use pre-compiled packages (wheels) whenever possible, which helps to avoid compilation issues. -
Verify the Installation: Once the installation is complete, you can verify that
doclingis installed correctly by checking its version:You should see the installed version ofdoclingand its components printed to the console.
Deactivating the Virtual Environment
When you are finished usingdocling, you can deactivate the virtual environment by running the following command:
