-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with importing multinet from py3plex.core #25
Comments
Hi! Either downgrade your numpy, or, if possible, open a PR with the
suggested change so this is fixed also for others. Thanks!
…On Fri, 29 Mar 2024, 05:44 nico-dangelo, ***@***.***> wrote:
When importing the multinet module from py3plex.core as in the example, an
error with numpy's int attribute occurs:
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from py3plex.core import multinet
2 from py3plex.core import random_generators
3 # import numpy as np
4 # import queue
5 # import matplotlib.pyplot as plt
(...)
8 # ## some random graph
9 # ER_multilayer =
random_generators.random_multilayer_ER(3000,10,0.05,directed=False)
File
~\AppData\Local\Programs\Python\Python39\lib\site-packages\py3plex\core\multinet.py:3
1 # This is the main data structure container
----> 3 import networkx as nx
4 import itertools
5 from . import parsers
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx_
*init*_.py:115
112 import networkx.generators
113 from networkx.generators import *
--> 115 import networkx.readwrite
116 from networkx.readwrite import *
118 # Need to test with SciPy, when available
File
~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite_
*init*_.py:15
13 from networkx.readwrite.nx_yaml import *
14 from networkx.readwrite.gml import *
---> 15 from networkx.readwrite.graphml import *
16 from networkx.readwrite.gexf import *
17 from networkx.readwrite.nx_shp import *
File
~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite\graphml.py:314
310 raise nx.NetworkXError('file not successfully read as graphml')
311 return glist[0]
--> 314 class GraphML(object):
315 NS_GRAPHML = "http://graphml.graphdrawing.org/xmlns"
316 NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
File
~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite\graphml.py:346,
in GraphML()
341 pass
342 else:
343 # prepend so that python types are created upon read (last entry wins)
344 types = [(np.float64, "float"), (np.float32, "float"),
345 (np.float16, "float"), (np.float_, "float"),
--> 346 (np.int, "int"), (np.int8, "int"),
347 (np.int16, "int"), (np.int32, "int"),
348 (np.int64, "int"), (np.uint8, "int"),
349 (np.uint16, "int"), (np.uint32, "int"),
350 (np.uint64, "int"), (np.int_, "int"),
351 (np.intc, "int"), (np.intp, "int"),
352 ] + types
354 xml_type = dict(types)
355 python_type = dict(reversed(a) for a in types)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy_
*init*_.py:313, in *getattr*(attr)
308 warnings.warn(
309 f"In the future np.{attr} will be defined as the "
310 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
312 if attr in *former_attrs*:
--> 313 raise AttributeError(*former_attrs*[attr])
315 if attr == 'testing':
316 import numpy.testing as testing
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in
existing code, use int by itself. Doing this will not modify any behavior
and is safe. When replacing np.int, you may wish to use e.g. np.int64 or
np.int32 to specify the precision. If you wish to review your current
use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and
guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
—
Reply to this email directly, view it on GitHub
<#25>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACMSERDTFCMHL2T55BVQGHTY2TWTLAVCNFSM6AAAAABFN5CZSOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTINRUGE2DCMI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When importing the multinet module from py3plex.core as in the example, an error with numpy's int attribute occurs:
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from py3plex.core import multinet
2 from py3plex.core import random_generators
3 # import numpy as np
4 # import queue
5 # import matplotlib.pyplot as plt
(...)
8 # ## some random graph
9 # ER_multilayer = random_generators.random_multilayer_ER(3000,10,0.05,directed=False)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\py3plex\core\multinet.py:3
1 # This is the main data structure container
----> 3 import networkx as nx
4 import itertools
5 from . import parsers
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx_init_.py:115
112 import networkx.generators
113 from networkx.generators import *
--> 115 import networkx.readwrite
116 from networkx.readwrite import *
118 # Need to test with SciPy, when available
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite_init_.py:15
13 from networkx.readwrite.nx_yaml import *
14 from networkx.readwrite.gml import *
---> 15 from networkx.readwrite.graphml import *
16 from networkx.readwrite.gexf import *
17 from networkx.readwrite.nx_shp import *
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite\graphml.py:314
310 raise nx.NetworkXError('file not successfully read as graphml')
311 return glist[0]
--> 314 class GraphML(object):
315 NS_GRAPHML = "http://graphml.graphdrawing.org/xmlns"
316 NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\networkx\readwrite\graphml.py:346, in GraphML()
341 pass
342 else:
343 # prepend so that python types are created upon read (last entry wins)
344 types = [(np.float64, "float"), (np.float32, "float"),
345 (np.float16, "float"), (np.float_, "float"),
--> 346 (np.int, "int"), (np.int8, "int"),
347 (np.int16, "int"), (np.int32, "int"),
348 (np.int64, "int"), (np.uint8, "int"),
349 (np.uint16, "int"), (np.uint32, "int"),
350 (np.uint64, "int"), (np.int_, "int"),
351 (np.intc, "int"), (np.intp, "int"),
352 ] + types
354 xml_type = dict(types)
355 python_type = dict(reversed(a) for a in types)
File ~\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy_init_.py:313, in getattr(attr)
308 warnings.warn(
309 f"In the future
np.{attr}
will be defined as the "310 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
312 if attr in former_attrs:
--> 313 raise AttributeError(former_attrs[attr])
315 if attr == 'testing':
316 import numpy.testing as testing
AttributeError: module 'numpy' has no attribute 'int'.
np.int
was a deprecated alias for the builtinint
. To avoid this error in existing code, useint
by itself. Doing this will not modify any behavior and is safe. When replacingnp.int
, you may wish to use e.g.np.int64
ornp.int32
to specify the precision. If you wish to review your current use, check the release note link for additional information.The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
The text was updated successfully, but these errors were encountered: