{"id":10192,"library":"reaction-network","title":"Reaction-network","description":"Reaction-network is a Python package (version 8.3.0) for synthesis planning and predicting chemical reaction pathways in inorganic materials synthesis. It focuses on representing and analyzing chemical reactions, materials, and their relationships within a network structure. The library has a regular release cadence, with major versions introducing significant architectural changes.","status":"active","version":"8.3.0","language":"en","source_language":"en","source_url":"https://github.com/materialsintelligence/reaction-network","tags":["chemistry","materials science","synthesis planning","network analysis","inorganic chemistry","reaction pathways"],"install":[{"cmd":"pip install reaction-network","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core functionality for material representation.","package":"pymatgen","optional":false},{"reason":"For basic plotting capabilities.","package":"matplotlib","optional":false},{"reason":"For underlying graph and network structures.","package":"networkx","optional":false},{"reason":"For advanced network visualization (requires system-level graphviz install).","package":"graphviz","optional":true},{"reason":"For data manipulation and export (e.g., to CSV/Excel).","package":"pandas","optional":true}],"imports":[{"symbol":"Reaction","correct":"from reaction_network import Reaction"},{"symbol":"ReactionNetwork","correct":"from reaction_network import ReactionNetwork"},{"symbol":"ReactionParser","correct":"from reaction_network import ReactionParser"},{"symbol":"ReactionEntryGenerator","correct":"from reaction_network import ReactionEntryGenerator"},{"symbol":"ReactionGenerationConfig","correct":"from reaction_network import ReactionGenerationConfig"}],"quickstart":{"code":"from reaction_network import Reaction, ReactionNetwork\n\n# Define reactions\nr1 = Reaction.from_string(\"A + B -> C\")\nr2 = Reaction.from_string(\"C + D -> E\")\nr3 = Reaction.from_string(\"A + D -> F\") # A side reaction\n\n# Create a network\nrn = ReactionNetwork([r1, r2, r3])\n\n# Print materials and reactions\nprint(f\"Materials: {rn.materials}\")\nprint(f\"Reactions: {rn.reactions}\")\n\n# To plot the network (requires graphviz Python package and system executable)\n# rn.plot(filename=\"reaction_network.png\", fmt=\"png\")","lang":"python","description":"This quickstart demonstrates how to define basic chemical reactions from strings, combine them into a ReactionNetwork, and inspect its properties. It also includes commented-out code for plotting, highlighting the need for the optional Graphviz dependency."},"warnings":[{"fix":"Replace calls to `plot_reaction_network(my_network, ...)` with `my_network.plot(...)`.","message":"The top-level `plot_reaction_network` utility function has been removed in version 8.0.0. Network plotting is now a method of the `ReactionNetwork` object.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"When creating a `ReactionEntryGenerator`, instantiate `ReactionGenerationConfig` first and pass it: `config = ReactionGenerationConfig(...); generator = ReactionEntryGenerator(config)`.","message":"The `ReactionEntryGenerator` class constructor in v8.0.0+ now requires a `ReactionGenerationConfig` object as its primary argument. Direct instantiation without this config will raise an error.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Install the Python package (`pip install graphviz`) and the system package (e.g., `sudo apt install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS, or install from graphviz.org).","message":"For plotting reaction networks using `ReactionNetwork.plot()`, both the Python `graphviz` package (`pip install graphviz`) and the system-level Graphviz executable must be installed. The Python package alone is insufficient for rendering.","severity":"gotcha","affected_versions":"All versions with plotting"},{"fix":"Review the documentation for the updated reaction string format and adjust existing strings to conform to the new rules (e.g., explicit phases, proper stoichiometry syntax).","message":"Version 8.0.0 introduced stricter parsing rules for reaction strings, affecting `Reaction.from_string` and `ReactionParser`. Previously accepted formats might now raise `ParseError`.","severity":"breaking","affected_versions":">=8.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"If your code calls `plot_reaction_network(my_network)`, change it to `my_network.plot()`.","cause":"Attempting to use the old top-level `plot_reaction_network` function, which was removed in version 8.0.0 and replaced by a method on `ReactionNetwork` instances.","error":"TypeError: plot_reaction_network() missing 1 required positional argument: 'network'"},{"fix":"Instantiate `ReactionGenerationConfig` first, then pass it: `from reaction_network import ReactionEntryGenerator, ReactionGenerationConfig; config = ReactionGenerationConfig(); generator = ReactionEntryGenerator(config)`.","cause":"In `reaction-network` v8.0.0+, the `ReactionEntryGenerator` constructor requires a `ReactionGenerationConfig` object, which was not provided.","error":"TypeError: ReactionEntryGenerator.__init__() missing 1 required positional argument: 'config'"},{"fix":"Install the Python package: `pip install graphviz`. Also ensure the Graphviz executable is installed on your operating system (e.g., `sudo apt install graphviz` on Linux, `brew install graphviz` on macOS).","cause":"The `graphviz` Python package is not installed, which is required for plotting functionality, or the system-level Graphviz executable is missing or not in PATH.","error":"ModuleNotFoundError: No module named 'graphviz'"},{"fix":"Consult the official documentation for the correct syntax of reaction strings in `reaction-network` v8+ and adjust your string accordingly, paying attention to phases and coefficients.","cause":"The reaction string provided to `Reaction.from_string` or `ReactionParser` does not conform to the stricter parsing rules introduced in version 8.0.0.","error":"reaction_network.parser.ParseError: Invalid reaction string format: ..."}]}