I'm trying out Milvus implementations on a jupyter notebook, but I run into an error when I try to connect to the Milvus server. I'm attaching the cell and the corresponding error for reference. Note that I'm using pymilvus 2.2.9.
Connect to Milvus service connections.connect(host=HOST, port=PORT)
Create collection collection = create_milvus_collection(COLLECTION_NAME, DIM) print(f'A new collection created: {COLLECTION_NAME}')
Error:
2023-06-19 03:51:10,646 - 8380245248 - decorators.py-decorators:108 - ERROR: RPC error: [__internal_register], <MilvusException: (code=1, message=this version of sdk is incompatible with server, please downgrade your sdk or upgrade your server )>, <Time:{'RPC start': '2023-06-19 03:51:10.636182', 'RPC error': '2023-06-19 03:51:10.646730'}>
_InactiveRpcError Traceback (most recent call last) File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:163, in upgrade_reminder..handler(*args, **kwargs) 162 try: 163 return func(*args, **kwargs) 164 except grpc.RpcError as e:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py:1359, in GrpcHandler.__internal_register(self, user, host) 1358 req = Prepare.register_request(user, host) 1359 response = self._stub.Connect(request=req) 1360 if response.status.error_code != common_pb2.Success:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_interceptor.py:247, in _UnaryUnaryMultiCallable.call(self, request, timeout, metadata, credentials, wait_for_ready, compression) 240 def call(self, 241 request: Any, 242 timeout: Optional[float] = None, (...) 245 wait_for_ready: Optional[bool] = None, 246 compression: Optional[grpc.Compression] = None) -> Any: 247 response, ignored_call = self._with_call(request, 248 timeout=timeout, 249 metadata=metadata, 250 credentials=credentials, 251 wait_for_ready=wait_for_ready, 252 compression=compression) 253 return response
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_interceptor.py:290, in _UnaryUnaryMultiCallable._with_call(self, request, timeout, metadata, credentials, wait_for_ready, compression) 287 call = self._interceptor.intercept_unary_unary(continuation, 288 client_call_details, 289 request) 290 return call.result(), call
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_channel.py:379, in _InactiveRpcError.result(self, timeout) 378 """See grpc.Future.result.""" 379 raise self
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_interceptor.py:274, in _UnaryUnaryMultiCallable._with_call..continuation(new_details, request) 273 try: 274 response, call = self._thunk(new_method).with_call( 275 request, 276 timeout=new_timeout, 277 metadata=new_metadata, 278 credentials=new_credentials, 279 wait_for_ready=new_wait_for_ready, 280 compression=new_compression) 281 return _UnaryOutcome(response, call)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_channel.py:1043, in _UnaryUnaryMultiCallable.with_call(self, request, timeout, metadata, credentials, wait_for_ready, compression) 1041 state, call, = self._blocking(request, timeout, metadata, credentials, 1042 wait_for_ready, compression) 1043 return _end_unary_response_blocking(state, call, True, None)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/grpc/_channel.py:910, in _end_unary_response_blocking(state, call, with_call, deadline) 909 else: 910 raise _InactiveRpcError(state)
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNIMPLEMENTED details = "unknown method Connect for service milvus.proto.milvus.MilvusService" debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:19530 {created_time:"2023-06-19T03:51:10.642309+05:30", grpc_status:12, grpc_message:"unknown method Connect for service milvus.proto.milvus.MilvusService"}"
The above exception was the direct cause of the following exception:
MilvusException Traceback (most recent call last) File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py:120, in GrpcHandler._wait_for_channel_ready(self, timeout) 119 grpc.channel_ready_future(self._channel).result(timeout=timeout) 120 self._setup_identifier_interceptor(self._user) 121 return
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py:220, in GrpcHandler._setup_identifier_interceptor(self, user) 219 host = socket.gethostname() 220 self._identifier = self.__internal_register(user, host) 221 self._identifier_interceptor = interceptor.header_adder_interceptor(["identifier"], [str(self._identifier)])
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:109, in error_handler..wrapper..handler(*args, **kwargs) 108 LOGGER.error(f"RPC error: [{inner_name}], {e}, Time:{record_dict}") 109 raise e 110 except grpc.FutureTimeoutError as e:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:105, in error_handler..wrapper..handler(*args, **kwargs) 104 record_dict["RPC start"] = str(datetime.datetime.now()) 105 return func(*args, **kwargs) 106 except MilvusException as e:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:136, in tracing_request..wrapper..handler(self, *args, **kwargs) 135 self.set_onetime_request_id(req_id) 136 ret = func(self, *args, **kwargs) 137 return ret
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:85, in retry_on_rpc_failure..wrapper..handler(self, *args, **kwargs) 84 else: 85 raise e 86 except Exception as e:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:50, in retry_on_rpc_failure..wrapper..handler(self, *args, **kwargs) 49 try: 50 return func(self, *args, **kwargs) 51 except grpc.RpcError as e: 52 # DEADLINE_EXCEEDED means that the task wat not completed 53 # UNAVAILABLE means that the service is not reachable currently 54 # Reference: https://grpc.github.io/grpc/python/grpc.html#grpc-status-code
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/decorators.py:168, in upgrade_reminder..handler(*args, **kwargs) 166 msg = "this version of sdk is incompatible with server, please downgrade your sdk or upgrade your "
167 "server " 168 raise MilvusException(message=msg) from e 169 raise eMilvusException: <MilvusException: (code=1, message=this version of sdk is incompatible with server, please downgrade your sdk or upgrade your server )>
The above exception was the direct cause of the following exception:
MilvusException Traceback (most recent call last) Cell In[7], line 2 1 # Connect to Milvus service 2 connections.connect(host=HOST, port=PORT) 4 # Create collection 5 collection = create_milvus_collection(COLLECTION_NAME, DIM)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/orm/connections.py:349, in Connections.connect(self, alias, user, password, db_name, token, **kwargs) 345 if parsed_uri.scheme == "https": 346 kwargs["secure"] = True 349 connect_milvus(**kwargs, user=user, password=password, token=token, db_name=db_name) 350 return 352 # 2nd Priority, connection configs from env
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/orm/connections.py:282, in Connections.connect..connect_milvus(**kwargs) 279 t = kwargs.get("timeout") 280 timeout = t if isinstance(t, (int, float)) else Config.MILVUS_CONN_TIMEOUT 282 gh._wait_for_channel_ready(timeout=timeout) 283 kwargs.pop('password') 284 kwargs.pop("token", None)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymilvus/client/grpc_handler.py:123, in GrpcHandler._wait_for_channel_ready(self, timeout) 121 return 122 except (grpc.FutureTimeoutError, MilvusException) as e: 123 raise MilvusException(Status.CONNECT_FAILED, 124 f'Fail connecting to server on {self._address}. Timeout') from e 126 raise MilvusException(Status.CONNECT_FAILED, 'No channel in handler, please setup grpc channel first')
MilvusException: <MilvusException: (code=2, message=Fail connecting to server on 127.0.0.1:19530. Timeout)>
I'm stuck, I had a grpcio issue when I was trying in colab asking me to downgrade my version to 1.53.0 and that did not work after downgrading either. I moved to jupyter and ran into what seems like a grpcio as well.
The similar issue was resolved by upgrading the Milvus server to version 2.2.10 and reinstalling the related libraries:
pip3 install protobuf==3.20.0
,pip3 install grpcio-tools
, andpip3 install pymilvus==2.2.11
.from https://milvus.io/docs/install-pymilvus.md