From d3c9af909ba45cec3fc0cc5f43cf5a7f3079d322 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 19 Feb 2025 18:40:13 +0100 Subject: [PATCH 1/2] Update networkx_impl.py --- lightrag/kg/networkx_impl.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lightrag/kg/networkx_impl.py b/lightrag/kg/networkx_impl.py index 313d9f8d..a6d0edbb 100644 --- a/lightrag/kg/networkx_impl.py +++ b/lightrag/kg/networkx_impl.py @@ -20,13 +20,8 @@ if not pm.is_installed("networkx"): if not pm.is_installed("graspologic"): pm.install("graspologic") -try: - from graspologic import embed - import networkx as nx -except ImportError as e: - raise ImportError( - "`networkx` library is not installed. Please install it via pip: `pip install networkx`." - ) from e +from graspologic import embed +import networkx as nx @final From 52abf9cc50c33316b5ce16b3c5897471e497d702 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 19 Feb 2025 19:32:23 +0100 Subject: [PATCH 2/2] Removed useless try/except --- lightrag/kg/neo4j_impl.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lightrag/kg/neo4j_impl.py b/lightrag/kg/neo4j_impl.py index 82631cf8..0ddc611d 100644 --- a/lightrag/kg/neo4j_impl.py +++ b/lightrag/kg/neo4j_impl.py @@ -23,18 +23,13 @@ import pipmaster as pm if not pm.is_installed("neo4j"): pm.install("neo4j") -try: - from neo4j import ( - AsyncGraphDatabase, - exceptions as neo4jExceptions, - AsyncDriver, - AsyncManagedTransaction, - GraphDatabase, - ) -except ImportError as e: - raise ImportError( - "`neo4j` library is not installed. Please install it via pip: `pip install neo4j`." - ) from e +from neo4j import ( + AsyncGraphDatabase, + exceptions as neo4jExceptions, + AsyncDriver, + AsyncManagedTransaction, + GraphDatabase, +) config = configparser.ConfigParser() config.read("config.ini", "utf-8")