mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
Fix No module named 'torch' (#553)
Do not import torch unless necessary
This commit is contained in:
parent
55967a7324
commit
5ac8a053f0
@ -31,7 +31,6 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import torch
|
|
||||||
from elastic_transport.client_utils import DEFAULT
|
from elastic_transport.client_utils import DEFAULT
|
||||||
from elasticsearch import AuthenticationException, Elasticsearch
|
from elasticsearch import AuthenticationException, Elasticsearch
|
||||||
|
|
||||||
@ -177,6 +176,8 @@ def check_cluster_version(es_client, logger):
|
|||||||
# PyTorch was upgraded to version 1.13.1 in 8.7.
|
# PyTorch was upgraded to version 1.13.1 in 8.7.
|
||||||
# and is incompatible with earlier versions
|
# and is incompatible with earlier versions
|
||||||
if major_version == 8 and minor_version < 7:
|
if major_version == 8 and minor_version < 7:
|
||||||
|
import torch
|
||||||
|
|
||||||
logger.error(f"Eland uses PyTorch version {torch.__version__} which is incompatible with Elasticsearch versions prior to 8.7. Please upgrade Elasticsearch to at least version 8.7")
|
logger.error(f"Eland uses PyTorch version {torch.__version__} which is incompatible with Elasticsearch versions prior to 8.7. Please upgrade Elasticsearch to at least version 8.7")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user