huawei-noah / trustworthyAI

Trustworthy AI related projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Networkx 3.0 incompatibility

JuergenKanz opened this issue · comments

Unfortunately, your package is incompatible with the latest version of networkx = 3.0.
You get an attribute error "module 'networkx' has no attribute 'to_numpy_matrix'" in case you use the latest version. The reason is that 'to_numpy_matrix' is replaced with 'to_numpy_array' in networkx 3.0
In my environment, I have replaced in Line 64 and Line 563, 'to_numpy_matrix' with 'to_numpy_array' in file E:\anaconda3\Lib\site-packages\castle\datasets\simulator.py
I suggest adapting the simulator.py file for the next release.

Hello, thanks for your bug report! We will take a look at it and try to get a fix to the next version.

pip install networkx==2.5
It solves this problem.

This should now be solved for newer versions of networkx, see #106.

I still face this issue for networkx version > 3.0.

File "/usr/local/lib/python3.10/dist-packages/castle/datasets/simulator.py", line 168, in erdos_renyi
B_und = DAG._graph_to_adjmat(G_und)
File "/usr/local/lib/python3.10/dist-packages/castle/datasets/simulator.py", line 64, in _graph_to_adjmat
return nx.to_numpy_matrix(G)
AttributeError: module 'networkx' has no attribute 'to_numpy_matrix

Hi @divyat09 ,

Apologies, the version installed from PyPI (using the pip command) still hasn't been updated. We will try to make a new release for this in the near future. For now, you can manually clone this repo and install using pip install -e .` in the gcastle folder to make it work.