ipycytoscape is a Python library that provides a Cytoscape widget for Jupyter notebooks and JupyterLab environments. It allows users to visualize and interact with complex networks directly within their Jupyter workflows, leveraging the powerful rendering capabilities of Cytoscape.js. The current version is 1.3.3, with minor releases occurring every few months for bug fixes and compatibility updates.
pip install ipycytoscapeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a Cytoscape widget, populate it with data from a NetworkX graph, apply a layout, and display it in a Jupyter environment. The `set_layout()` call is essential for proper rendering.
Ensure you are using `ipycytoscape>=1.2.0` for JupyterLab 3+ compatibility without a build step. If upgrading from an older version, remove any manual `jupyter lab build` steps from your workflow. Consider `pip install --upgrade ipycytoscape`.
Always call `cy.set_layout(name='some_layout_name')` after adding graph data to the widget. Common layout names include 'cola', 'cose', 'grid', 'circle', 'random'.
Run `jupyter nbextension enable --py --sys-prefix ipycytoscape` from your terminal if widgets fail to load in classic Jupyter Notebook.
For JupyterLab 3+, ensure `ipycytoscape>=1.2.0` is installed. No manual build should be needed. For classic Notebook, try `jupyter nbextension enable --py --sys-prefix ipycytoscape`. Restart your kernel and browser.
Use the `set_layout` method with the `name` parameter, e.g., `cy.set_layout(name='cola')`. If you need custom layout options, provide a dictionary: `cy.set_layout(name='cose', options={'padding': 10})`.Install the package: `pip install ipycytoscape`. Ensure you are installing into the correct Python environment if you use virtual environments or conda environments.