ModuleNotFoundError: No module named 'milvus'
Asked Answered
P

2

6

Goal: to run this Auto Labelling Notebook on AWS SageMaker Jupyter Labs.

Kernels tried: conda_pytorch_p36, conda_python3, conda_amazonei_mxnet_p27.


! pip install farm-haystack -q
# Install the latest master of Haystack
!pip install grpcio-tools==1.34.1 -q
!pip install git+https://github.com/deepset-ai/haystack.git -q
!wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.03.tar.gz
!tar -xvf xpdf-tools-linux-4.03.tar.gz && sudo cp xpdf-tools-linux-4.03/bin64/pdftotext /usr/local/bin
!pip install git+https://github.com/deepset-ai/haystack.git -q
# Here are the imports we need
from haystack.document_stores.elasticsearch import ElasticsearchDocumentStore
from haystack.nodes import PreProcessor, TransformersDocumentClassifier, FARMReader, ElasticsearchRetriever
from haystack.schema import Document
from haystack.utils import convert_files_to_dicts, fetch_archive_from_http, print_answers

Traceback:

02/02/2022 10:36:29 - INFO - faiss.loader -   Loading faiss with AVX2 support.
02/02/2022 10:36:29 - INFO - faiss.loader -   Could not load library with AVX2 support due to:
ModuleNotFoundError("No module named 'faiss.swigfaiss_avx2'",)
02/02/2022 10:36:29 - INFO - faiss.loader -   Loading faiss.
02/02/2022 10:36:29 - INFO - faiss.loader -   Successfully loaded faiss.
02/02/2022 10:36:33 - INFO - farm.modeling.prediction_head -   Better speed can be achieved with apex installed from https://www.github.com/nvidia/apex .
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-6ff421127e9c> in <module>
      1 # Here are the imports we need
----> 2 from haystack.document_stores.elasticsearch import ElasticsearchDocumentStore
      3 from haystack.nodes import PreProcessor, TransformersDocumentClassifier, FARMReader, ElasticsearchRetriever
      4 from haystack.schema import Document
      5 from haystack.utils import convert_files_to_dicts, fetch_archive_from_http, print_answers

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/__init__.py in <module>
      3 import pandas as pd
      4 from haystack.schema import Document, Label, MultiLabel, BaseComponent
----> 5 from haystack.finder import Finder
      6 from haystack.pipeline import Pipeline
      7 

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/finder.py in <module>
      6 from collections import defaultdict
      7 
----> 8 from haystack.reader.base import BaseReader
      9 from haystack.retriever.base import BaseRetriever
     10 from haystack import MultiLabel

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/reader/__init__.py in <module>
----> 1 from haystack.reader.farm import FARMReader
      2 from haystack.reader.transformers import TransformersReader

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/reader/farm.py in <module>
     22 
     23 from haystack import Document
---> 24 from haystack.document_store.base import BaseDocumentStore
     25 from haystack.reader.base import BaseReader
     26 

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/document_store/__init__.py in <module>
      2 from haystack.document_store.faiss import FAISSDocumentStore
      3 from haystack.document_store.memory import InMemoryDocumentStore
----> 4 from haystack.document_store.milvus import MilvusDocumentStore
      5 from haystack.document_store.sql import SQLDocumentStore

~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/haystack/document_store/milvus.py in <module>
      5 import numpy as np
      6 
----> 7 from milvus import IndexType, MetricType, Milvus, Status
      8 from scipy.special import expit
      9 from tqdm import tqdm

ModuleNotFoundError: No module named 'milvus'

pip install milvus
import milvus

Traceback:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-91c33e248077> in <module>
----> 1 import milvus

ModuleNotFoundError: No module named 'milvus'
Proprietor answered 2/2, 2022 at 10:40 Comment(2)
According to the milvus installation page(milvus.io/docs/v2.0.0/install-pymilvus.md) you need to use pymilvus package.Syce
pip install pymilvus and import pymilvus throws the same Traceback ;(Proprietor
R
3

I would recommend to downgrade your milvus version to a version before the 2.0 release just a week ago. Here is a discussion on that topic: https://github.com/deepset-ai/haystack/issues/2081

Registration answered 3/2, 2022 at 9:29 Comment(3)
Ah ok, not just me then! What pip install ... woukd you recommend I use instead?Proprietor
ERROR: Could not find a version that satisfies the requirement milvus==1.1.1 (from versions: none) ERROR: No matching distribution found for milvus==1.1.1Proprietor
The suggestion in the linked issue is to run the following three commands to downgrade: pip uninstall farm-haystack echo 'pymilvus==1.1.2' > /tmp/constraints.txt pip install -c constraints.txt farm-haystackRegistration
H
5

I was facing the same problem and I got around it by simply uninstalling pymilvus and reinstalling the older version.

pip list showed pymilvus v2.0.0

pip uninstall pymilvus removed the current version

pip install pymilvus==1.1.2 installed the older version and voilà;

IT WORKS PEACEFULLY

Homosexuality answered 15/2, 2022 at 19:23 Comment(0)
R
3

I would recommend to downgrade your milvus version to a version before the 2.0 release just a week ago. Here is a discussion on that topic: https://github.com/deepset-ai/haystack/issues/2081

Registration answered 3/2, 2022 at 9:29 Comment(3)
Ah ok, not just me then! What pip install ... woukd you recommend I use instead?Proprietor
ERROR: Could not find a version that satisfies the requirement milvus==1.1.1 (from versions: none) ERROR: No matching distribution found for milvus==1.1.1Proprietor
The suggestion in the linked issue is to run the following three commands to downgrade: pip uninstall farm-haystack echo 'pymilvus==1.1.2' > /tmp/constraints.txt pip install -c constraints.txt farm-haystackRegistration

© 2022 - 2024 — McMap. All rights reserved.