HomeDocumentationAPI ReferenceTutorials
Haystack Homepage

Installation

You can install Haystack in a couple of ways - basic using pip, full, and custom. You can also install REST API. Choose your installation method and follow the instructions.

Basic Installation

Use pip to install a basic version of Haystack's latest release:

pip install farm-haystack

This command installs everything you need for basic Pipelines that use an Elasticsearch DocumentStore.

Full Installation

To use more advanced features, like certain DocumentStores, FileConverters, OCR, or Ray, install further dependencies. The following command installs the latest version of Haystack and all its dependencies from the main branch:

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

Custom Installation

You can choose the dependencies you want to install. 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. Common options are:

Dependency OptionDescription
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.
faissInstall Haystack and FAISS support for the FAISSDocumentStore.
faiss-gpuInstall Haystack and FAISS support for the FAISSDocumentStore with GPU.
opensearchInstall Haystack and Opensearch support for the OpenSearchDocumentStore.
milvusInstall Haystack and Milvus support for the MilvusDocumentStore.
weaviateInstall Haystack and Weaviate support for the WeaviateDocumentStore.
pineconeInstall Haystack and Pinecone support for the PineconeDocumentStore.
docstoresInstall Haystack and all DocumentStores.
docstores-gpuInstall Haystack and all DocumentStores with GPU support.
rayInstall Haystack and Ray support for the RayPipeline.
devInstall Haystack and all development tools needed by contributors.
colabInstall Haystack and all dependencies needed to run Haystack in Google Colab.
allInstall Haystack and all optional dependencies, including developer tools.
all-gpuInstall Haystack and all optional dependencies, including developer tools with GPU support.

If you are running pip<21.3, you can't 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,pinecone,opensearch,graphdb,inmemorygraph,crawler,preprocessing,ocr,onnx,ray,dev]

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

Installing the REST API

Haystack comes packaged with a REST API so that you can deploy it as a service. Run the following command from the root directory of the Haystack repo to install REST_API:

pip install rest_api/

Other Operating Systems

Windows

We recommend installing WSL to use Haystack on Windows:

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

Apple Silicon (M1)

Macs with an M1 processor require some extra dependencies 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