Open benjaminp opened 8 years ago
Original comment by Andrew Arrasmith (Bitbucket: aarrasmi, GitHub: aarrasmi):
Hi Matthias,
I tried it with both the latest release of Theano and the "bleeding edge" version on the git repo. By up to date I mean the version that I get with pip with the upgrade flag. My copy of Theano (I reverted to the latest release) has version 1.9.0 of six installed with it, and and my machine has six 1.10.0 installed.
I think that in just now confirming I had the latest versions (which I did last night as well) I may have found the problem. It seems that for some reason my pip upgrade calls last night didn't remove a copy of 1.5.2 (and I must have missed it in the output of the find command you recommend above) while just now redoing
#!BASH
sudo pip install -U six
found and removed the old version.
I must have been doing something stupid last night and somehow missing this.
Sorry to bother you over what was probably just an old version that was hiding from me, and thank you for your response.
Andrew
Original comment by Matthias Liebig (Bitbucket: mliebig, GitHub: Unknown):
Hello Andrew,
which version of six do you use ("up to date" with what)? And when you are patching Theano, you might want to try the following:
#!python
import six
print(six.__file__)
in order to find out which module is actually used.
Note: The Theano's git repo contains a copy of six, which is new enough to support "import six.moves.cPickle".
Original comment by Andrew Arrasmith (Bitbucket: aarrasmi, GitHub: aarrasmi):
Hi,
I have had what seems to be the same issue. After a little experimentation I have found that while
#!python
import six.moves.cPickle
doesn't work
#!python
from six.moves import cPickle
does. I am fairly confused by this, but I got Theano working by replacing the instances of
#!python
import six.moves.(name)
with
#!python
from six.moves import (name)
This behaviour seems odd to me, but I thought it might be relevant to the discussion here (which I found while trying to solve my issue) so I am contributing it.
If it is relevant, I am running Linux Mint 17.1 and have made sure that Theano and six are fully up to date and removed all old copies.
Original comment by Matthias Liebig (Bitbucket: mliebig, GitHub: Unknown):
In issue #134 the following issue with pip is mentioned: https://github.com/pypa/pip/issues/3165 The dev there wrote, that "OS X El Capitan ships with six 1.4.1".
Maybe this is also the cause for your problem with Theano? The old version of six might be in your sys.path ahead of the one installed with pip. So you might want to try
#!bash
find / -type f -name 'six.py*'
after all in order to verify this.
Original comment by Yiqun Liu (Bitbucket: yiqun_liu, GitHub: Unknown):
@mliebig Unfortunately, the first line doesn't work. But
#!Terminal
import cPickle
works well. I assume that cPickle is placed incorrectly.
Original comment by Matthias Liebig (Bitbucket: mliebig, GitHub: Unknown):
Could you please try invoking the failing import manually:
#!python
import six.moves.cPickle
If it works, it might be that another, older copy of six is shadowing the one you pasted. Try finding it, e.g. with
#!bash
find /Library -type f -iname 'six.py*'
or
#!bash
find / -type f -iname 'six.py*'
Originally reported by: Yiqun Liu (Bitbucket: yiqun_liu, GitHub: Unknown)
Yesterday, I updated all the packages via pip and theano couldn't be imported due to following error:
It seems that the problem comes from six - Yet I've tried importing cPickle itself in python and it didn't fail. Moreover, the issue still existed even after I updated Theano to the bleeding edge version. And my terminal returned these words when I typed 'pip show six':
Evidently, I've six installed on my computer. Therefore, I can make sure that the problem is due to a bug of six. Please fix the issue, thanks.