Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

819
Vistas
networkx shows random_state_index is incorrect

I am trying to draw simple graph with networkx and Python.

This is my code:

import networkx as nx
import matplotlib.pyplot as plt
G = nx.complete_graph(5)
nx.draw(G, with_labels=True, font_weight='bold')
plt.show()

but I am getting the error

Message=random_state_index is incorrect
Source=***\PythonTest.py
StackTrace:
File "***\PythonTest.py", line 15, in <module>
  nx.draw(G, with_labels=True)

Python 3.7 64bit

OS Windows

networkx 2.2 ,2.3 or 2.5 have the same problem.

over 4 years ago · Hanz Gallego
5 Respuestas
Responde la pregunta

0

It looks like the issue MAY be due to a new release of the decorator module. See here: https://github.com/networkx/networkx/issues/4718

Can you downgrade your version of decorator?

over 4 years ago · Hanz Gallego Denunciar

0

The problem is resolved if you update the latest decorator 5.0.9 version (June 2021)

pip install decorator==5.0.9 then reboot

over 4 years ago · Hanz Gallego Denunciar

0

I just created a new python 3.6 environment within Anaconda Prompt, and made sure my Jupyter Notebook could connect to that new environment.

Run your code in this new environment within Jupyter, and it should work. Doing this downgrades your versions of networkx and decorator, which solves the problem.

over 4 years ago · Hanz Gallego Denunciar

0

Open anaconda prompt and type

conda update --all

.. and Enter, it installs stable packages which are most compatible.

over 4 years ago · Hanz Gallego Denunciar

0

Just update the decorater and networkx versions:

pip install --user decorator==4.3.0 # (ignore waring for availability of newer version)

pip install --user networkx==2.3

This worked for me.

over 4 years ago · Hanz Gallego Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda