yowsup icon indicating copy to clipboard operation
yowsup copied to clipboard

ImportError

Open mcl024 opened this issue 11 years ago • 19 comments

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 import('pkg_resources').run_script('yowsup2==2.0.53', 'yowsup-cli') File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1246, in run_script exec script_code in namespace, namespace File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.0.53-py2.7.egg/EGG-INFO/scripts/yowsup-cli", line 6, in

File "build/bdist.linux-i686/egg/yowsup/demos/cli/init.py", line 1, in # File "build/bdist.linux-i686/egg/yowsup/demos/cli/stack.py", line 2, in File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/init.py", line 1, in # File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/layer.py", line 3, in File "build/bdist.linux-x86_64/egg/axolotl/util/keyhelper.py", line 3, in File "build/bdist.linux-x86_64/egg/axolotl/identitykeypair.py", line 1, in File "build/bdist.linux-x86_64/egg/axolotl/state/storageprotos.py", line 9, in ImportError: cannot import name symbol_database

mcl024 avatar Jan 03 '15 21:01 mcl024

try sudo pip install --upgrade protobuf ?

tgalal avatar Jan 03 '15 21:01 tgalal

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 import('pkg_resources').run_script('yowsup2==2.0.53', 'yowsup-cli') File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 652, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1580, in run_script exec(script_code, namespace, namespace) File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.0.53-py2.7.egg/EGG-INFO/scripts/yowsup-cli", line 6, in

File "build/bdist.linux-i686/egg/yowsup/demos/cli/init.py", line 1, in # File "build/bdist.linux-i686/egg/yowsup/demos/cli/stack.py", line 2, in File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/init.py", line 1, in # File "build/bdist.linux-i686/egg/yowsup/layers/axolotl/layer.py", line 3, in File "build/bdist.linux-x86_64/egg/axolotl/util/keyhelper.py", line 3, in File "build/bdist.linux-x86_64/egg/axolotl/identitykeypair.py", line 1, in File "build/bdist.linux-x86_64/egg/axolotl/state/storageprotos.py", line 9, in ImportError: cannot import name symbol_database matthias@matthias-desktop:~/yowsup$

mcl024 avatar Jan 03 '15 21:01 mcl024

which protobuf version do you have, in python console try:

from google import protobuf
print(protobuf.__version__)

tgalal avatar Jan 03 '15 21:01 tgalal

print(protobuf.version) 3.0.0-alpha-1

mcl024 avatar Jan 03 '15 21:01 mcl024

try remove and reinstall protobuf python package

tgalal avatar Jan 03 '15 21:01 tgalal

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

mcl024 avatar Jan 03 '15 21:01 mcl024

Make sure protobuf is installed

tgalal avatar Jan 04 '15 02:01 tgalal

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

mcl024 avatar Jan 04 '15 20:01 mcl024

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

mcl024 avatar Jan 04 '15 21:01 mcl024

Any ideas??

mcl024 avatar Jan 06 '15 08:01 mcl024

no sorry, it looks like problems with your protobuf installation which I can't help with :/

tgalal avatar Jan 07 '15 07:01 tgalal

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.

mediumwell avatar Jan 14 '15 14:01 mediumwell

Sorry but i did not understand what you mean. What can i do to make it work?

mcl024 avatar Feb 03 '15 20:02 mcl024

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 avatar Dec 18 '15 11:12 rfelten

@rfelten 's solution did the trick :)

crearo avatar Dec 21 '15 12:12 crearo

Thanks @rfelten your trick works for me on ubuntu14.04.3

jacobcui avatar Dec 23 '15 00:12 jacobcui

for the probleme ImportError: cannot import name symbol_database

sudo pip install --upgrade protobuf works for me

VividLe avatar Jul 22 '16 07:07 VividLe

Just in case: check that you have installed protobuf for the same version of python you are trying to use.

denolia avatar Sep 07 '16 18:09 denolia

Thanks @LeYangNwpu ! Your recommendation works!

robotsorcerer avatar Nov 17 '16 05:11 robotsorcerer