milvus-io / pymilvus

Python SDK for Milvus.
Apache License 2.0
1.04k stars 333 forks source link

[Bug]: Why do i get "ImportError: sys.meta_path is None, Python is likely shutting down" when trying to run Milvus #2282

Open VanechikSpace opened 1 month ago

VanechikSpace commented 1 month ago

Describe the bug

When i run the following code:

from pymilvus import MilvusClient

client = MilvusClient("milvus.db")
print("hello")

i see the following result:

hello
Exception ignored in: <function ServerManager.__del__ at 0x7f3d1f9a2f20>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/milvus_lite/server_manager.py", line 58, in __del__
  File "/usr/local/lib/python3.12/dist-packages/milvus_lite/server_manager.py", line 53, in release_all
  File "/usr/local/lib/python3.12/dist-packages/milvus_lite/server.py", line 118, in stop
  File "/usr/lib/python3.12/pathlib.py", line 1164, in __init__
  File "/usr/lib/python3.12/pathlib.py", line 358, in __init__
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function Server.__del__ at 0x7f3d1f9a2d40>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/milvus_lite/server.py", line 122, in __del__
  File "/usr/local/lib/python3.12/dist-packages/milvus_lite/server.py", line 118, in stop
  File "/usr/lib/python3.12/pathlib.py", line 1164, in __init__
  File "/usr/lib/python3.12/pathlib.py", line 358, in __init__
ImportError: sys.meta_path is None, Python is likely shutting down

qwer.db file is created but i don't want to get this error

Expected Behavior

I don't want to get this error

Environment details

- Method of installation (Docker, or from source): sudo pip install pymilvus pymilvus[model] pymilvus[bulk_writer] --break-system-packages

- pymilvus version: 2.4.7

Anything else?

I tried to run this code:

from pymilvus import MilvusClient

try:
    client = MilvusClient("qwer.db")
finally:
    client.close()

but the result is the same.

UPD I have managed to fix the issue by moving to python3.9 from python3.12.

So pymilvus doesn't support python3.12 ?

XuanYang-cn commented 1 month ago

Looks like an issue of Milvus-lite

XuanYang-cn commented 1 month ago

/assign @junjiejiangjjj

sre-ci-robot commented 1 month ago

@XuanYang-cn: GitHub didn't allow me to assign the following users: junjiejiangjjj.

Note that only milvus-io members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to [this](https://github.com/milvus-io/pymilvus/issues/2282#issuecomment-2409837065): >/assign @junjiejiangjjj Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
junjiejiangjjj commented 1 month ago

hi @VanechikSpace , I run it with Python 3.12.4 and it works fine. You can use conda to recreate a Python 3.12 environment and try it.

dnns92 commented 4 days ago

I have the same issue on this environment:

Python 3.12.3
milvus-lite==2.4.10
pymilvus==2.4.9