{"id":8464,"library":"py2neo-history","title":"py2neo (Legacy)","description":"Py2neo is a Python client library and toolkit for working with Neo4j graph databases. It provides a high-level API, an Object-Graph Mapper (OGM), and various utilities for interacting with Neo4j via both Bolt and HTTP protocols. As of 2023, the original `py2neo` project, and consequently `py2neo-history` (which mirrors `py2neo` up to version 2021.2.3), are considered End-of-Life (EOL) and are no longer maintained. Users are strongly recommended to migrate to the official Neo4j Python Driver or the `neomodel` OGM for ongoing development. This entry specifically refers to the `py2neo-history` package for accessing older versions.","status":"abandoned","version":"2021.2.3","language":"en","source_language":"en","source_url":"https://github.com/neo4j-contrib/py2neo","tags":["neo4j","graph-database","ogm","legacy","eol"],"install":[{"cmd":"pip install py2neo-history==2021.2.3","lang":"bash","label":"Install specific legacy version"}],"dependencies":[{"reason":"SSL certificate validation","package":"certifi","optional":false},{"reason":"Externalized data type and PackStream functionality (as of 2021.2)","package":"interchange","optional":false},{"reason":"Monotonic clock for timing","package":"monotonic","optional":false},{"reason":"Core utility for version parsing","package":"packaging","optional":false},{"reason":"Console ANSI styling","package":"pansi","optional":false},{"reason":"Cypher lexer for syntax highlighting","package":"pygments","optional":false},{"reason":"Python 2/3 compatibility utilities","package":"six","optional":false},{"reason":"HTTP client library","package":"urllib3","optional":false}],"imports":[{"symbol":"Graph","correct":"from py2neo import Graph"},{"symbol":"Node","correct":"from py2neo import Node"},{"symbol":"Relationship","correct":"from py2neo import Relationship"},{"note":"GraphObject (for OGM) was moved to py2neo.ogm in later versions, but generally used as `from py2neo.ogm import GraphObject` from v4 onwards.","wrong":"from py2neo import GraphObject","symbol":"GraphObject","correct":"from py2neo.ogm import GraphObject"}],"quickstart":{"code":"import os\nfrom py2neo import Graph, Node, Relationship\n\n# Ensure Neo4j is running and accessible\nuri = os.environ.get(\"NEO4J_URI\", \"bolt://localhost:7687\")\nusername = os.environ.get(\"NEO4J_USERNAME\", \"neo4j\")\npassword = os.environ.get(\"NEO4J_PASSWORD\", \"password\")\n\ntry:\n    graph = Graph(uri, auth=(username, password))\n    # Verify connection and run a simple query\n    result = graph.run(\"CREATE (a:Person {name: 'Alice'}) RETURN a.name AS name\").data()\n    print(f\"Connected to Neo4j. Query result: {result}\")\n\n    # Create nodes and a relationship\n    alice = Node(\"Person\", name=\"Alice\")\n    bob = Node(\"Person\", name=\"Bob\")\n    knows = Relationship(alice, \"KNOWS\", bob)\n    graph.create(knows)\n    print(\"Created Alice, Bob, and a KNOWS relationship.\")\n\n    # Fetch all Person nodes\n    people = graph.run(\"MATCH (p:Person) RETURN p.name\").data()\n    print(\"People in the database:\")\n    for p in people:\n        print(f\"- {p['p.name']}\")\n\nexcept Exception as e:\n    print(f\"Error connecting to or querying Neo4j: {e}\")","lang":"python","description":"Connects to a Neo4j database using environment variables for credentials, creates a simple graph, and runs a Cypher query to retrieve data. This example demonstrates basic connection, node/relationship creation, and query execution."},"warnings":[{"fix":"Migrate your application to use `neo4j-python-driver` (for direct Cypher execution) or `neomodel` (for OGM capabilities). Refer to official Neo4j migration guides.","message":"The `py2neo` library (and thus `py2neo-history`) is End-of-Life (EOL) and no longer maintained. No further updates, bug fixes, or security patches will be released. It is highly recommended to migrate to the official Neo4j Python Driver or `neomodel` for new development and existing projects.","severity":"breaking","affected_versions":"2021.2.3 and all prior versions"},{"fix":"Ensure `ipy2neo` and `interchange` are installed if using the affected features. Upgrade Python to 3.5+.","message":"Breaking API changes were introduced in `py2neo` 2021.2. Command line functionality was moved to the separate `ipy2neo` project, and core data type/PackStream functionality to `interchange`. Support for Python 3.4 was also dropped.","severity":"breaking","affected_versions":"2021.2.0 onwards"},{"fix":"Review the specific `py2neo` version's documentation for correct method calls. For `Graph.cypher.execute()`, use `graph.run()`. For `Graph.find_one()`, use `graph.nodes.match(label, property=value).first()` or OGM `Model.match(graph, property_value).first()`.","message":"Changes in major version APIs, such as `Graph.cypher.execute()` being replaced by `Graph.run()` for Cypher execution, and `Graph.find_one()` (from v3) being replaced by `NodeMatcher.first()` or OGM patterns (from v4).","severity":"breaking","affected_versions":"Pre-2020 (v3, v4) to 2020.x/2021.x"},{"fix":"Always check the release notes for version `YYYY.N.M` for breaking changes. For bug fixes, it's generally required to upgrade to the absolute latest available version.","message":"`py2neo` switched to Calendar Versioning (YYYY.N.M) from 2020, with yearly increments often indicating significant changes. Patches are typically only applied to the latest release within a year, meaning older minor versions within the same year may not receive bug fixes.","severity":"gotcha","affected_versions":"2020.x onwards"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify your Neo4j database credentials (username and password). If using a fresh Neo4j installation, ensure you have changed the default password for the 'neo4j' user. Example: `graph = Graph(uri, auth=(\"neo4j\", \"your_new_password\"))`","cause":"Incorrect username or password provided during `Graph` object initialization, or the default 'neo4j' password was not changed after initial Neo4j setup.","error":"py2neo.errors.ClientError: [Security.Unauthorized] The client is unauthorized due to authentication failure."},{"fix":"Ensure your Neo4j database instance is running. Verify the correct port and URI for your Neo4j instance. Check local firewall settings to ensure the port (default 7687 for Bolt) is open.","cause":"The Neo4j database is not running, or is not accessible at the specified URI and port (e.g., 'bolt://localhost:7687'), or a firewall is blocking the connection.","error":"py2neo.wiring.WireError: Cannot connect to IPv4Address(('localhost', 7687)) / ConnectionRefusedError: [Errno 111] Connection refused"},{"fix":"Replace calls to `graph.cypher.execute()` with `graph.run()`. For example, `graph.cypher.execute('MATCH (n) RETURN n')` becomes `graph.run('MATCH (n) RETURN n')`.","cause":"This error occurs when attempting to use the `graph.cypher.execute()` method from older `py2neo` versions (pre-v4/v5) with a `py2neo` 2020.x or 2021.x installation.","error":"AttributeError: 'Graph' object has no attribute 'cypher'"},{"fix":"Use the `NodeMatcher` or OGM patterns. For example, to find a single node by label and property: `graph.nodes.match(\"Person\", name=\"Alice\").first()` or `Person.match(graph, \"Alice\").first()` if using OGM.","cause":"The `find_one` method was deprecated and removed in `py2neo` v4 and later, replaced by more flexible matching mechanisms.","error":"AttributeError: 'Graph' object has no attribute 'find_one'"}]}