ImportError
i get the following error
matthias@matthias-desktop:~/yowsup$ yowsup-cli
Traceback (most recent call last):
File "/usr/local/bin/yowsup-cli", line 4, in
File "build/bdist.linux-i686/egg/yowsup/demos/cli/init.py", line 1, in
try sudo pip install --upgrade protobuf ?
thx, but nothing changed :-) I get the similar error
matthias@matthias-desktop:~/yowsup$ yowsup-cli
/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py:1180: UserWarning: /home/matthias/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)
Traceback (most recent call last):
File "/usr/local/bin/yowsup-cli", line 4, in
File "build/bdist.linux-i686/egg/yowsup/demos/cli/init.py", line 1, in
which protobuf version do you have, in python console try:
from google import protobuf
print(protobuf.__version__)
print(protobuf.version) 3.0.0-alpha-1
try remove and reinstall protobuf python package
Mhh, after reinstalling i get this message from python console
print(protobuf.version) Traceback (most recent call last): File "
", line 1, in NameError: name 'protobuf' is not defined
Make sure protobuf is installed
Sorry but don`t now what is going on. I installed python-protobuf like this:
matthias@matthias-desktop:~$ sudo apt-get install python-protobuf
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Statusinformationen werden eingelesen... Fertig
Die folgenden NEUEN Pakete werden installiert:
python-protobuf
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 2 nicht aktualisiert.
Es müssen noch 0 B von 77,5 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 463 kB Plattenplatz zusätzlich benutzt.
Vormals nicht ausgewähltes Paket python-protobuf wird gewählt.
(Lese Datenbank ... 222202 Dateien und Verzeichnisse sind derzeit installiert.)
Entpacken von python-protobuf (aus .../python-protobuf_2.4.1-3ubuntu1_i386.deb) ...
python-protobuf (2.4.1-3ubuntu1) wird eingerichtet ...
Everything them to be fine but when i print the version in python i get this:
matthias@matthias-desktop:~$ python Python 2.7.3 (default, Feb 27 2014, 19:39:10) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
print(protobuf.version) Traceback (most recent call last): File "
", line 1, in NameError: name 'protobuf' is not defined
Ok, sorry protobuf version works. Forgot the form google import protobuf
matthias@matthias-desktop:~/yowsup$ python Python 2.7.3 (default, Feb 27 2014, 19:39:10) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
from google import protobuf print(protobuf.version) 3.0.0-alpha-1
matthias@matthias-desktop:~/yowsup$
But i get the same ImportError
Any ideas??
no sorry, it looks like problems with your protobuf installation which I can't help with :/
Hint: yowsup uses a feature of protobuf (namely "symbol_database") which is only available in recent versions of protobuf.
If you try to use yowsup on a CentOS 6 system, you are out of luck because the EPEL repositories give you protobuf-python version 2.3.something (which is too old). Installing protobuf 2.6.1 via pip is not a solution because you end up with "google" packages in two places:
/usr/lib/python2.6/site-packages/google /usr/lib/python2.6/site-packages/protobuf-2.6.1-py2.6.egg/google
If you now do "import google" in your application (which yowsup does) you will only get the native directory and its content, not the one inside the egg.
Sorry but i did not understand what you mean. What can i do to make it work?
Hi, I ran in the same issues (see below) after updating to protobuf to 3.0.0a4 from git:
rf@host:~/src/protobuf/examples$ ./add_person.py
Traceback (most recent call last):
File "./add_person.py", line 5, in <module>
import addressbook_pb2
File "/home/rf/src/protobuf/examples/addressbook_pb2.py", line 9, in <module>
from google.protobuf import symbol_database as _symbol_database
ImportError: cannot import name symbol_database
After removing the abandoned python binding of ubuntu via
sudo apt-get remove python-protobuf
the examples work for me.
@rfelten 's solution did the trick :)
Thanks @rfelten your trick works for me on ubuntu14.04.3
for the probleme ImportError: cannot import name symbol_database
sudo pip install --upgrade protobuf works for me
Just in case: check that you have installed protobuf for the same version of python you are trying to use.
Thanks @LeYangNwpu ! Your recommendation works!