For installing networkx you need only one command as from what I can read from the github details "pip install networkx" https://github.com/NetworkX/NetworkX
This is the list of recommened packets you should install for networkx to work 100%:
NumPy (>= 1.15.0) provides matrix representation of graphs and is used in some graph algorithms for high-performance matrix computations.
SciPy (>= 1.1.0) provides sparse matrix representation of graphs and many numerical scientific tools.
pandas (>= 0.23.3) provides a DataFrame, which is a tabular data structure with labeled axes.
Matplotlib (>= 2.2.2) provides flexible drawing of graphs.
PyGraphviz (>= 1.5) and pydot (>= 1.2.4) provide graph drawing and graph layout algorithms via GraphViz.
PyYAML provides YAML format reading and writing.
gdal provides shapefile format reading and writing.
lxml used for GraphML XML format.
Here is the entire documented details about installation of networkx
Since you only said on Linux (and many linux distro's exits) here is general install info. in case you need to install additional packets for ubuntu debain based linux use apt install "name_of_package", for Redhat/CentOS/Fedora yum install "name_of_package" or dnf install "name_of_package". or arch based distro's use the AUR (arch user repository) or pacman install "name_of_package".