Importing python packages using PyCall throws up an error

I’m trying to call some functions in the NetworkX package in my program using PyCall. However I get this error when I try doing this:

using PyCall
nx = pyimport("networkx")
PyObject <module 'networkx' from '/home/minerva/.local/lib/python2.7/site-packages/networkx/__init__.pyc'>
g = nx.parse_gml("$(path)/Bics.gml")
ERROR: type PyObject has no field parse_gml

The same happens when I try using the math package as well. Any idea on why this is happening?

Works fine for me:

julia> math = pyimport("math")
PyObject <module 'math' from '/............/.julia/conda/3/lib/python3.7/lib-dynload/'>

julia> math.sin(3)

Can you give an example that fails with the math package?

Here is the example I tried. I think there must be some issue regarding the versions of Python

using PyCall
math = pyimport("math")
PyObject <module 'math' from '/home/minerva/.julia/v0.6/Conda/deps/usr/lib/python3.8/lib-dynload/'>
ERROR: type PyObject has no field sin

You are using an ancient version of Julia. Have you tried Julia 1.6?


It works with the newer version. Thanks for pointing this out

I’m just curious. Where did you get Julia v0.6 from?

Had it and have been using it since a few years :sweat_smile:

1 Like