milvus-lite icon indicating copy to clipboard operation
milvus-lite copied to clipboard

It doesn't work in notebook

Open shiyu22 opened this issue 3 years ago • 9 comments

It works when I run this code with python command:

import milvus
milvus.start()
from pymilvus import connections, FieldSchema, CollectionSchema, DataType, Collection, utility
connections.connect(host='127.0.0.1', port='19530')
Collection('hello_milvus').num_entities

But when I run it in notebook will get error: 截屏2022-05-11 19 43 56 It seems that milvus is not started, but in cell 1 milvus.start has passed, strangely not printing "---Milvus Proxy successfully initialized and ready to serve!---".

And it's like milvus.start is asynchronous in the notebook, cell 2 will work after minutes.

shiyu22 avatar May 11 '22 11:05 shiyu22

Can you post the server logs here? (usually at /tmp/e-milvus/logs)

soothing-rain avatar May 13 '22 03:05 soothing-rain

Actually, I have no such directory with #2. Can you reproduce it?

shiyu22 avatar May 13 '22 03:05 shiyu22

Actually, I have no such directory with #2. Can you reproduce it?

Could be an old version. Can you check /tmp/milvus instead?

soothing-rain avatar May 13 '22 04:05 soothing-rain

From the log it looks like Milvus started successfully. Could be your version does not print that "---Milvus Proxy successfully initialized and ready to serve!---" line.

Try waiting a while (1-2 minutes) before trying to use it

soothing-rain avatar May 13 '22 04:05 soothing-rain

Actually, it sometimes prints "---Milvus Proxy initialized successfully, ready to serve!---". So if I want to run all cells at once, adding time.sleep to my notebook is the only way, which I think is confusing.

shiyu22 avatar May 13 '22 04:05 shiyu22

Emmm, sometime it takes longer for Milvus to fully startup and print that line. If not, it usually indicate something is wrong during Milvus startup

soothing-rain avatar May 13 '22 05:05 soothing-rain

Emmm, sometime it takes longer for Milvus to fully startup and print that line. If not, it usually indicate something is wrong during Milvus startup

Is there any function that checks if the embedded milvus is started? I added time.sleep(30) to the notebook but it still shows the error, I think it hasn't started successfully yet.

shiyu22 avatar May 16 '22 10:05 shiyu22

https://github.com/milvus-io/embd-milvus/issues/25 @shiyu22 Give it a try, it might be a good solution

soulteary avatar Sep 16 '22 18:09 soulteary