Registry / database / graphdatascience

graphdatascience

JSON →
library1.22pypypi✓ verified 83d ago

A Python client for the Neo4j Graph Data Science (GDS) library, enabling users to run graph algorithms and manage graph projections directly from Python. Current version is 1.22, requiring Python >=3.10. The library is actively maintained with regular releases aligned with GDS server versions.

pip install graphdatascience
INSTALL
IMPORT
SIG · GRAPHDATASCIENCE
G
graphdatascience
databasepythonv1.22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GraphDataScience
from graphdatascience import GraphDataScience
from graphdatascience.client import GraphDataScience
In v1.x, the main class is exposed at the package level.

Connects to a Neo4j database and retrieves the GDS library version.

import os from graphdatascience import GraphDataScience URI = os.environ.get('NEO4J_URI', 'bolt://localhost:7687') AUTH = (os.environ.get('NEO4J_USER', 'neo4j'), os.environ.get('NEO4J_PASSWORD', 'password')) gds = GraphDataScience(URI, auth=AUTH) # Run a simple algorithm result = gds.run_cypher("RETURN gds.version() AS version") print(result) gds.close()
Debug
Known issues
breakingThe 'graphdatascience' package dropped support for Python 3.7 and 3.8 in v1.0. Python 3.9 was deprecated in v1.14 and removed in v1.17. Ensure your environment uses Python >=3.10.
fix
Upgrade Python to 3.10 or later before installing current versions.
affects: >=1.0
deprecatedThe `GraphDataScience` constructor no longer supports the `auth` parameter as a tuple; pass it as a `neo4j.Auth` object or use the `gds.auth` property. The tuple form still works but is deprecated.
fix
Use `Auth(('neo4j', password))` or set `gds.auth = ('neo4j', password)` after creation.
affects: >=1.18
gotchaAlways call `gds.close()` to release connections. Forgetting this can cause resource leaks and connection exhaustion.
fix
Use context manager: `with GraphDataScience(...) as gds: ...` or ensure `.close()` is called in a `finally` block.
affects: all
gotchaWhen using `gds.run_cypher()` with queries that return large results, the client may hold all data in memory. For large graph projections, use streaming or limit results.
fix
Use `yield` or cursor-based iteration if available, or apply LIMIT in your Cypher query.
affects: all
Errors
Common errors & fixes
AttributeError: module 'graphdatascience' has no attribute 'GraphDataScience'
Incorrect import path; GraphDataScience is not a direct attribute in older versions or submodules.
fix
Use `from graphdatascience import GraphDataScience` (or `GraphDataScience` is a top-level class).
neo4j.exceptions.ServiceUnavailable: Failed to establish connection to ...
Neo4j server is not running, URI is wrong, or port is blocked.
fix
Ensure Neo4j is started and accessible at the URI. Check firewall and port 7687 (default).
ValueError: authentication credentials must be a tuple or an Auth object
Passing `auth` as a single string or incorrect format.
fix
Use `auth=('neo4j', 'password')` or `auth=Auth(('neo4j', 'password'))`.
Upgrade
Version history
1.22latest on PyPI · released Jun 4, 2026
Audit
Dependencies
neo4joptionalRequired for database connectivity
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
graphdatascience — pip install graphdatascience · libregistry