I tried following the directions in the README to build Electron Cash from source on a Ubuntu 18.04 VM. This was a new system, setup for experimenting with software.
When I got to the part where I run pyrcc5 icons.qrc -o gui/qt/icons_rc.py, I got this output:
trout@trout-wasabi:~/Electron-Cash$ pyrcc5 icons.qrc -o gui/qt/icons_rc.py
Traceback (most recent call last):
File "/usr/local/bin/pyrcc5", line 11, in <module>
load_entry_point('PyQt5==5.11.3', 'console_scripts', 'pyrcc5')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.6/dist-packages/PyQt5-5.11.3-py3.6-linux-x86_64.egg/PyQt5/pyrcc_main.py", line 21, in <module>
from PyQt5.QtCore import PYQT_VERSION_STR, QDir, QFile
ModuleNotFoundError: No module named 'PyQt5.sip'
This is apparently a known bug in sip?
https://github.com/pyinstaller/pyinstaller/issues/3630
@christroutner this help for me https://github.com/Electron-Cash/Electron-Cash/issues/850#issuecomment-427083434
I made the follows:
pip uninstall pyqt5
pip install --upgrade pyqt5
After checking for the required dependencies using
pip3 install --user --upgrade PyQt5
pip3 install --user --upgrade PyQt5-sip
I still encounter the following error referencing a missing module named PyQt5.sip
electron-cash:91: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
[ecc] info: libsecp256k1 library not available, falling back to python-ecdsa. This means signing operations will be slower.
Traceback (most recent call last):
File "electron-cash", line 378, in
d.init_gui(config, plugins)
File "/usr/local/opt/Electron Cash-3.3.4/lib/daemon.py", line 303, in init_gui
gui = __import__('electroncash_gui.' + gui_name, fromlist=['electroncash_gui'])
File "/usr/local/opt/Electron Cash-3.3.4/gui/qt/__init__.py", line 33, in
from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5.sip'
Does someone with more knowledge in this area know how https://github.com/pyinstaller/pyinstaller/issues/3630#issuecomment-404781976 applies to this issue with electron cash?
PyQt5.QtGui import * seems to be calling for SIP in some deprecated manner due to SIP no longer being bundled with PyQt5.
I am not able to open any version of electron-cash and cannot access my wallets so this is an urgent issue.
Try:
pip3 install --user -I PyQt5
pip3 install --user -I PyQt5-sip
-I tells it to ignore already-installed packages and reinstall them.
PyQt5.QtGui import * seems to be calling for SIP in some deprecated manner due to SIP no longer being bundled with PyQt5.
No.. to the contrary -- sip is bundled with PyQt5 as sip.so.
Also try the thing clifordsymack suggested:
pip uninstall pyqt5
pip install --upgrade pyqt5
No.. to the contrary -- sip is bundled with PyQt5 as sip.so.
So does this only apply to building and not running the binaries? http://pyqt.sourceforge.net/Docs/PyQt5/installation.html#downloading-sip
I'd already tried clifordsymack's suggestion to no success. However, your tip about using -I seemed to work. Thanks a lot!
Dud PyQt5 release that should be fixed in next one if I understand correctly.
https://www.riverbankcomputing.com/pipermail/pyqt/2018-December/041211.html
I had this issue; the chat that led to the resolution of the issue is below. It looks like having python3-pyqt5 installed via apt was the problem, and so uninstalling it via apt ("sudo apt remove python3-pyqt5") and then installing it with "pip3 install --user -I PyQt5" solved the problem. I'm including everything below just for reference and so that if anyone searches the same errors they can find this page.
John Moriarty, [14.04.19 16:53]
I downloaded the tar.gz, uncompressed, and ran "sudo python3 setup.py install". This seemed to install with no problems, but when I try to open electron cash via desktop integration, nothing happens. I then tried running it from the download directory with "./electron-cash", which gave the following error:John Moriarty, [14.04.19 16:53]
Traceback (most recent call last):
File "./electron-cash", line 384, in
d.init_gui(config, plugins)
File "/home/john/Desktop/Electron Cash-4.0.1/lib/daemon.py", line 312, in init_gui
gui = import('electroncash_gui.' + gui_name, fromlist=['electroncash_gui'])
File "/home/john/Desktop/Electron Cash-4.0.1/gui/qt/__init__.py", line 33, in
from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5.sip'alwaysAn0n, [14.04.19 16:53]
[In reply to John Moriarty]
Can't find the link I was looking for but if you're running into dependency issues, make sure to install the packages listed here: https://github.com/Electron-Cash/Electron-Cash#development-versionJohn Moriarty, [14.04.19 16:54]
But when I run "sudo apt-get install python3-pyqt5" it says "python3-pyqt5 is already the newest version (5.10.1+dfsg-1ubuntu2)."John Moriarty, [14.04.19 16:55]
ah, didn't get as far down as the development version, will give those a shotalwaysAn0n, [14.04.19 16:55]
Try those then report back if you're still having the same problem.John Moriarty, [14.04.19 16:56]
I'll go ahead and delete the tar.gz and clone from the repository tooJohn Moriarty, [14.04.19 17:13]
Okay so I got as far as "Running unit tests"John Moriarty, [14.04.19 17:13]
after installing tox and running it in the Electron-Cash git directory, I get the following errors:John Moriarty, [14.04.19 17:14]
ERROR: invocation failed (exit code 1), logfile: /home/john/Electron-Cash/.tox/log/GLOB-0.log
================================== log start ===================================
File "setup.py", line 41
SyntaxError: Non-ASCII character '\xe2' in file setup.py on line 41, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details=================================== log end ====================================
ERROR: FAIL could not package project - v = InvocationError(u'/usr/bin/python setup.py sdist --formats=zip --dist-dir /home/john/Electron-Cash/.tox/dist', 1)John Moriarty, [14.04.19 17:15]
and running "./electron-cash" still gives me the error ending in "python3 setup.py install"alwaysAn0n, [14.04.19 17:16]
[In reply to John Moriarty]
Can you paste the whole error message?John Moriarty, [14.04.19 17:16]
Traceback (most recent call last):
File "./electron-cash", line 388, in
d.init_gui(config, plugins)
File "/home/john/Electron-Cash/lib/daemon.py", line 323, in init_gui
gui = import('electroncash_gui.' + gui_name, fromlist=['electroncash_gui'])
File "/home/john/Electron-Cash/gui/qt/__init__.py", line 33, in
from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5.sip'alwaysAn0n, [14.04.19 17:17]
Ah. Same one thenJohn Moriarty, [14.04.19 17:18]
oh oops, didn't actually copy the ending part for that message, my badJohn Moriarty, [14.04.19 17:18]
because terminal requires right click and I always forgetJohn Moriarty, [14.04.19 17:19]
I might have multiple versions of python on this machine from a bunch of other crap I've tried to get running. Might that make a difference?alwaysAn0n, [14.04.19 17:19]
[In reply to John Moriarty]
I don't have much more help to offer sadly. Maybe stick around until @im_uname or @cculianu show up. They are the resident experts for things of this nature.John Moriarty, [14.04.19 17:20]
On this stackoverflow page:John Moriarty, [14.04.19 17:20]
https://stackoverflow.com/questions/51324754/python-3-6-x-pyinstaller-gives-error-no-module-named-pyqt5-sipim_uname, [14.04.19 17:20]
ahhhhhh pyqt5 again aaahhhhhhhhhhJohn Moriarty, [14.04.19 17:20]
it says "I had the same issue which is apparently a known bug due to sip now being installed separately.https://github.com/pyinstaller/pyinstaller/issues/3630
Upon creating the installer I added the line:
--hidden-import PyQt5.sip
This worked no problem."
John Moriarty, [14.04.19 17:20]
Should I try adding that line to a file somewhere? xDJohn Moriarty, [14.04.19 17:21]
[In reply to im_uname]
๐ญim_uname, [14.04.19 17:22]
https://github.com/Electron-Cash/Electron-Cash/issues/892im_uname, [14.04.19 17:22]
@cculianu appimage will end our suffering right? right?John Moriarty, [14.04.19 17:28]
trying the "-I tells it to ignore already-installed packages and reinstall them." methodJohn Moriarty, [14.04.19 17:28]
it'll take a while though at 80kB/s... #mobileDataForTheWinJohn Moriarty, [14.04.19 17:46]
while trying "pip3 install --user -I PyQt5" I got the following error:John Moriarty, [14.04.19 17:47]
Collecting PyQt5
Downloading https://files.pythonhosted.org/packages/98/61/fcd53201a23dd94a1264c29095821fdd55c58b4cd388dc7115e5288866db/PyQt5-5.12.1-5.12.2-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl (61.2MB)
81% |โโโโโโโโโโโโโโโโโโโโโโโโโโโ | 50.0MB 85kB/s eta 0:02:11
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
PyQt5 from https://files.pythonhosted.org/packages/98/61/fcd53201a23dd94a1264c29095821fdd55c58b4cd388dc7115e5288866db/PyQt5-5.12.1-5.12.2-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl#sha256=d4e88208dfd017636e4b1f407990d0c3b6cf47afed6be4f2fb6ca887ef513e4b:
Expected sha256 d4e88208dfd017636e4b1f407990d0c3b6cf47afed6be4f2fb6ca887ef513e4b
Got 331687a0315132d0b6b92c5a1a76aabdd341e9333812a5f7c86e4fb3dbfd9e9bim_uname, [14.04.19 17:48]
...whatJohn Moriarty, [14.04.19 17:49]
[In reply to im_uname]
๐๐ญ๐ฑim_uname, [14.04.19 17:50]
[In reply to John Moriarty]
i suppose you already tried uninstalling and reinstalling pyqt5 via apt right?John Moriarty, [14.04.19 17:51]
I tried it via pip and it said "Cannot uninstall requirement pyqt5, not installed"John Moriarty, [14.04.19 17:51]
should I try apt?im_uname, [14.04.19 17:51]
yeah give it a shotim_uname, [14.04.19 17:51]
also try sudo pip3 install pyqt5 pyqt5-sipim_uname, [14.04.19 17:52]
from time to time there are strange pip packages that somehow only work when installed globallyJohn Moriarty, [14.04.19 17:52]
"sudo pip3 install pyqt5 pyqt5-sip" gives:John Moriarty, [14.04.19 17:53]
The directory '/home/john/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/john/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pyqt5 in /usr/local/lib/python3.6/dist-packages/PyQt5-5.11.3-py3.6-linux-x86_64.egg
Requirement already satisfied: pyqt5-sip in /usr/local/lib/python3.6/dist-packages/PyQt5_sip-4.19.13-py3.6-linux-x86_64.eggJohn Moriarty, [14.04.19 17:53]
with apt, will that be "sudo apt remove โpurge pyqt5"?im_uname, [14.04.19 17:56]
[In reply to John Moriarty]
yeah, i think it should work without purge tooim_uname, [14.04.19 17:58]
[In reply to John Moriarty]
if the apt path doesn't work, give sudo pip3 install -U pyqt5 pyqt5-sip a shotJohn Moriarty, [14.04.19 18:00]
sudo apt remove pyqt5
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pyqt5John Moriarty, [14.04.19 18:01]
"sudo pip3 install -U pyqt5 pyqt5-sip" is currently Collecting pyqt5im_uname, [14.04.19 18:02]
[In reply to John Moriarty]
python3-pyqt5, not pyqt5John Moriarty, [14.04.19 18:11]
oooooooooop[sJohn Moriarty, [14.04.19 18:14]
Guess I'll wait to see if ... nevermind I just hit control C and canceled the "sudo pip3 install -U pyqt5 pyqt5-sip" trying to copy it xOJohn Moriarty, [14.04.19 18:15]
ok so removing python3-pyqt5 was successfulJohn Moriarty, [14.04.19 18:15]
what should I do next?John Moriarty, [14.04.19 18:31]
scrolling up looks like you said to reinstall using apt so I'll give that a shotJohn Moriarty, [14.04.19 18:34]
reinstalled via apt with "sudo apt install python3-pyqt5" and there's not change, getting the same error:John Moriarty, [14.04.19 18:34]
./electron-cash
Traceback (most recent call last):
File "./electron-cash", line 388, in
d.init_gui(config, plugins)
File "/home/john/Electron-Cash/lib/daemon.py", line 323, in init_gui
gui = import('electroncash_gui.' + gui_name, fromlist=['electroncash_gui'])
File "/home/john/Electron-Cash/gui/qt/__init__.py", line 33, in
from PyQt5.QtGui import *
ModuleNotFoundError: No module named 'PyQt5.sip'checksum0, [14.04.19 18:36]
Install with pipchecksum0, [14.04.19 18:36]
Not aptJohn Moriarty, [14.04.19 18:39]
ok so uninstalling again via apt, and then trying "pip3 install --user -I PyQt5"JF 010, [14.04.19 18:51]
pyqt5 env issues can be a nightmare.checksum0, [14.04.19 18:52]
Yeah, and installing ec on Debian based is a absolute pain in the ass for some reasonsim_uname, [14.04.19 18:57]
[In reply to John Moriarty]
Try this again tooJohn Moriarty, [14.04.19 18:57]
after apt uninstall and then installing via pip "Successfully installed PyQt5-5.12.1 PyQt5-sip-4.19.15"John Moriarty, [14.04.19 18:58]
./electron-cash works =)John Moriarty, [14.04.19 18:58]
and so does desktop integration =))
Wow -- so Ubuntu package maintainers are to blame! I'm going to sticky this issue. Thanks for the follow-up!
Installing PyQt5 from SIP would make apps that are dependent on OS-installed libraries stop working (e.g. QGIS). Is there a workaround for this?
Best to install your dependencies in a virtualenv. In the source directory you can run this to create a virtualenv in subfolder env:
python3 -m venv env
source env/bin/activate
pip install -r contrib/requirements/requirements.txt
pip install -r contrib/requirements/requirements-binaries.txt
pip install -r contrib/requirements/requirements-hw.txt
Then you can run using ./electron-cash. Note that you have to activate the env every time before you run the app using source env/bin/activate
Best to install your dependencies in a virtualenv. In the source directory you can run this to create a virtualenv in subfolder
env:python3 -m venv env source env/bin/activate pip install -r contrib/requirements/requirements.txt pip install -r contrib/requirements/requirements-binaries.txt pip install -r contrib/requirements/requirements-hw.txtThen you can run using
./electron-cash. Note that you have to activate the env every time before you run the app usingsource env/bin/activate
Thanks! Will this be resolved in the future, or I have to do that every time firing up Electron Cash?
This is kinda a dependency conflict as far as I'm concerned
If you install stuff with pip it is going to affect other apps on your system, nothing we can do about that. That is why there are virtualenvs, giving you the option to package all the specific dependencies of an app into a directory.
You should recreate the virtualenv (first 5 commands) when you switch to a new version of EC as the dependencies might have changed. source env/bin/activate needs to be run every time before running EC.
For anyone that is looking for a workaround: Best to use AppImage instead.
Uninstalling and then reinstalling the PyQt5 works for me on PyCharm.
Use:
pip uninstall pyqt5
pip uninstall pyqt5-sip
and then reinstall again by using:
pip install pyqt5
pip install pyqt5-sip
Most helpful comment
Try:
-Itells it to ignore already-installed packages and reinstall them.No.. to the contrary -- sip is bundled with PyQt5 as sip.so.