-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.4+ support ... #1276
Comments
Can you check the version of six installed on your computer? Try "pip3 install --upgrade six"? |
Output from that command is: "Requirement already up-to-date: six in /usr/local/lib/python3.4/dist-packages" Thanks for reply. |
Hi there, |
No I did not solve it, I had to use Python 2.7.... |
Could you check the six library's version? Protobuf requires six version above 1.9.0 to work. |
Already have, six version is 1.10.0 From: Feng Xiao [mailto:notifications@github.com] Could you check the six library's version? Protobuf requires six version above 1.9.0 to work. — |
facing the same problem... |
Reinstalling with python 3.3 worked for me From: Coldmooon [mailto:notifications@github.com] face the same problem... — |
@CaffeBin Thank you! I installed |
@CaffeBin After lots of attempts, finally I can let
Updated in 2016.05.17Note that |
I have fixed this issue with the very latest protobuf from Google's repository and building it as the c++ extension vs pure python. Make sure you rebuild Caffe after installing the new protobuf because the protobuf compiler will be updated. |
@Coldmooon |
@Coldmooon Thanks! I installed python3.5 with conda 4.0.5. Steps 2,3 help me! Thanks for your posts! |
@andrey-iliyov You are welcome~ I'm glad to have helped you. |
@BKZero To install protobuf, you need to install both It seems that you have installed If you follow my hints, the protobuf3 compiler will be installed. So both protobuf2 and protobuf3 exist in your system. If this is the case, you should set |
can we just redef it as:
? |
Hi @Coldmooon , it seems you have solved your original problem (i.e. TypeError: unsupported operand type(s) for &: 'str' and 'int') -- is that true? |
ok, I figured it out in my case. Note the |
I had this problem but this fixed it for me: The problem for me is that the C++ version of protobuf on my system was too old; it was version 2.5. The solution was to download version 3.1 (the version matching the Python library installed in my virtual environment) and build and install that (as is standard: I think this might actually be what others are talking about earlier in this thread, but I was confused by @tpwrules saying "building it as the c++ extension vs pure python" because there are two versions of the Python protobuf library, one is C++ and the other pure Python, and I thought that was the distinction being made. In fact what is important is the native code protobuf library, which is nothing to do with Python at all. |
helloI have installed Anaconda, cafee, cuda and Visual Studio 2015 on windows 7. I want to start with caffe. So I run "open with Ipython" from Anaconda.When I type "import caffe" I have this error:
I tried another way too.I run CMD on caffe root. then I typed "python". But when I typed "import caffe" I have this error:
I am beginner to caffe. I do not know what is my problem? |
@momozizi you should install google and protobuf package also |
Hello everybody,
I want to run Caffe with Python 3, which needs Protobuf, but I'm unable to run Protobuf with Python 3.
When I use protobuf from: sudo pip3 install protobuf
I got this error:
Traceback (most recent call last):
File "/home/lada/diplomka/deep-learning/caffe/python/PyCaffeTest.py", line 10, in
import python.caffe
File "/home/lada/diplomka/deep-learning/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/lada/diplomka/deep-learning/caffe/python/caffe/pycaffe.py", line 15, in
import caffe.io
File "/home/lada/diplomka/deep-learning/caffe/python/caffe/init.py", line 4, in
from .proto.caffe_pb2 import TRAIN, TEST
File "/home/lada/diplomka/deep-learning/caffe/python/caffe/proto/caffe_pb2.py", line 7, in
from google.protobuf import reflection as _reflection
File "/usr/local/lib/python3.4/dist-packages/google/protobuf/reflection.py", line 68, in
from google.protobuf.internal import python_message
File "/usr/local/lib/python3.4/dist-packages/google/protobuf/internal/python_message.py", line 848
except struct.error, e:
^
SyntaxError: invalid syntax
I found somewhere, that I need to download Protobuf BETA, so I did:
sudo pip3 install protobuf==3.0.0b2 (I tried also b1 version)
However this version still doesn't support Python 3 completlly, because when I run my Caffe script I got this error:
Failed to include caffe_pb2, things might go wrong!
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/google/protobuf/internal/python_message.py", line 1091, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/usr/local/lib/python3.4/dist-packages/google/protobuf/internal/python_message.py", line 1113, in InternalParse
(tag_bytes, new_pos) = local_ReadTag(buffer, pos)
File "/usr/local/lib/python3.4/dist-packages/google/protobuf/internal/decoder.py", line 181, in ReadTag
while six.indexbytes(buffer, pos) & 0x80:
TypeError: unsupported operand type(s) for &: 'str' and 'int'
During handling of the above exception, another exception occurred: ....
Any thoughts? Any help appreciated, I'm kind of desperate now...
The text was updated successfully, but these errors were encountered: