Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Milvus #2081

Closed
1 task
HAIXteam opened this issue Jan 27, 2022 · 22 comments
Closed
1 task

Issue with Milvus #2081

HAIXteam opened this issue Jan 27, 2022 · 22 comments

Comments

@HAIXteam
Copy link

Describe the bug
We installed farm_reader.

Error message
1)we installled farm-haystack==0.9.0
2) We installed pip3 install pymilvus==1.1.2

File "/app/main.py", line 6, in
from haystack import document_store
File "/usr/local/lib/python3.7/site-packages/haystack/init.py", line 5, in
from haystack.finder import Finder
File "/usr/local/lib/python3.7/site-packages/haystack/finder.py", line 8, in
from haystack.reader.base import BaseReader
File "/usr/local/lib/python3.7/site-packages/haystack/reader/init.py", line 1, in
from haystack.reader.farm import FARMReader
File "/usr/local/lib/python3.7/site-packages/haystack/reader/farm.py", line 21, in
from haystack.document_store.base import BaseDocumentStore
File "/usr/local/lib/python3.7/site-packages/haystack/document_store/init.py", line 4, in
from haystack.document_store.milvus import MilvusDocumentStore
File "/usr/local/lib/python3.7/site-packages/haystack/document_store/milvus.py", line 7, in
from milvus import IndexType, MetricType, Milvus, Status
ModuleNotFoundError: No module named 'milvus'

Expected behavior
It was working until 25th Jan and it stopped working.

Additional context
Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.

To Reproduce
Steps to reproduce the behavior

FAQ Check

System:

  • OS: Ubuntu
  • GPU/CPU: CPU
  • Haystack version (commit or version number): farm_reader
  • DocumentStore:
  • Reader:
  • Retriever:
@AbhiPawar5
Copy link

I am facing a similar issue.

Environment:
fastapi==0.70.1
uvicorn==0.16.0
psycopg2==2.9.3
SQLAlchemy==1.4.29
farm-haystack==1.0.0

Error Log:
app_1 | Traceback (most recent call last):
app_1 | File "/code/app.py", line 8, in
app_1 | from haystack.document_stores.faiss import FAISSDocumentStore
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/init.py", line 7, in
app_1 | from haystack import pipelines
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/pipelines/init.py", line 1, in
app_1 | from haystack.pipelines.base import Pipeline, RootNode, RayPipeline
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/pipelines/base.py", line 16, in
app_1 | from haystack.nodes.evaluator.evaluator import calculate_em_str_multi, calculate_f1_str_multi, semantic_answer_similarity
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/nodes/init.py", line 2, in
app_1 | from haystack.nodes.answer_generator import BaseGenerator, RAGenerator, Seq2SeqGenerator
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/nodes/answer_generator/init.py", line 2, in
app_1 | from haystack.nodes.answer_generator.transformers import RAGenerator, Seq2SeqGenerator
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/nodes/answer_generator/transformers.py", line 14, in
app_1 | from haystack.nodes.retriever.dense import DensePassageRetriever
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/nodes/retriever/init.py", line 1, in
app_1 | from haystack.nodes.retriever.base import BaseRetriever
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/nodes/retriever/base.py", line 12, in
app_1 | from haystack.document_stores.base import BaseDocumentStore, BaseKnowledgeGraph
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/document_stores/init.py", line 11, in
app_1 | from haystack.document_stores.milvus import MilvusDocumentStore # type: ignore
app_1 | File "/usr/local/lib/python3.9/site-packages/haystack/document_stores/milvus.py", line 11, in
app_1 | from milvus import IndexType, MetricType, Milvus, Status
app_1 | ModuleNotFoundError: No module named 'milvus'

System:
OS: Ubuntu 14.04 LTS
GPU/CPU: CPU
DocumentStore: FAISS

@afiqmuzaffar
Copy link

afiqmuzaffar commented Jan 28, 2022

Same goes to me for deepset-ai/rasa-haystack by using docker-compose.

2022-01-28 07:27:02 INFO rasa_sdk.endpoint - Starting action endpoint server...
2022-01-28 07:27:04 DEBUG ray - [ray] Forcing OMP_NUM_THREADS=1 to avoid performance degradation with many workers (issue #6998). You can override this by explicitly setting OMP_NUM_THREADS.
/opt/venv/lib/python3.8/site-packages/ray/autoscaler/_private/cli_logger.py:57: FutureWarning: Not all Ray CLI dependencies were found. In Ray 1.4+, the Ray CLI, autoscaler, and dashboard will only be usable via pip install 'ray[default]'. Please update your install command.
warnings.warn(
2022-01-28 07:27:11 ERROR rasa_sdk.executor - Failed to register package 'actions'.
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 262, in register_package
self._import_submodules(package)
File "/opt/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 225, in _import_submodules
self._import_module(full_name)
File "/opt/venv/lib/python3.8/site-packages/rasa_sdk/executor.py", line 239, in _import_module
module = importlib.import_module(name)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/app/actions/actions.py", line 11, in
from haystack.document_store.elasticsearch import ElasticsearchDocumentStore
File "/opt/venv/lib/python3.8/site-packages/haystack/init.py", line 14, in
from haystack.pipeline import Pipeline
File "/opt/venv/lib/python3.8/site-packages/haystack/pipeline.py", line 30, in
from haystack.generator.base import BaseGenerator
File "/opt/venv/lib/python3.8/site-packages/haystack/generator/init.py", line 1, in
from haystack.generator.transformers import RAGenerator
File "/opt/venv/lib/python3.8/site-packages/haystack/generator/transformers.py", line 14, in
from haystack.retriever.dense import DensePassageRetriever
File "/opt/venv/lib/python3.8/site-packages/haystack/retriever/init.py", line 1, in
from haystack.retriever.dense import DensePassageRetriever, EmbeddingRetriever
File "/opt/venv/lib/python3.8/site-packages/haystack/retriever/dense.py", line 13, in
from haystack.document_store.base import BaseDocumentStore
File "/opt/venv/lib/python3.8/site-packages/haystack/document_store/init.py", line 4, in
from haystack.document_store.milvus import MilvusDocumentStore
File "/opt/venv/lib/python3.8/site-packages/haystack/document_store/milvus.py", line 7, in
from milvus import IndexType, MetricType, Milvus, Status
ModuleNotFoundError: No module named 'milvus'

System:

OS: Ubuntu 18.04
GPU/CPU: CPU
Haystack version (commit or version number): farm_reader
DocumentStore:
Reader:
Retriever:

@Krak91
Copy link
Contributor

Krak91 commented Jan 28, 2022

Having the same issue now after re-installing farm-haystack==1.0.0.

Setting this environment variable MILVUS2_ENABLED=False solved it.
(

if os.getenv("MILVUS2_ENABLED"):
)

Why were older releases affected by this?

@baregawi
Copy link
Contributor

PyMilvus updated to version 2.0.0 on January 25th and that is now what gets installed from PyPI by default so recent recent farm-haystack installations have been breaking. I fixed this issue by installing pymilvus==1.1.2. I am certain that the error comes from trying to use pymilvus==2.0.0. It is easy to confirm by reading the code, doing the imports and checking versions yourself. So my guess is that you are did not install pymilvus==1.1.2 in a way that haystack is accessing that pymilvus version.

@baregawi
Copy link
Contributor

For those who have tried pip install pymilvus==1.1.2 and have not found success you can try uninstalling haystack and reinstalling it again with a constraints file:
pip install -c constraints.txt farm-haystack
With the contents of constraints.txt as:
pymilvus==1.1.2

Or for short:

pip uninstall farm-haystack
echo 'pymilvus==1.1.2' > /tmp/constraints.txt
pip install -c constraints.txt farm-haystack

@ZanSara
Copy link
Contributor

ZanSara commented Jan 28, 2022

Hey @baregawi, thank you so much for the comments above! The issue was really the latest release of Milvus and pinning its version to the latest 1.x release (in this case, 1.1.2) should fix it.

@Krak91 Haystack has partial Milvus2 support since a few releases, it was just hidden behind that environment variable. Setting it to any value should enable Milvus 2.0 support, which on one hand fixes the bug (because this way, the imports will be working with pymilvus==2.0.0), but the code paths that it enables are a bit buggy, so I generally wouldn't recommend to do it unless you have no way to downgrade pymilvus.

As a general reminder, make sure that also your Milvus containers or local installation also are fixed to v1.1.2 to avoid incompatibilities between Milvus and pymilvus. Sorry for this issue!

@Krak91
Copy link
Contributor

Krak91 commented Jan 28, 2022

@ZanSara thanks for the clarification. If I don't intent to use milvus at all, is the env variable sufficient or is it still recommended to downgrade the version?

@ZanSara
Copy link
Contributor

ZanSara commented Jan 28, 2022

@Krak91 I recommend to downgrade. The code that is enabled by setting the env var is experimental and contains some bugs, so it might always cause unforeseen issues later. Downgrading pymilvus is safer and way better tested 🙂

@julian-risch
Copy link
Member

@ZanSara @MichelBartels is that problem resolved now?

@ZanSara
Copy link
Contributor

ZanSara commented Feb 11, 2022

I'd say Milvus2 support is not ready for use yet, but a lot of progress has been done. See this PR: #2126

@alankashkash
Copy link

Hey. I've been trying to list Haystack in the requirements.txt file with the constraint like proposed above but it doesn't work. Any idea how to list haystack in requirements.txt and bypass this issue?

@ZanSara
Copy link
Contributor

ZanSara commented Feb 22, 2022

Hey @alankashkash, could you give us more details? For example, which version of Haystack, pip and Python are you using? The answer is likely to differ depending on whether you installed Haystack from PyPI or from GitHub.

@alankashkash
Copy link

Hey @ZanSara absolutely. Thank you for the response!
Python 3.8
Pip 21.3.1
Installing from PyPI

I'm using AWS Elasticbeanstalk to deploy API and did a little PoC endpoint using Haystack. However, since AWS EB installs all packages using requirements.txt I'm not able to provide additional commands for setting up a constraint. Appreciate any suggestions :)

@ZanSara
Copy link
Contributor

ZanSara commented Feb 24, 2022

@alankashkash ok, you can probably upgrade then! We release version 1.2.0 just yesterday, and it comes with improved dependency management. Two ways to go with it:

  1. If you can upgrade pip to pip>=22.0.0, then try to install Haystack as pip install farm-haystack[milvus]==1.2.0. This will install the new Milvus2 support properly, but I have to verify if the env var (MILVUS2_ENABLED=1) is still required. I'd recommend to set it, to be sure.
  2. If you cannot upgrade pip, then please install Haystack with pip install farm-haystack[only-milvus,sql]==1.2.0. Same story for the env var.

Let me know if this helps!

@ZanSara
Copy link
Contributor

ZanSara commented Feb 25, 2022

In addition, we recently merged full support for Milvus2! 🎉 #2126

master now defaults to Milvus2. So if you were using Milvus2 and you pull the latest master, please reinstall with pip install .[milvus] (pip>=22) or pip install .[sql,only-milvus] (pip<22). Env vars and other hacks can be safely removed now.

@xiaofan-luan
Copy link

Thanks for the hardworking to support milvus 2.0 @ZanSara
Would you mind if I add deepset-ai into milvus adopted list so if any user of milvus are intersted in NLP models they could learn deeply about deepset-ai

@xiaofan-luan
Copy link

Milvus will soon support embedded model so user could play with a simply a pip install~

@ZanSara
Copy link
Contributor

ZanSara commented Mar 16, 2022

Hello @xiaofan-luan, sure, feel free to add us to the list! 🙂

Many thanks for the heads up about the embedded model feature! We'll look into it 👍

@ZanSara
Copy link
Contributor

ZanSara commented Mar 28, 2022

Since release 1.3.0 includes all Milvus fixes, I will close this issue. If you still experience similar problems with Milvus, please open a new issue 🙂

@ZanSara ZanSara closed this as completed Mar 28, 2022
@ZanSara ZanSara unpinned this issue Mar 28, 2022
@skp-1997
Copy link

skp-1997 commented May 4, 2022

I am building docker image of my project with Python3.8 as base image. And installing pymilvus in it. But when I run container, I am getting no module name pymilvus error. I tried to downgrade the version of pymilvus, still getting same issue. Any suggestions?

@ZanSara
Copy link
Contributor

ZanSara commented May 16, 2022

Sounds weird. Could you open a new issue about this, with more details about your image?

PS: Sorry for the late reply, but we don't monitor old and closed threads like this one. I noticed your reply mostly by chance. Next time please open a new issue instead.

@hyunsir
Copy link

hyunsir commented Nov 21, 2022

pymilvus==1.1.2 !!!!
Don't set version >= 1.2.0 , neither too low.
It's an unstable third-part lib, show be carefully piped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests