I am currently working on a big game project in python and the need for storing my classes has just appeared. I looked into the net and tried out pickle and cpickle but given the structure of my classes they weren't good enough. so I am currently trying to use dill. I have used pip to install it but somehow I can't use it...
here is the code where I try to use dill:
import dill
with open('dill_test.pkl', 'wb') as f:
dump(CDB[0][3], f)
CDB is a matrix of classes that have similar atributes if it is required I can post the generic structure of each item in CDB
Here is the error I get:
ImportError: First run 'python setup.py build' to build dill.
I know that this might be a really basic question but I really couldn't find anything about it... and this is the first module I installed that ever gave me trouble I am currently using: pillow,pyglet and PPlay(came from pygame)
I'm the
dill
author. Are you running in a directory that you have thedill
source unzipped to? If so, you'll get this error. If you change to another directory, it should work if you've installeddill
correctly (withpip
or otherwise).It should work with
pip
, see this closed ticket: https://github.com/uqfoundation/dill/issues/15.Also see this link: https://stackoverflow.com/a/23586628/4646678 and this link: http://nbviewer.ipython.org/github/adrn/ipython/blob/master/examples/Parallel%20Computing/Using%20Dill.ipynb for installs with
pip
.You can always use
setuptools
or install directly from github, which is what I recommend. Download and run:setup.py install dill
(then change directory to anything other than the install directory).