# Hands-On Graph Neural Networks: a book repository frozen on PyTorch 1.13

> The code that accompanies a Packt book on graph neural networks, sixteen chapter directories of notebooks and scripts, with a requirements file that pins torch 1.13.1 and the CUDA 11.7 build of PyTorch Geometric. The code is the book's worked examples, and the pins are the tell for how you will run it.

**PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python** — Hands-On Graph Neural Networks Using Python, published by Packt

- Repository: https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python
- Stars: 1,065 · Forks: 300
- Language: Jupyter Notebook
- License: MIT
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/packtpublishing-hands-on-graph-neural-networks-using-python

## What this repository actually is

This is the code repository for Hands-On Graph Neural Networks Using Python, published by Packt, and the primary language in the repository metadata is Jupyter Notebook. The subtitle is practical techniques and architectures for building powerful graph and deep learning apps with PyTorch.

The repository structure makes the shape obvious. There is a directory for each chapter, from `Chapter02/` through `Chapter17/`, plus a `requirements.txt` and a `LICENSE`. There is no `src/`, no `tests/`, no `setup.py` and no continuous integration configuration, because this is not a library. It is the code that accompanies a book.

The README says the code is organized into folders and gives the smallest possible example of what is inside them:

```
DG = nx.DiGraph()
DG.add_edges_from([('A', 'B'), ('A', 'C'), ('B', 'D'), ('B', 'E'), ('C', 'F'), ('C', 'G')])
```

A directed graph built with NetworkX and a list of edges. That is the level the notebooks operate at, and it explains the requirements list, which is heavy on graph libraries: networkx, node2vec, PyTorch Geometric and its compiled extensions, torch-geometric-temporal, deepchem, captum, gensim and scikit-learn.

The book itself is aimed at machine learning practitioners and data scientists interested in graph neural networks and their applications, and at students looking for a comprehensive reference on the field. The README says basic knowledge of machine learning and Python will help, and that familiarity with deep learning frameworks such as PyTorch is useful although not essential, because the book provides a comprehensive introduction to the mathematical concepts and their implementation.

The repository is MIT licensed, is not archived, has no GitHub releases, and the last push was on 2026-05-07.

## The requirements file is the most informative file in the repository

The `requirements.txt` pins the stack to a specific point in time, and that point is 2023.

```
--extra-index-url https://download.pytorch.org/whl/cu117
-f https://data.pyg.org/whl/torch-1.13.1+cu117.html
torch==1.13.1+cu117
torchvision==0.14.1+cu117
torchaudio==0.13.1+cu117
pandas
gensim==4.3.0
torch-scatter==2.1.0+pt113cu117
torch-sparse==0.6.16+pt113cu117
torch-cluster==1.6.0+pt113cu117
torch-spline-conv==1.2.1+pt113cu117
torch-geometric==2.2.0
networkx==2.8.8
matplotlib==3.6.3
node2vec==0.4.6
seaborn==0.12.2
scikit-learn==1.2.0
tensorflow~=2.4
deepchem==2.7.1
torch-geometric-temporal==0.54.0
captum==0.6.0
```

Two lines in there are doing the heavy lifting. The extra index URL points at the PyTorch wheel index for the cu117 build, which is CUDA 11.7, and the find-links line points at the PyTorch Geometric wheel index for the matching torch 1.13.1 and cu117 combination. The four compiled extensions, torch-scatter, torch-sparse, torch-cluster and torch-spline-conv, are versioned with the `pt113cu117` tag precisely so that they link against that exact torch build.

The reason for the care is that those extensions are not pure Python. They are compiled against a specific PyTorch ABI, and a wheel built for torch 1.13 will not load in torch 2.x, and a wheel built for cu117 will not load on a machine with a newer CUDA runtime. That is why the pins are not a casual choice, and it is why running these notebooks today on current hardware is a project in itself rather than a pip install.

The README's software and hardware list agrees: Python 3.8.15, PyTorch 1.13.1 and PyTorch Geometric 2.2.0, on Windows, Mac OS X and Linux.

So the honest summary is that this repository is a snapshot, and reproducing it exactly means recreating a 2023 CUDA environment.

## The chapters that need something different

The README is careful to flag the chapters that do not run on the base environment, and this is the part that saves a reader hours.

Chapter 11 requires TensorFlow 2.4, with the instruction to choose the installation method appropriate for the system and the TensorFlow version wanted. So one chapter of a PyTorch book pulls in a second deep learning framework, which is unusual and suggests the chapter covers a model that has a TensorFlow origin, most likely one of the chemistry models in the deepchem dependency.

Chapter 14 requires an older version of PyTorch Geometric, version 2.0.4, and it is recommended to create a specific virtual environment for that chapter. So here the library is pinned backwards rather than forwards, which means the base environment cannot satisfy it.

Chapters 15, 16 and 17 require a high GPU memory usage, and the README says you can lower it by decreasing the size of the training set in the code. That is the only mitigation offered, and it is an honest one, because shrinking the training set changes what the chapter demonstrates.

The pattern across all three is that the environment is per-chapter rather than global, and the README's advice throughout is to use a virtual environment, with venv or conda, and it strongly recommends one.

There is also the practical note about the other libraries. Other Python libraries are required in some or most chapters, installable with `pip install <name==version>` or another installer such as conda, and the README says the complete list of requirements is in the repository.

For a reader working through the book in order, the practical plan is one environment per chapter that needs a different stack, and a common environment for the rest.

## Running without the pinned stack, and the Colab route

Two escape routes from the pinned environment are documented, and one of them is much easier than the other.

The first is Google Colab. The README says you can directly import notebooks in Google Colab, and the Colab URL is given. In principle that removes the environment problem entirely, since the notebook runs on a managed runtime. The catch is that the notebooks were written against torch 1.13 and the cu117 wheels, and Colab ships current versions of everything, so the imports may need adjusting and the compiled extensions for torch-scatter and its siblings have to come from somewhere that matches the runtime's torch build.

The second route is the GPU option described in the README. If you want to use an NVIDIA GPU to accelerate training and inference, you need CUDA and cuDNN. CUDA is a parallel computing platform and API from NVIDIA, and the README links the NVIDIA download page for it. cuDNN is a library from NVIDIA providing highly optimised GPU implementations of primitives for deep learning algorithms, and the README says you need to create an account on the NVIDIA website to download it. There is a link to the list of CUDA-enabled GPU products as well.

The three things to install are therefore Python 3.8.15 from the official Python site, PyTorch 1.13.1 from the official PyTorch site with the installation method appropriate for the system, and PyTorch Geometric 2.2.0 from its documentation, with the note that PyTorch has to be installed first.

The README also notes that the software runs on Windows, Mac OS X and Linux, any of them. The book is not platform-locked, the environment is.

## What the book covers, and what the code demonstrates

The feature list of the book is also a description of what the notebooks exercise.

There is understanding of the fundamental concepts of graph neural networks. There is implementing them using Python and PyTorch Geometric. There is classifying nodes, graphs and edges using millions of samples. There is predicting and generating realistic graph topologies. There is combining heterogeneous sources to improve performance. There is forecasting future events using topological information. And there is applying graph neural networks to solve real-world problems.

The framing is that graph neural networks are a highly effective tool for analysing data that can be represented as a graph, such as social networks, chemical compounds or transportation networks, and that the past few years have seen an explosion in their use, with applications ranging from natural language processing and computer vision to recommendation systems and drug discovery.

The dependency list explains the shape of the examples. torch-geometric-temporal covers the forecasting and dynamic graph material, which is where the topological prediction chapters live. deepchem and gensim cover the chemistry and text embeddings. captum is there for interpretability, and node2vec and the graph tooling cover the embeddings that the node classification chapters use.

The repository also ships a PDF with colour images of the screenshots and diagrams used in the book, linked from the README, which is a small but real convenience, because a notebook that renders a diagram will render it differently from a printed figure and a reader needs to see what the book intended.

## Where this repository is the wrong thing to depend on

The first wrong case is treating it as a library. There is no package, no API to import and no versioning that you can depend on. The directories are named after chapters, and the code inside them is written to be read in the order the book presents them, with the assumption that the reader has the surrounding prose in front of them.

The second wrong case is a team that wants the book examples running on current hardware as part of a pipeline. The pins are the obstacle, and the obstacle is not arbitrary, since the compiled PyTorch Geometric extensions only exist as wheels for a specific torch and CUDA combination. Rebuilding them from source is possible, and it is a substantial job for four extensions, and then you are running modified code and your results are not the book's results.

The third wrong case is a reader who wants the mathematical content without the code. The repository is code, and the concepts are in the book.

The fourth is an organisation with a reproducibility policy that expects a test suite and continuous integration on any repository it depends on. There is no test suite here, no CI configuration in the tree, and no issue tracker workflow described for the notebooks. The errata section at the end of the README, which starts with a page 62 correction, shows the maintainers do fix errors, and that section is worth reading before you work through a chapter.

What the repository is good for is exactly what it says on the tin, which is a companion to a specific book with a reproducible environment for a specific stack. If that stack is what you have, it saves you from writing the examples yourself, and the per-chapter notes save you from the environment surprises that would otherwise cost an afternoon each.

## Conclusion

This repository suits a reader working through the book who wants the exact notebooks the text refers to, and who can install a Python 3.8 environment with the CUDA 11.7 wheels, or who is happy to port the code forward themselves. It does not suit a team looking for a maintained library, since there is no package here, no continuous integration and no test suite, and it does not suit anyone starting from a current PyTorch install without expecting to resolve the version conflicts by hand. Before running the chapters, read the per-chapter notes, because chapter 11 needs TensorFlow 2.4, chapter 14 needs PyTorch Geometric 2.0.4 rather than 2.2.0, and chapters 15 to 17 need a lot of GPU memory.

## FAQ

### What Python and PyTorch versions do the Hands-On Graph Neural Networks notebooks need?

The software list specifies Python 3.8.15, PyTorch 1.13.1 and PyTorch Geometric 2.2.0, and the requirements file pins the cu117 builds of torch, torchvision and torchaudio along with the matching torch-scatter, torch-sparse, torch-cluster and torch-spline-conv wheels.

### Which chapters need a different environment from the rest?

Chapter 11 requires TensorFlow 2.4, chapter 14 requires the older PyTorch Geometric 2.0.4 and is recommended to have its own virtual environment, and chapters 15, 16 and 17 need a lot of GPU memory, which can be reduced by lowering the training set size in the code.

### Can I run the notebooks in Google Colab?

The README says you can directly import notebooks in Google Colab, and gives the Colab URL. The pinned compiled extensions still have to match whatever torch version the runtime provides.

### What libraries does the book code use besides PyTorch?

The requirements list includes networkx, node2vec, torch-geometric-temporal, deepchem, gensim, captum, scikit-learn, pandas, matplotlib and seaborn, alongside the PyTorch Geometric extensions torch-scatter, torch-sparse, torch-cluster and torch-spline-conv.

### What is in the repository besides the chapter code?

The chapter directories from Chapter02 to Chapter17, a requirements.txt, the LICENSE, and a README that points to a downloadable PDF of the colour images of the book's screenshots and diagrams, plus an errata section listing corrections.

## Sources

- [Issues](https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python/issues)
- [License: MIT](https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python/blob/main/LICENSE)
- [PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python on GitHub](https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python)
- [README](https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/packtpublishing-hands-on-graph-neural-networks-using-python
