ipycache icon indicating copy to clipboard operation
ipycache copied to clipboard

cPickle import error

Open yoavram opened this issue 9 years ago • 15 comments

ImportError: No module named 'cPickle'

On Python 3.5

yoavram avatar Dec 06 '16 11:12 yoavram

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

rossant avatar Dec 06 '16 14:12 rossant

So you imagine something like:

try:
  import cPickle
except ImportError:
  import pickle as cPickle

yoavram avatar Dec 07 '16 05:12 yoavram

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

rossant avatar Dec 07 '16 10:12 rossant

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'
>>>

yoavram avatar Dec 07 '16 13:12 yoavram

Could you try with the development version?

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

rossant avatar Dec 07 '16 14:12 rossant

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'>

yoavram avatar Dec 07 '16 20:12 yoavram

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.

matanox avatar Nov 08 '18 13:11 matanox

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

diallobakary4 avatar Apr 18 '19 10:04 diallobakary4

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

oborisov avatar Jan 02 '20 09:01 oborisov

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?

chris-rands avatar Feb 04 '20 11:02 chris-rands

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

rossant avatar Feb 04 '20 11:02 rossant

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

chris-rands avatar Feb 04 '20 12:02 chris-rands

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!

rossant avatar Feb 04 '20 12:02 rossant

@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.

eldad-a avatar May 04 '20 08:05 eldad-a

@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.

mbrukman avatar Jan 15 '22 21:01 mbrukman