graspologic-org / graspologic

Python package for graph statistics
https://graspologic-org.github.io/graspologic/
MIT License
650 stars 134 forks source link

Impossible to use, get error message AttributeError: module 'numpy' has no attribute 'object' [BUG] #1005

Closed yannis1962 closed 1 year ago

yannis1962 commented 1 year ago

Expected Behavior

I would like to run a simple script:

import graspologic import networkx as nx

G=read_graphml("test.graphml") (Gx,positions)=graspologic.layouts.layout_tsne(G) colors=graspologic.layouts.categorical_colors(partitions) graspologic.layouts.save_graph("test.png", G, positions, colors)

Actual Behavior

I get the following error message:

python3 test-graspologic.py /Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py:513: FutureWarning: In the future np.object will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions. np.object, Traceback (most recent call last): File "test-graspologic.py", line 1, in import graspologic File "/Users/yannis/miniconda3/lib/python3.8/site-packages/graspologic/init.py", line 4, in import graspologic.align File "/Users/yannis/miniconda3/lib/python3.8/site-packages/graspologic/align/init.py", line 5, in from .seedless_procrustes import SeedlessProcrustes File "/Users/yannis/miniconda3/lib/python3.8/site-packages/graspologic/align/seedless_procrustes.py", line 7, in import ot File "/Users/yannis/miniconda3/lib/python3.8/site-packages/ot/init.py", line 22, in from . import lp File "/Users/yannis/miniconda3/lib/python3.8/site-packages/ot/lp/init.py", line 22, in from .emd_wrap import emd_c, check_result, emd_1d_sorted File "ot/lp/emd_wrap.pyx", line 13, in init ot.lp.emd_wrap File "/Users/yannis/miniconda3/lib/python3.8/site-packages/ot/utils.py", line 18, in from .backend import get_backend, Backend File "/Users/yannis/miniconda3/lib/python3.8/site-packages/ot/backend.py", line 123, in import tensorflow as tf File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/init.py", line 41, in from tensorflow.python.tools import module_util as _module_util File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/init.py", line 45, in from tensorflow.python import data File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/init.py", line 25, in from tensorflow.python.data import experimental File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/init.py", line 96, in from tensorflow.python.data.experimental import service File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/service/init.py", line 21, in from tensorflow.python.data.experimental.ops.data_service_ops import distribute File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 25, in from tensorflow.python.data.experimental.ops import compression_ops File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 20, in from tensorflow.python.data.util import structure File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/util/structure.py", line 26, in from tensorflow.python.data.util import nest File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/data/util/nest.py", line 41, in from tensorflow.python.framework import sparse_tensor as _sparse_tensor File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/framework/sparse_tensor.py", line 29, in from tensorflow.python.framework import constant_op File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 29, in from tensorflow.python.eager import execute File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 27, in from tensorflow.python.framework import dtypes File "/Users/yannis/.local/lib/python3.8/site-packages/tensorflow/python/framework/dtypes.py", line 513, in np.object, File "/Users/yannis/miniconda3/lib/python3.8/site-packages/numpy/init.py", line 284, in getattr raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'object'

Example Code

import graspologic import networkx as nx

G=read_graphml(test.graphml") (Gx,positions)=graspologic.layouts.layout_tsne(G) colors=graspologic.layouts.categorical_colors(partitions) graspologic.layouts.save_graph("test.png", G, positions, colors)

Full Traceback

Paste the full traceback in case there is an exception

Your Environment

Additional Details

Any other contextual information you might feel is important.

bdpedigo commented 1 year ago

can you post the output of pip list for your environment?

yannis1962 commented 1 year ago

Here you are:

Package Version


absl-py 0.10.0
adjustText 0.7.3
aio-pika 6.7.1
aiofiles 0.6.0
aiohttp 3.6.3
aiormq 3.3.1
anyio 2.2.0
anytree 2.8.0
appdirs 1.4.4
appnope 0.1.0
APScheduler 3.6.3
argon2-cffi 20.1.0
arrow 0.16.0
asgiref 3.2.10
astroid 2.4.2
astunparse 1.6.3
async-generator 1.10
async-timeout 3.0.1
attrs 20.2.0
autograd 1.5
Babel 2.9.0
backcall 0.2.0
bcrypt 3.2.0
beartype 0.11.0
beautifulsoup4 4.10.0
benepar 0.2.0
binaryornot 0.4.4
bitsets 0.8.4
black 19.10b0
bleach 3.3.0
blis 0.4.1
boto3 1.17.4
botocore 1.20.4
bs4 0.0.1
cachetools 4.2.1
camel-kenlm 2020.11.2
camel-tools 1.1.0
catalogue 1.0.0
certifi 2020.6.20
cffi 1.14.0
cfgv 3.2.0
chardet 3.0.4
click 8.1.3
click-plugins 1.1.1
cligj 0.7.1
cloudpickle 1.4.1
colorclass 2.2.0
coloredlogs 14.3
colorhash 1.0.3
community 1.0.0b1
conda 4.8.4
conda-package-handling 1.7.0+0.g7c4a471.dirty contourpy 1.0.6
cookiecutter 1.7.2
coverage 5.1
cryptography 3.4.3
cycler 0.10.0
cymem 2.0.5
Cython 0.29.22
decorator 4.4.2
defusedxml 0.6.0
descartes 1.1.0
dill 0.3.4
distlib 0.3.1
Django 3.0.9
django-allauth 0.42.0
django-autoslug 1.9.8
django-coverage-plugin 1.8.0
django-crispy-forms 1.9.2
django-debug-toolbar 2.2
django-environ 0.4.5
django-extensions 2.2.9
django-model-utils 4.0.0
django-stubs 1.5.0
django-test-plus 1.4.0
dm-tree 0.1.5
dnspython 1.16.0
docopt 0.6.2
editdistance 0.5.3
entrypoints 0.3
factory-boy 2.12.0
FAdo 1.3.5.1
Faker 4.1.2
fbmessenger 6.0.0
fcapy 0.1.4
filelock 3.0.12
Fiona 1.8.18
flake8 3.8.2
Flask 2.2.2
fonttools 4.36.1.dev0
frozendict 2.3.4
fst-pso 1.8.1
future 0.18.2
FuzzyTM 2.0.5
gast 0.3.3
gensim 4.3.0
geopandas 0.8.1
google-auth 1.25.0
google-auth-oauthlib 0.4.2
google-pasta 0.2.0
grandalf 0.7
graph-tools 1.5
graphviz 0.16
graspologic 2.0.1
graspologic-native 1.1.1
grpcio 1.35.0
h11 0.9.0
h5py 2.10.0
http-client 0.1.22
httpcore 0.11.1
httplib2 0.19.0
httptools 0.1.1
httpx 0.15.4
humanfriendly 9.1
hyppo 0.3.2
identify 1.5.0
idna 2.9
importlib-metadata 5.2.0
intervaltree 3.1.0
ipdb 0.13.2
ipykernel 5.5.0
ipython 7.18.1
ipython-genutils 0.2.0
isodate 0.6.0
isort 5.5.1
itsdangerous 2.1.2
jedi 0.17.2
jieba 0.42.1
Jinja2 3.1.2
jinja2-time 0.2.0
jmespath 0.10.0
joblib 1.2.0
json5 0.9.5
jsonpickle 1.4.2
jsonschema 3.2.0
jupyter-client 6.1.11
jupyter-core 4.7.1
jupyter-packaging 0.7.12
jupyter-server 1.4.1
jupyterlab 3.0.9
jupyterlab-pygments 0.1.2
jupyterlab-server 2.3.0
kafka-python 2.0.2
Keras 2.4.3
Keras-Preprocessing 1.1.2
kiwisolver 1.2.0
lazy-object-proxy 1.4.3
llvmlite 0.39.1
Markdown 3.3.3
MarkupSafe 2.1.1
matplotlib 3.6.2
mattermostwrapper 2.2
mccabe 0.6.1
miniful 0.0.6
mistune 0.8.4
more-itertools 8.5.0
multidict 4.7.6
munch 2.5.0
murmurhash 1.0.5
mypy 0.770
mypy-extensions 0.4.3
nbclassic 0.2.6
nbclient 0.5.3
nbconvert 6.0.7
nbformat 5.1.2
nest-asyncio 1.5.1
netgraph 4.11.7
networkx 2.5
nltk 3.6.2
nodeenv 1.5.0
notebook 6.2.0
numba 0.56.4
numpy 1.24.0
oauth2client 4.1.3
oauthlib 3.1.0
opt-einsum 3.3.0
Owlready2 0.29
packaging 20.4
pamqp 2.3.0
pandas 1.5.2
pandocfilters 1.4.3
paramiko 2.7.2
parso 0.7.1
pathspec 0.8.0
perlcompat 1.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 7.2.0
pip 20.0.2
plac 1.1.3
pluggy 0.13.1
POT 0.8.2
poyo 0.5.0
pre-commit 2.4.0
preshed 3.0.5
prince 0.7.1
prometheus-client 0.9.0
prompt-toolkit 2.0.10
protobuf 3.14.0
psycopg2-binary 2.8.5
ptyprocess 0.6.0
py 1.9.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycodestyle 2.6.0
pycosat 0.6.3
pycparser 2.20
pycurl 7.43.0.6
pydot 1.4.1
pyflakes 2.2.0
pyFUME 0.2.25
Pygments 2.6.1
PyJWT 2.0.1
pykerberos 1.2.1
pykwalify 1.7.0
pylint 2.6.0
pylint-django 2.0.15
pylint-plugin-utils 0.6
pymongo 3.10.1
PyNaCl 1.4.0
pynndescent 0.5.8
pyOpenSSL 19.1.0
pyparsing 2.4.7
pyproj 3.0.0.post1
pyrsistent 0.17.3
pysftp 0.2.9
PySimpleAutomata 0.5.0
PySocks 1.7.1
pyTelegramBotAPI 3.7.6
Pytess 1.0.0
pytest 5.4.2
pytest-django 3.9.0
pytest-sugar 0.9.3
python-crfsuite 0.9.7
python-dateutil 2.8.1
python-engineio 3.13.2
python-igraph 0.9.1
python-louvain 0.16
python-slugify 4.0.1
python-snappy 0.5.4
python-socketio 4.6.1
python3-openid 3.2.0
pytz 2020.1
PyYAML 5.3.1
pyzmq 22.0.3
questionary 1.5.2
rasa 2.2.10
rasa-sdk 2.2.0
rdflib 5.0.0
rectangle-packer 2.0.1
redis 3.5.3
regex 2020.7.14
requests 2.23.0
requests-oauthlib 1.3.0
requests-toolbelt 0.9.1
rfc3986 1.4.0
rocketchat-API 1.9.1
roman 3.3
rsa 4.7
ruamel-yaml 0.15.87
ruamel.yaml 0.16.12
ruamel.yaml.clib 0.2.2
s3transfer 0.3.4
sacremoses 0.0.43
sanic 20.12.1
Sanic-Cors 0.10.0.post3
sanic-jwt 1.6.0
Sanic-Plugins-Framework 0.9.5
scikit-learn 1.2.0
scipy 1.9.3
seaborn 0.12.1
Send2Trash 1.5.0
sentencepiece 0.1.95
sentry-sdk 0.19.5
setuptools 46.4.0.post20200518
Shapely 1.7.1
simpful 2.9.0
six 1.14.0
sklearn-crfsuite 0.3.6
slackclient 2.9.3
smart-open 4.2.0
sniffio 1.2.0
sortedcontainers 2.3.0
soupsieve 2.2.1
spacy 2.2.4
SQLAlchemy 1.3.23
sqlparse 0.3.1
srsly 1.0.5
stanza 1.2
tabulate 0.8.7
tensorboard 2.4.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.3.2
tensorflow-addons 0.12.0
tensorflow-estimator 2.3.0
tensorflow-hub 0.9.0
tensorflow-probability 0.11.1
tensorflow-text 2.3.0
termcolor 1.1.0
terminado 0.9.2
terminaltables 3.1.0
testpath 0.4.4
text-unidecode 1.3
texttable 1.6.3
thinc 7.4.0
threadpoolctl 2.1.0
tokenizers 0.8.1rc1
toml 0.10.1
torch 1.8.0
torch-struct 0.5
tornado 6.1
tqdm 4.46.0
traitlets 5.0.3
transformers 3.0.2
twilio 6.45.4
typed-ast 1.4.1
typeguard 2.10.0
typing-extensions 4.4.0
tzlocal 2.1
ujson 3.2.0
umap-learn 0.5.3
Unidecode 1.1.1
UNKNOWN 0.0.0
urllib3 1.25.8
uvloop 0.14.0
virtualenv 20.0.31
wasabi 0.8.2
wcwidth 0.2.5
webencodings 0.5.1
webexteamssdk 1.6
websockets 8.1
Werkzeug 2.2.2
wheel 0.34.2
whichcraft 0.6.1
whitenoise 5.2.0
wrapt 1.12.1
yarl 1.5.1
zipp 3.11.0

Le 31 déc. 2022 à 02:32, Benjamin Pedigo @.***> a écrit :

can you post the output of pip list for your environment?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/graspologic/issues/1005#issuecomment-1368142028, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFXC7MV7TQVLJ5IFJ7W5GDWP6EKHANCNFSM6AAAAAATIBUPNU. You are receiving this because you authored the thread.

http://www.imt-atlantique.fr/ Yannis HARALAMBOUS Professor Computer Science Department UMR CNRS 6285 Lab-STICC https://www.imt-atlantique.fr/en/person/yannis-haralambous https://twitter.com/y_haralambous https://www.linkedin.com/in/yannis-haralambous-5529073?trk=hp-identity-nameTechnopôle Brest-Iroise CS 83818 29238 Brest Cedex 3, France Une École de l'IMT http://www.imt.fr/

‌Ceux qui négligent de relire s'obligent à lire partout la même histoire. ‌(Roland Barthes, ‌S/Z)‌

bdpedigo commented 1 year ago

I've not seen this issue before and it seems to be related to the interaction between numpy and tensorflow. Note that tensorflow is not required by graspologic (it is an optional dependency of POT, I believe, which is where the error is coming from), so you should be able to try removing tensorflow from your environment and see if that works. Another thing I notice is that numpy 1.24 is very recent (released a few weeks ago), so perhaps this is an issue with the new versions of numpy and tensorflow not being compatibile. You could therefore also try downgrading numpy to an older version.

Please let us know if either of the above do or don't work, if there are incompatibilities in these packages we'd like to know it so that other users dont run into the same issues. Thanks

bdpedigo commented 1 year ago

closing due to lack of info