0

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)

dano
  • 91,354
  • 19
  • 222
  • 219
PHD
  • 3
  • 3

1 Answers1

1

I'm the dill author. Are you running in a directory that you have the dill source unzipped to? If so, you'll get this error. If you change to another directory, it should work if you've installed dill correctly (with pip 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).

Community
  • 1
  • 1
Mike McKerns
  • 33,715
  • 8
  • 119
  • 139
  • I have just tested removing the dill folder from my project's directory. The error persists. If it isn't much trouble could you tell me the right way to install your module from the beggining, I do have pip and I believe I installed it correctly trough pip. However if something went wrong I wouldn't really be able to tell since I am pretty new to python and pip. I am using windows 7 64-bit with python 3.4 – PHD Jun 08 '15 at 23:26
  • You should just be able to do `pip install dill`, but you'll probably get an older version than you want. I'm just about to release a new version for windows. Since, `dill` is pure python, you can always just go to github and get the latest source. If you like, please post your tracebacks from the install on the `dill` ticket page on github (see link above). – Mike McKerns Jun 08 '15 at 23:55
  • Alright, I have done both: installed with pip and when I try to install again it says that I have satysfied all the requirements and tells me about --upgrade. And getting the files from github was the first thing I had done, even before asking the question here. I am really lost, you also mentioned something about using 'setup.py install dill' where and how do I run this? I tried using cmd and my python console and both did nothing. cmd says that there is no file or directory named setup.py. – PHD Jun 09 '15 at 13:05
  • If you get the files from github, you would then unzip the source, and in the top level directory, run "python setup.py install"… that should install `dill` to your system python (as long as your PYTHONPATH is set so you can run python from the cmd prompt). See also: https://docs.python.org/2/install/ – Mike McKerns Jun 09 '15 at 15:26
  • Alright, will try appending the pythonpath for the sourcefile's setup dir. Unfortunatly I will only be able to do so in a couple of days (I dont have access to my workstation full-time), I will mark this question as solved. If after trying this change the error persists I will simply find an alternative on my own. Thank you very much for your time and help Mr. McKerns. – PHD Jun 09 '15 at 22:48