HomeGuidesAPI ReferenceTutorials
Haystack

Installation

You can install Haystack in a couple of ways - basic using pip, full, and custom. Additionally, you can install REST API and a user interface to interact with it. Choose your installation method and follow the instructions.

Basic Installation

You can install a basic version of Haystack's latest release by using pip.

pip install farm-haystack

This command will install everything needed for basic Pipelines that use an Elasticsearch Document Store.

Full Installation

If you plan to be using more advanced features like certain DocumentStores, FileConverters, OCR or Ray, you will need to install further dependencies. The following command will install the latest version of Haystack from the main branch and all its dependencies.

pip install --upgrade pip
pip install 'farm-haystack[all]' ## or 'all-gpu' for the GPU-enabled dependencies

Custom Installation

If you want to avoid a full installation, but still need some extra dependencies you can pick dedicated dependency groups for your installation. To do so, specify them in the pip install command.

pip install 'farm-haystack[DEPENDENCY_OPTION]'

You can find a full list of dependency options at[haystack/pyproject.toml](https://github.com/deepset-ai/haystack/blob/main/pyproject.toml#L96). Some common options are:

Dependency OptionDescription
allInstall Haystack and all optional dependencies including developer tools.
all-gpuInstall Haystack and all optional dependencies including developer tools with GPU support.
docstoresInstall Haystack and all DocumentStores.
docstores-gpuInstall Haystack and all DocumentStores with GPU support.
faissInstall Haystack and FAISS support for the FAISSDocumentStore.
faiss-gpuInstall Haystack and FAISS support for the FAISSDocumentStore with GPU.
preprocessingInstall Haystack and all preprocessing tools such as PDF parsing and OCR.
ocrInstall Haystack and all OCR tools.
crawlerInstall Haystack and all web crawling tools.
rayInstall Haystack and Ray support for the RayPipeline.
devInstall Haystack and all development tools needed by contributors.
testInstall Haystack and all dependencies needed to run the full test suite locally.
colabInstall Haystack and all dependencies need to run Haystack in Google Colab.

If you are running pip<21.3 you won't be able to install dependency groups that reference other groups. Instead you can only specify groups that contain direct package references.

# instead of [all]
pip install farm-haystack[sql,only-faiss,only-milvus1,weaviate,graphdb,crawler,preprocessing,ocr,onnx,ray,dev]

# instead of [all-gpu]
pip install farm-haystack[sql,only-faiss-gpu,only-milvus1,weaviate,graphdb,crawler,preprocessing,ocr,onnx-gpu,ray,dev]

Installing the REST API and UI

Haystack comes packaged with a REST API so that it can be deployed as a service. There is also a UI that interacts with this service to provide an interactive app to the user. To install these, run the following from the root directory of the Haystack repo.

pip install rest_api/
pip install ui/

Other Operating Systems

Windows

We highly recommend installing WSL if you would like to use Haystack on Windows.

pip install farm-haystack -f https://download.pytorch.org/whl/torch_stable.html

Apple Silicon (M1)

Macs with a M1 processor require some extra dependencies in order to install Haystack.

# some additional dependencies needed on m1 mac
brew install postgresql
brew install cmake
brew install rust

# haystack installation
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true pip install farm-haystack

Related Links