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 Option | Description |
---|---|
preprocessing | Install Haystack and all preprocessing tools, such as PDF parsing and OCR. |
ocr | Install Haystack and all OCR tools. |
crawler | Install Haystack and all web crawling tools. |
faiss | Install Haystack and FAISS support for the FAISSDocumentStore. |
faiss-gpu | Install Haystack and FAISS support for the FAISSDocumentStore with GPU. |
opensearch | Install Haystack and Opensearch support for the OpenSearchDocumentStore. |
milvus | Install Haystack and Milvus support for the MilvusDocumentStore. |
weaviate | Install Haystack and Weaviate support for the WeaviateDocumentStore. |
pinecone | Install Haystack and Pinecone support for the PineconeDocumentStore. |
docstores | Install Haystack and all DocumentStores. |
docstores-gpu | Install Haystack and all DocumentStores with GPU support. |
ray | Install Haystack and Ray support for the RayPipeline. |
dev | Install Haystack and all development tools needed by contributors. |
colab | Install Haystack and all dependencies needed to run Haystack in Google Colab. |
all | Install Haystack and all optional dependencies, including developer tools. |
all-gpu | Install 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
Updated 2 months ago