rossant / ipycache

Defines a %%cache cell magic in the IPython notebook to cache results of long-lasting computations in a persistent pickle file
BSD 3-Clause "New" or "Revised" License
138 stars 35 forks source link

cPickle import error #46

Open yoavram opened 7 years ago

yoavram commented 7 years ago

ImportError: No module named 'cPickle'

On Python 3.5

rossant commented 7 years ago

Thanks, should be easy to fix with try/except import pickle, PR welcome!

yoavram commented 7 years ago

So you imagine something like:

try:
  import cPickle
except ImportError:
  import pickle as cPickle
rossant commented 7 years ago

Actually, looking at the code it seems like this fix is already implemented... Are you using the latest version?

yoavram commented 7 years ago

I did an pip install ipycache:

(X)  ~  pip install ipycache
Collecting ipycache
Installing collected packages: ipycache
Successfully installed ipycache-0.1.4
(X)  ~  python
Python 3.5.2 | packaged by conda-forge | (default, Jul 26 2016, 01:37:38)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipycache
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xxx/miniconda3/envs/X/lib/python3.5/site-packages/ipycache.py", line 11, in <module>
    import inspect, os, sys, textwrap, cPickle
ImportError: No module named 'cPickle'
>>>
rossant commented 7 years ago

Could you try with the development version?

pip install git+https://github.com/rossant/ipycache --upgrade

yoavram commented 7 years ago

Works:

(X)  ~  python
Python 3.5.2 | packaged by conda-forge | (default, Jul 26 2016, 01:37:38)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipycache
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xxx/miniconda3/envs/X/lib/python3.5/site-packages/ipycache.py", line 11, in <module>
    import inspect, os, sys, textwrap, cPickle
ImportError: No module named 'cPickle'
>>>
(X)  ~  pip install git+https://github.com/rossant/ipycache --upgrade
Collecting git+https://github.com/rossant/ipycache
  Cloning https://github.com/rossant/ipycache to /private/var/folders/rm/dnbfymg93tb4lbb2h8x83ld40000gp/T/pip-f5uwttqj-build
Installing collected packages: ipycache
  Found existing installation: ipycache 0.1.4
    Uninstalling ipycache-0.1.4:
      Successfully uninstalled ipycache-0.1.4
  Running setup.py install for ipycache ... done
Successfully installed ipycache-0.1.5.dev0
(X)  ~  python
Python 3.5.2 | packaged by conda-forge | (default, Jul 26 2016, 01:37:38)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipycache
/Users/xxx/miniconda3/envs/X/lib/python3.5/site-packages/IPython/config.py:13: ShimWarning: The `IPython.config` package has been deprecated. You should import from traitlets.config instead.
  "You should import from traitlets.config instead.", ShimWarning)
/Users/xxx/miniconda3/envs/X/lib/python3.5/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
  warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
>>> ipycache
<module 'ipycache' from '/Users/xxx/miniconda3/envs/X/lib/python3.5/site-packages/ipycache.py'>
matanox commented 6 years ago

using the dev version (the second install option) i get a versioning oriented warning:

lib/python3.6/site-packages/IPython/config.py:13: ShimWarning:

The `IPython.config` package has been deprecated since IPython 4.0. You should import from traitlets.config instead.

lib/python3.6/site-packages/ipycache.py:17: UserWarning:

IPython.utils.traitlets has moved to a top-level traitlets package.
diallobakary4 commented 5 years ago

The dev version is also giving me a warning:

/home/bdiallo/.conda/envs/bakbio/lib/python3.6/site-packages/IPython/config.py:13:

ShimWarning: The IPython.config package has been deprecated since IPython 4.0. You should import from traitlets.config instead. "You should import from traitlets.config instead.", ShimWarning) /home/bdiallo/.conda/envs/bakbio/lib/python3.6/site-packages/ipycache.py:17: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package. from IPython.utils.traitlets import `Unicode

oborisov commented 4 years ago

Having the same "ImportError: No module named 'cPickle'" after both "conda install -c conda-forge ipycache" and "pip install ipycache". "pip install git+https://github.com/rossant/ipycache --upgrade" working seamlessly, thanks

chris-rands commented 4 years ago

This is a simple python 3 vs. python 2 issue, is has been fixed in this repo, would someone (@rossant ?) be able to tag a new release here on github and update on pypi?

rossant commented 4 years ago

I'm no longer maintaining this repository but could give github/pypi permissions to anyone who would volunteer to maintain it

chris-rands commented 4 years ago

@rossant Thanks for the response, are you not maintaining it because better tools are available or because you are too busy?

rossant commented 4 years ago

Too busy and I no longer use it, and I wouldn't be surprised if there were better tools, but I can't really tell!

eldad-a commented 4 years ago

@diallobakary4 wrote:

The dev version is also giving me a warning:

/home/bdiallo/.conda/envs/bakbio/lib/python3.6/site-packages/IPython/config.py:13: ShimWarning: The IPython.config package has been deprecated since IPython 4.0. You should import from traitlets.config instead. "You should import from traitlets.config instead.", ShimWarning) /home/bdiallo/.conda/envs/bakbio/lib/python3.6/site-packages/ipycache.py:17: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package. from IPython.utils.traitlets import `Unicode

In case this is still of help, please see 48#issuecomment-623323002 for a way to circumvent these warnings.

mbrukman commented 2 years ago

@rossant — can you give me PyPI permissions, please? I'd like to make another ipycache release to fix this issue.

My PyPI username is the same as my GitHub username.