Related to closed:
https://github.com/fyookball/electrum/issues/443
I'm sorry, but nothing changed with 3.1.2 version. It do not use depencences from package directory? Why?
[user@host Electron Cash-3.1.1]$ ./electron-cash
Error: No module named 'google.protobuf'. Try 'sudo pip install'
[user@host Electron Cash-3.1.1]$ sudo pip3 install protobuf
Requirement already satisfied (use --upgrade to upgrade): protobuf in /usr/lib64/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.9 in /usr/lib/python3.5/site-packages (from protobuf)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python3.5/site-packages (from protobuf)
The log you are referencing says
Electron Cash-3.1.1
are you sure you are using the 3.1.2 version?
@marceloneil
Yes. The same.
[user@host ~]$ cd Electron\ Cash-3.1.2/
[user@host Electron Cash-3.1.2]$ ls
app.fil icons README.rst
AUTHORS icons.qrc RELEASE-NOTES
dist lib scripts
electron-cash LICENCE setup.cfg
electron-cash.conf.sample MANIFEST.in setup.py
electron-cash.desktop packages setup-release.py
Electron_Cash.egg-info PKG-INFO
gui plugins
[user@host Electron Cash-3.1.2]$ ./electron-cash
Error: No module named 'google.protobuf'. Try 'sudo pip install <module-name>'
Hmm, that is very odd. Can you try ls packages? There should be a folder called "google", which contains protobuf. Also maybe try (sudo) pip3 install protobuf
[user@host Electron Cash-3.1.2]$ cd packages/
[user@host packages]$ ls
certifi protobuf-3.5.0.post1-py3.5-nspkg.pth
certifi-2017.11.5.dist-info pyaes
chardet pyaes-1.6.1-py3.5.egg-info
chardet-3.0.4.dist-info __pycache__
dns PySocks-1.6.7.dist-info
dnspython-1.15.0.dist-info qrcode
easy_install.py qrcode-5.3.dist-info
ecdsa requests
ecdsa-0.13.dist-info requests-2.18.4.dist-info
google setuptools
idna setuptools-38.4.0.dist-info
idna-2.6.dist-info six-1.11.0.dist-info
jsonrpclib six.py
jsonrpclib_pelix-0.3.1.dist-info sockshandler.py
pbkdf2-1.3-py3.5.egg-info socks.py
pbkdf2.py urllib3
pkg_resources urllib3-1.22.dist-info
protobuf-3.5.0.post1.dist-info
[user@host packages]$
It (looks like) it does not check packages dir at all. First it request dns then other dependency. All installeted manually.
That's really odd, I'm able to run it on debian with no dependencies installed other than python3 and pyqt5. Maybe try uninstalling protobuf?
I will try.
How to check them python really try to load something from packages directory? Any simple script? I guess it not. Is it default name of directory that python check for dependencies before exit with the error?
Proceed (y/n)? y
Successfully uninstalled protobuf-3.5.1
[user@host Electron Cash-3.1.2]$ ./electron-cash
Error: No module named 'google.protobuf'. Try 'sudo pip install <module-name>'
I believe there is a line in electron-cash which adds the packages directory to the python path:
https://github.com/fyookball/electrum/blob/master/electron-cash#L52
if is_local or is_android:
sys.path.insert(0, os.path.join(script_dir, 'packages'))
Maybe you could add a print statement or something in there to verify that the correct directory is being added to the path?
Yes. I'm already found it. How to print? print_msg(os.path) does not print. At this line it does not know print_msg function
Try this:
if is_local or is_android:
sys.path.insert(0, os.path.join(script_dir, 'packages'))
print(sys.path)
['/home/user/Electron Cash-3.1.2/packages', '/home/user/Electron Cash-3.1.2', '/usr/lib64/python35.zip', '/usr/lib64/python3.5', '/usr/lib64/python3.5/plat-linux', '/usr/lib64/python3.5/lib-dynload', '/usr/lib64/python3.5/site-packages', '/usr/lib/python3.5/site-packages']
Alright, so you have '/home/user/Electron Cash-3.1.2/packages' in your pythonpath, meaning python should detect google.protobuf in there. But yet it doesn't
I will try to move all files from packages to /usr/lib64/python3.5/site-packages
Seems does not help.
Maybe some issue with python cache? Or any other ideas?...
I'm really unsure, my only suggestion would be to try reinstalling python/dependencies. Have you tried running sudo python3 setup.py install?
I will try.
p.s. Maybe it can not load google.protobuf, because google directory wothout files and python does not search at subdirectories...
Does the google folder contain a folder called protobuf?
sudo python3 setup.py install does not help :(
Finished processing dependencies for Electron-Cash==3.1.2
[user@host Electron Cash-3.1.2]$ electron-cash
[user@host Electron Cash-3.1.2]$ electron-cash
['/usr/bin', '/usr/lib64/python35.zip', '/usr/lib64/python3.5', '/usr/lib64/python3.5/plat-linux', '/usr/lib64/python3.5/lib-dynload', '/usr/lib64/python3.5/site-packages', '/usr/lib/python3.5/site-packages', '/usr/lib/python3.5/site-packages/Electron_Cash-3.1.2-py3.5.egg', '/usr/lib/python3.5/site-packages/PyQt5-5.9.2-py3.5-linux-x86_64.egg', '/usr/lib/python3.5/site-packages/sip-4.19.6-py3.5-linux-x86_64.egg']
Error: No module named 'google.protobuf'. Try 'sudo pip install <module-name>'
Does the google folder contain a folder called protobuf?
yes.
I delete from it __pycache__ and new __pycache__ does not created. Seems something with files at this directory. They are incomplete with my system or python maybe.
[user@host Electron Cash-3.1.2]$ python3.5
Python 3.5.4 (default, Oct 9 2017, 12:07:29)
[GCC 6.4.1 20170727 (Red Hat 6.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import google.protobuf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'google.protobuf'
How to get more details?
Can you import any other packages that are in your /usr/lib/python3.5/site-packages directory?
Okey. Found.
When I define it at the electron.cash like packages.google.protobuf instead of google.protobuf and trying to load. It load them, but exit with the same error, but from other file:
File "/home/user/Electron Cash-3.1.2/packages/google/protobuf/descriptor.py", line 39, in <module>
from google.protobuf.internal import api_implementation
Looks like it's something wrong with relative paths at this lib or something like that.
From the console at python3.5 it can also load
>>> import packages.google.protobuf no errors.
Does not want to load it like google.protobuf, but also not fully loaded when its packages.google.protobuf because module want also to load google.protobuf
This is so confusing
Looks like it's wrong way, maybe...
if is_local or is_android:
sys.path.insert(0, os.path.join(script_dir, 'packages'))
That code works on most systems, so it makes me think there is something different about your distro/setup/python
Maybe google dir must contain __init__.py ?
https://stackoverflow.com/questions/1918539/can-anyone-explain-pythons-relative-imports
Editing PATH - no results :(
[user@host Electron Cash-3.1.2]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin:/home/user/Electron Cash-3.1.2/packages:/home/user/Electron Cash-3.1.2/packages/google/
There is no __init__.py in my google/ dir, but there is in google/protobuf
And are you sure that at you system it loaded from packages directory and not from the other system directory?
Maybe it's something with python configuration. I'm not sure, but at stackoverflow I found that it must containt init.py or python does not check subdirs
On my debian vm yep, but it doesnt matter because you also installed it on your system
I'm on fedora...
Have you tried installing the fedora package?
I can try whipping up a fedora vm later, what version?
fedora 25
Maybe it's little old? If I'm alone with this then do not wast your time...
Thanks
Thanks you. Please, do not close ticket for some time. Maybe somebody know how to fix it
If you install protobuf using pip3 install protobuf and are unable to import it using python, this issue is fairly independent of electron cash. I would suggest opening an issue elsewhere or trying stackoverflow, because I'm not super familiar with what's causing the issue.
@marceloneil Okey! Thanks.
p.s. not happy that Electron Cash have some dependencies from google at all. I do not trust this company. I think that if it's possible to stay away from them then it always most be done.
I found that it's possible to update to Fedora 26 at my system. Maybe it will help
@evadogstar I don't blame you, but remember it is FOSS! https://github.com/google/protobuf
@evadogstar i believe protobuf is only used for payment request (invoices) submodule.
I found that it's possible to update to Fedora 26 at my system. Maybe it will help
Do you know if you are able to updating to the latests Fedora? Fedora 27 ships Electron Cash in their default repository.
@fyookball So, is it safe to disable import google* on the code? If someone other will have the same problem and will find this ticket? thanks
@hegjon I'm on Qubes OS https://www.qubes-os.org/ and there is default Fedora 25 template, but I found that new template already available (Fedora 26). I'm not sure that updating it to Fedora 27 is a good idea. Yes, it's possible, because it's virtual machine, but I'm not sure that it will work with Qubes OS like it must do (support Qubes-related functions) and if it's not supported then it will not receive Qubes-related updates & security fixes. I will try Fedora 26 (in progress of update).
@marceloneil Hope that somebody with good skills review it :)
@evadogstar i dont know, you'd have to test it and possibly remove references to it, but i am fairly sure that it is not needed for the main functions of the wallet.
@evadogstar I actually have qubesos somewhere so I might try to reproduce your issue. Otherwise maybe try creating a new vm, or use a different template (maybe debian?). You're issue is pretty confusing
@marceloneil Thanks. I'm already updated template to Fedora 26, now it works! Yes, issue at Fedora 25 was really strange. Unexpected python work.
p.s. QubesOS very good! I suggest it for every day use
p.p.s. Thanks for your time and help!
My pleasure, enjoy electron cash!