Hi, I have the Neo4j Desktop 5.11.0
I have installed the Graph Data Science Library plugin - I'm a bit confused with the Python connection I tried a couple of ways but I could not connect.
import neo4j
from graphdatascience import GraphDataScience
# Create a connection to the Neo4j database
gds = GraphDataScience("bolt://localhost:7687", auth=("neo4j", "12345678"))
d=gds.run_cypher("MATCH(n)-[r]-(m) RETURN n,r,m")
print(d)
And the Error-
---------------------------------------------------------------------------
CypherSyntaxError Traceback (most recent call last)
File ~/anaconda3/lib/python3.11/site-packages/graphdatascience/graph_data_science.py:93, in GraphDataScience.__init__(self, endpoint, auth, aura_ds, database, arrow, arrow_disable_server_verification, arrow_tls_root_certs, aura_db_connection_info)
92 try:
---> 93 server_version_string = self._query_runner.run_query("RETURN gds.version()", custom_error=False).squeeze()
94 except Exception as e:
File ~/anaconda3/lib/python3.11/site-packages/graphdatascience/query_runner/neo4j_query_runner.py:71, in Neo4jQueryRunner.run_query(self, query, params, database, custom_error)
70 else:
---> 71 raise e
73 # Though pandas support may be experimental in the `neo4j` package, it should always
74 # be supported in the `graphdatascience` package.
File ~/anaconda3/lib/python3.11/site-packages/graphdatascience/query_runner/neo4j_query_runner.py:66, in Neo4jQueryRunner.run_query(self, query, params, database, custom_error)
65 try:
---> 66 result = session.run(query, params)
67 except Exception as e:
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/work/session.py:311, in Session.run(self, query, parameters, **kwargs)
310 parameters = dict(parameters or {}, **kwargs)
--> 311 self._auto_result._run(
312 query, parameters, self._config.database,
313 self._config.impersonated_user, self._config.default_access_mode,
314 bookmarks, self._config.notifications_min_severity,
315 self._config.notifications_disabled_categories,
316 )
318 return self._auto_result
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/work/result.py:166, in Result._run(self, query, parameters, db, imp_user, access_mode, bookmarks, notifications_min_severity, notifications_disabled_categories)
165 self._connection.send_all()
--> 166 self._attach()
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/work/result.py:274, in Result._attach(self)
273 while self._attached is False:
--> 274 self._connection.fetch_message()
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/io/_common.py:180, in ConnectionErrorHandler.__getattr__.<locals>.outer.<locals>.inner(*args, **kwargs)
179 try:
--> 180 func(*args, **kwargs)
181 except (Neo4jError, ServiceUnavailable, SessionExpired) as exc:
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/io/_bolt.py:808, in Bolt.fetch_message(self)
805 tag, fields = self.inbox.pop(
806 hydration_hooks=self.responses[0].hydration_hooks
807 )
--> 808 res = self._process_message(tag, fields)
809 self.idle_since = perf_counter()
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/io/_bolt5.py:352, in Bolt5x0._process_message(self, tag, fields)
351 try:
--> 352 response.on_failure(summary_metadata or {})
353 except (ServiceUnavailable, DatabaseUnavailable):
File ~/anaconda3/lib/python3.11/site-packages/neo4j/_sync/io/_common.py:247, in Response.on_failure(self, metadata)
246 Util.callback(handler)
--> 247 raise Neo4jError.hydrate(**metadata)
CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Unknown function 'gds.version' (line 1, column 8 (offset: 7))
"RETURN gds.version()"
^}
During handling of the above exception, another exception occurred:
UnableToConnectError Traceback (most recent call last)
Cell In[60], line 5
2 from graphdatascience import GraphDataScience
4 # Create a connection to the Neo4j database
----> 5 gds = GraphDataScience("bolt://localhost:7687", auth=("neo4j", "12345678"))
6 d=gds.run_cypher("MATCH(n)-[r]-(m) RETURN n,r,m")
8 print(d)
File ~/anaconda3/lib/python3.11/site-packages/graphdatascience/graph_data_science.py:95, in GraphDataScience.__init__(self, endpoint, auth, aura_ds, database, arrow, arrow_disable_server_verification, arrow_tls_root_certs, aura_db_connection_info)
93 server_version_string = self._query_runner.run_query("RETURN gds.version()", custom_error=False).squeeze()
94 except Exception as e:
---> 95 raise UnableToConnectError(e)
96 finally:
97 # Some Python versions appear to not call __del__ of self._query_runner when an exception
98 # is raised, so we have to close the driver manually.
99 if isinstance(endpoint, str):
UnableToConnectError: {code: Neo.ClientError.Statement.SyntaxError} {message: Unknown function 'gds.version' (line 1, column 8 (offset: 7))
"RETURN gds.version()"
^}