安装

安装方法

1
2
3
4
conda create -n haystack python==3.8 -y
conda activate haystack
# 安装数据集库,便于下载数据集
pip install datasets>=2.6.1

最小安装

1
pip install farm-haystack

最大安装

1
pip install farm-haystack[full]

安装问题:

1 faiss失败

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  Building wheel for faiss-cpu (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for faiss-cpu (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
building 'faiss._swigfaiss' extension
swigging faiss\faiss\python\swigfaiss.i to faiss\faiss\python\swigfaiss_wrap.cpp
swig.exe -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWIN -o faiss\faiss\python\swigfaiss_wrap.cpp faiss\faiss\python\swigfaiss.i
error: command 'swig.exe' failed: None
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for faiss-cpu
Successfully built openai-whisper sentence-transformers langdetect seqeval tika sqlalchemy
Failed to build faiss-cpu
ERROR: Could not build wheels for faiss-cpu, which is required to install pyproject.toml-based projects

ref: https://github.com/kyamagu/faiss-wheels/issues/80

问题原因:python版本太高,找不到依赖的faiss库

解决方法:降级python,版本3.8成功

2.下载数据集出错不走代理

解决vscode 中的jupyter notebook网络问题,先在cmd中设置代理

1
set HTTP_PROXY=http://127.0.0.1:7890或者从软件中打开终端

(第一页 端口号旁边),然后cd到对应文件夹,再code .打开软件,即可下载数据集.

failure solution:尝试设置vscode和jupyter notebook代理均失败

3 torch

ImportError: Failed to import ‘torch’. Run ‘pip install farm-haystack[inference]’. Original error: No module named ‘torch’

solution:pip install farm-haystack[inference]
some warning:

1
2
3
4
5
6
7
8
WARNING: The script isympy.exe is installed in 'C:\Users\A\miniconda3\envs\haystack\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script nltk.exe is installed in 'C:\Users\A\miniconda3\envs\haystack\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts convert-caffe2-to-onnx.exe, convert-onnx-to-caffe2.exe and torchrun.exe are installed in 'C:\Users\A\miniconda3\envs\haystack\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts accelerate-config.exe, accelerate-estimate-memory.exe, accelerate-launch.exe and accelerate.exe are installed in 'C:\Users\A\miniconda3\envs\haystack\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

UI

chainlit