No module named 'dgl._ffi.object'


I’m using pickle to load the previously saved graph data to my working environment. But when I’m loading this data, I’m getting the following error.
No module named 'dgl._ffi.object'

#this is how I saved
pickle.dump(data, filehandle)

#this is how I try to load
value = pickle.load(filehandle)

Can someone help me to solve this issue?

pickle is bad on compatibility when upgrade version. When did you save them and what’s the version you used when saving?

I’m using pickle 4.0. I’m having several files and some files saved yesterday and some are today. Each file size is nearly 8 GB.


Sorry, what I want to ask is your dgl version. And do you have any folder named by dgl and how did you install the dgl?

I’m using dgl 0.3 version. I used the DGL documentation when installing it and followed the install from conda by creating conda create -n dgl python=3.7 environment.

Yes, I’m having a folder called DGL and don’t know another dgl folder is created or not when I’m creating the conda environment called dgl.

Sorry, my mistake. My local machine is having DGL 0.3. But I generated these pickle files in a remote machine. It is having 0.4.1. Now I’m tring to use those pickle files in my local machine which is having DGL 0.3. Is this a matter? Do I need to upgrade DGL to 0.4.1?

If you are using homo graph (created by dgl.DGLGraph), consider using

You need to unpickle the data where you pickled it, and using the API above to save it. And it should be able to be reloaded into another version by

Thank you VoVAllen. After upgrading my local machine to 0.4.1 it worked without any issues. However, using the way you suggested may be safer I guess. So, I’ll update my code to use save_graphs function when saving graph data. Thanks again.

Hi VoVAllen,

How can I append another set of graphs to the data.bin file which I have already created through save_graphs method?

Append is not currently supported. You need to load it into python and append it and save it again.

OK. Thanks. :slight_smile: