rikky
Posts: 7
Joined: Mon May 25, 2015 9:01 pm

installing electrum fails on pyqt5

Sat May 18, 2019 11:25 am

Hello,

I tried to install the newest electrum on a rasberry pi with OS Raspbian Stretch
It did succeed.
However when I run 'electrum' it gives the following error:

Code: Select all

/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  collections.MutableMapping.register(Struct)
/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  collections.MutableSequence.register(ListValue)
Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'
It says that I need to sudo apt-get install python3-pyqt5,
But I dod that a thousand times.

I've done all I could think of.
Twice.
Below is a transcript of my journey from the second time.
I have remarked the responses that seemed to tell some problem or error.
I'm sure I'm missing something tiny.
But what?
Please help.

Code: Select all

sudo apt-get update
sudo apt-get install python3-pyqt5

cd Downloads

wget https://download.electrum.org/3.3.5/Electrum-3.3.5.tar.gz
wget https://download.electrum.org/3.3.5/Electrum-3.3.5.tar.gz.asc

gpg --verify Electrum-3.3.5.tar.gz.asc
  ==>>  gpg: keybox '/home/pi/.gnupg/pubring.kbx' created
        gpg: assuming signed data in 'Electrum-3.3.5.tar.gz'
        gpg: Signature made Thu 09 May 2019 19:00:48 CEST
        gpg:                using RSA key 6694D8DE7BE8EE5631BED9502BD5824B7F9470E6
        gpg: Can't check signature: No public key

python3 Electrum-3.3.5/run_electrum
  ==>>  File "Electrum-3.3.5/run_electrum", line 64
          sys.exit(f"Error: {str(e)}. Try 'sudo python3 -m pip install <module-name>'")

# okee, then we go try to install it.

sudo apt-get install python3-setuptools python3-pip
  ==>>  Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        python3-setuptools is already the newest version (33.1.1-1).
        python3-setuptools set to manually installed.
        python3-pip is already the newest version (9.0.1-2+rpt2).
        0 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.
        
python3 -m pip install --user Electrum-3.3.5.tar.gz     
  ==>>  Processing ./Electrum-3.3.5.tar.gz
            Complete output from command python setup.py egg_info:
            Error: Electrum requires Python version >= 3.6.1...
    
            ----------------------------------------
        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-hok31pej-build/
        
python3 -V
   ==>>  Python 3.5.3
   
# okee, we'll upgrade to Python-3.7.3 
# from: https://raspberrypi.stackexchange.com/questions/59381/how-do-i-update-my-rpi3-to-python-3-6#59391

cd ..

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz.asc
gpg --verify Python-3.7.3.tgz.asc
   ==>>  gpg: assuming signed data in 'Python-3.7.3.tgz'
         gpg: Signature made Mon 25 Mar 2019 22:00:36 CET
         gpg:                using RSA key 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
         gpg: Can't check signature: No public key

 tar xzvf Python-3.7.3.tgz


cd Python-3.7.3/

./configure
   ==>>  If you want a release build with all stable optimizations active (PGO, etc),
         please run ./configure --enable-optimizations

./configure --enable-optimizations

make -j4;       # simply uses all 4 rpi cores in the make process (much faster)
# pfff waiting, waiting, raspi slows down signifficantly sometimes during the process
# stuck for ages at : 0:08:39 load avg: 2.32 [ 25/416] test_asyncio
# 0:26:42 load avg: 2.17 [ 26/416] test_asyncore -- test_asyncio passed in 18 min 3 sec
# 0:26:44 load avg: 2.17 [ 27/416] test_atexit -- test_asyncore skipped
# 0:55:41 load avg: 2.51 [ 84/416] test_contextlib_async
# Task was destroyed but it is pending!
# task: <Task pending coro=<<async_generator_athrow without __name__>()>>
# Task was destroyed but it is pending!
# task: <Task pending coro=<<async_generator_athrow without __name__>()>>
# 0:56:43 load avg: 2.38 [ 93/416] test_curses -- test_ctypes skipped
# 0:56:46 load avg: 2.35 [ 94/416] test_dataclasses -- test_curses skipped (resource denied)
# 0:59:12 load avg: 2.21 [ 99/416] test_dbm_ndbm -- test_dbm_gnu skipped
# 0:59:15 load avg: 2.19 [100/416] test_decimal -- test_dbm_ndbm skipped
# 1:05:22 load avg: 2.13 [107/416] test_dict_version -- test_devpoll skipped
# 1:18:17 load avg: 2.10 [171/416] test_hashlib
# /home/pi/Downloads/Python-3.7.3/Lib/test/test_hashlib.py:90: UserWarning: Did a C extension fail to compile? No module named '_hashlib'
#   warnings.warn('Did a C extension fail to compile? %s' % error)
# 1:19:49 load avg: 2.06 [181/416] test_imaplib -- test_idle skipped
# 1:34:07 load avg: 2.27 [201/416] test_largefile -- test_kqueue skipped
# 1:45:16 load avg: 2.04 [211/416] test_macpath -- test_lzma skipped
# 1:49:23 load avg: 2.18 [225/416] test_multibytecodec -- test_msilib skipped
# 1:50:31 load avg: 2.11 [227/416] test_multiprocessing_forkserver -- test_multiprocessing_fork skipped
# 1:50:36 load avg: 2.10 [228/416] test_multiprocessing_main_handling -- test_multiprocessing_forkserver skipped
# 1:50:40 load avg: 2.10 [229/416] test_multiprocessing_spawn -- test_multiprocessing_main_handling skipped
# 1:50:45 load avg: 2.10 [230/416] test_netrc -- test_multiprocessing_spawn skipped
# 1:53:39 load avg: 2.19 [242/416] test_osx_env -- test_ossaudiodev skipped (resource denied)
# 2:07:43 load avg: 2.29 [280/416] test_regrtest -- test_readline skipped
# 2:18:54 load avg: 2.40 [306/416] test_sndhdr -- test_smtpnet skipped
# 2:20:05 load avg: 2.33 [309/416] test_sort -- test_socketserver skipped (resource denied)
# 2:20:29 load avg: 2.31 [312/416] test_sqlite -- test_spwd failed
# 2:20:34 load avg: 2.28 [313/416] test_ssl -- test_sqlite skipped
# 2:20:40 load avg: 2.24 [314/416] test_startfile -- test_ssl skipped
# 2:20:45 load avg: 2.22 [315/416] test_stat -- test_startfile skipped
# 2:23:25 load avg: 2.40 [328/416] test_sunau -- test_subprocess skipped
# 2:24:25 load avg: 2.28 [336/416] test_sys_settrace
# unhandled exception during asyncio.run() shutdown
# task: <Task finished coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
# RuntimeError: can't send non-None value to a just-started coroutine
# unhandled exception during asyncio.run() shutdown
# task: <Task finished coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
# RuntimeError: can't send non-None value to a just-started coroutine
# 2:26:45 load avg: 2.54 [341/416] test_telnetlib -- test_tcl skipped
# 2:29:08 load avg: 2.05 [353/416] test_tix -- test_timeout skipped (resource denied)
# 2:29:13 load avg: 2.05 [354/416] test_tk -- test_tix skipped
# 2:29:17 load avg: 2.12 [355/416] test_tokenize -- test_tk skipped
# 2:35:33 load avg: 2.16 [361/416] test_ttk_textonly -- test_ttk_guionly skipped
# 2:35:38 load avg: 2.15 [362/416] test_tuple -- test_ttk_textonly skipped
# 2:39:02 load avg: 2.02 [364/416] test_typechecks -- test_turtle skipped
# 2:43:14 load avg: 2.39 [380/416] test_urllib_response -- test_urllib2net skipped (resource denied)
# 2:43:25 load avg: 2.33 [382/416] test_urlparse -- test_urllibnet skipped (resource denied)

#  ... probably lost some ...
 
# running build
# running build_ext
# INFO: Can't locate Tcl/Tk libs and/or headers
 
# In file included from /home/pi/Downloads/Python-3.7.3/Modules/_sha3/sha3module.c:113:0:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_SetBytesInLaneToZero’:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:97:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#      low = *((UINT32*)(laneAsBytes+0));
#      ^~~
# In file included from /home/pi/Downloads/Python-3.7.3/Modules/_sha3/sha3module.c:113:0:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_AddBytesInLane’:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:152:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#      low = *((UINT32*)(laneAsBytes+0));
#      ^~~
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_ExtractBytesInLane’:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:296:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#      *((UINT32*)(laneAsBytes+0)) = low;
#      ^
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c: In function ‘_PySHA3_KeccakP1600_ExtractAndAddBytesInLane’:
# /home/pi/Downloads/Python-3.7.3/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c:369:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
#      *((UINT32*)(laneAsBytes+0)) = low;
#      ^

# INFO: Could not locate ffi libs and/or headers

# Python build finished successfully!
# The necessary bits to build these optional modules were not found:
# _bz2                  _curses               _curses_panel      
# _dbm                  _gdbm                 _hashlib           
# _lzma                 _sqlite3              _ssl               
# _tkinter              _uuid                 readline           
# To find the necessary bits, look in setup.py in detect_modules() for the module's name.


# The following modules found by detect_modules() in setup.py, have been
# built by the Makefile instead, as configured by the Setup files:
# _abc                  atexit                pwd                
# time                                                           


# Failed to build these modules:
# _ctypes                                                        


# Could not build the ssl module!
# Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
# LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

sudo make install 

#  from _ctypes import Union, Structure, Array
# ModuleNotFoundError: No module named '_ctypes'
# Makefile:1130: recipe for target 'install' failed
# make: *** [install] Error 1


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# we continue:

sudo apt-get install libffi-dev

# collecting setuptools
# Collecting pip
# Installing collected packages: setuptools, pip
# Successfully installed pip-19.0.3 setuptools-40.8.0

cd ../Electrum-3.3.5/
python3 ./run_electrum

# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableMapping.register(Struct)
# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableSequence.register(ListValue)
# Traceback (most recent call last):
#   File "./run_electrum", line 79, in <module>
#     from electrum.logging import get_logger, configure_logging
#   File "/home/pi/Downloads/Electrum-3.3.5/electrum/__init__.py", line 2, in <module>
#     from .util import format_satoshis
#   File "/home/pi/Downloads/Electrum-3.3.5/electrum/util.py", line 42, in <module>
#     import ssl
#   File "/usr/local/lib/python3.7/ssl.py", line 98, in <module>
#     import _ssl             # if we can't import it, let the error propagate
# ModuleNotFoundError: No module named '_ssl'

sudo apt-get install libssl-dev

python3 ./run_electrum

# ModuleNotFoundError: No module named '_ssl'

sudo apt-get install libssl-dev libreadline-dev libbz2-dev build-essential sqlite3 tk-dev libsqlite3-dev libc6-dev  libgdbm-dev libncurses-dev -y

python3 ./run_electrum

# ModuleNotFoundError: No module named '_ssl'

cd ../Python-3.7.3/

./configure --enable-optimizations

make -j4

sudo make install

# Requirement already up-to-date: setuptools in /usr/local/lib/python3.7/site-packages (40.8.0)
# Requirement already up-to-date: pip in /usr/local/lib/python3.7/site-packages (19.0.3)

cd ../Electrum-3.3.5/

python3 ./run_electrum

# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableMapping.register(Struct)
# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableSequence.register(ListValue)
# Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'

reboot

cd Downloads/Electrum-3.3.5/

python3 ./run_electrum

# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableMapping.register(Struct)
# /home/pi/Downloads/Electrum-3.3.5/packages/google/protobuf/internal/well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableSequence.register(ListValue)
# Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'

cd ..

python3 -m pip install --user Electrum-3.3.5.tar.gz 

# ....

#   The script qr is installed in '/home/pi/.local/bin' which is not on PATH.
#   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
#   The script qdarkstyle is installed in '/home/pi/.local/bin' which is not on PATH.
#   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
 
#  The script chardetect is installed in '/home/pi/.local/bin' which is not on PATH.
#   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

# Successfully installed Electrum-3.3.5 aiohttp-3.5.4 aiohttp-socks-0.2.2 aiorpcx-0.17.0 async-timeout-3.0.1 attrs-19.1.0 certifi-2019.3.9 chardet-3.0.4 dnspython-1.16.0 ecdsa-0.13.2 idna-2.8 jsonrpclib-pelix-0.4.0 multidict-4.5.2 protobuf-3.7.1 pyaes-1.6.1 qdarkstyle-2.6.8 qrcode-6.1 six-1.12.0 yarl-1.3.0
# You are using pip version 19.0.3, however version 19.1.1 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

/home/pi/.local/bin/electrum

# /home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:788: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableMapping.register(Struct)
# /home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py:832: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
#   collections.MutableSequence.register(ListValue)
# Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'

sudo apt-get install python3-pyqt5

# python3-pyqt5 is already the newest version (5.7+dfsg-5).
# 0 upgraded, 0 newly installed, 0 to remove and 151 not upgraded.

sudo pip3 install PyQt5

# Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
# Collecting PyQt5
#   Could not find a version that satisfies the requirement PyQt5 (from versions: )
# No matching distribution found for PyQt5
# You are using pip version 19.0.3, however version 19.1.1 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

pip install --upgrade pip

# Collecting pip
#   Cache entry deserialization failed, entry ignored
#   Cache entry deserialization failed, entry ignored
#   Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
#     100% |████████████████████████████████| 1.4MB 14kB/s 
# Installing collected packages: pip
# Successfully installed pip-19.1.1

sudo pip3 install PyQt5

# Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
# Collecting PyQt5
#   Could not find a version that satisfies the requirement PyQt5 (from versions: )
# No matching distribution found for PyQt5
# You are using pip version 19.0.3, however version 19.1.1 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

reboot

sudo pip3 install PyQt5

# Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
# Collecting PyQt5
#   Could not find a version that satisfies the requirement PyQt5 (from versions: )
# No matching distribution found for PyQt5
# You are using pip version 19.0.3, however version 19.1.1 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

pip --version

# pip 19.1.1 from /home/pi/.local/lib/python2.7/site-packages/pip (python 2.7)

pip3 --version

# pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

pip3 install --upgrade pip

# Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
# Collecting pip
#   Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
# Installing collected packages: pip
#   Found existing installation: pip 19.0.3
#     Uninstalling pip-19.0.3:
# Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'LICENSE.txt'
# Consider using the `--user` option or check the permissions.
# 
# You are using pip version 19.0.3, however version 19.1.1 is available.
# You should consider upgrading via the 'pip install --upgrade pip' command.

pip3 install --user --upgrade pip

# bash: /usr/local/bin/pip3: No such file or directory

# ghhh how to get pip3 back

sudo apt-get remove --purge libffi-dev -y

sudo apt-get install libffi-dev -y

pip3 install --user --upgrade pip

# bash: /usr/local/bin/pip3: No such file or directory

sudo apt-get install python3-pip -y

# python3-pip is already the newest version (9.0.1-2+rpt2)

sudo apt-get remove --purge python3-pip -y

sudo apt-get install python3-pip -y

# (switched console for pip3 was sought for in the wrong place)

pip3 --version

# pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

pip3 install --user --upgrade pip

# Collecting pip
#   Cache entry deserialization failed, entry ignored
#   Cache entry deserialization failed, entry ignored
#   Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
# Installing collected packages: pip
# Successfully installed pip-19.1.1

sudo pip3 install PyQt5

# Collecting PyQt5
#   Cache entry deserialization failed, entry ignored
#   Cache entry deserialization failed, entry ignored
#   Could not find a version that satisfies the requirement PyQt5 (from versions: )
# No matching distribution found for PyQt5

# I give up.
 
Thanks in advance.
:) Rik.

someSven
Posts: 5
Joined: Tue Nov 27, 2018 11:17 am

Re: installing electrum fails on pyqt5

Tue Jun 04, 2019 4:42 am

Same problem here. Sometimes I'm tired of things like that.

- I had to fiddle around to get Python 3.7 (3.6.something would have been enough). I had to configure and make it, but first install dependencies... https://gist.github.com/SeppPenner/6a5a ... 524417761d
- There were issues with pip.
- Then the current version of Qt 5 is not enough... pip doesn't allow to install Qt5 and asks for 'sudo pip' :(
- I can't use the Appimage version because it's not for ARM. :(

Could there please at some point in the near future be a method to install software that works without problems, or a number of options where one works.

Edit: Here is some more explanation: https://bitcointalk.org/index.php?topic=5144582.0

someSven
Posts: 5
Joined: Tue Nov 27, 2018 11:17 am

Re: installing electrum fails on pyqt5

Thu Jun 06, 2019 11:32 pm

The Electrum devs or someone in their IRC explained to me that
if you compiled python yourself, then the package manager provided pyqt5 will not work with that. you need to build qt5/pyqt5 for the newly built python the pyqt5 provided by the package manager only works with the python provided by package manager
To me the solution for now is, trying out Ubuntu Mate (Bionic). It has at least a little bit higher version of Python3 from the start: https://packages.ubuntu.com/bionic/python3

If this fails, I'll report back.

User avatar
Imperf3kt
Posts: 2554
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: installing electrum fails on pyqt5

Fri Jun 07, 2019 12:04 am

Have you considered using a virtualenvironment?
https://www.geeksforgeeks.org/creating- ... ows-linux/
55:55:44:44:4C
52:4C:52:42:41

someSven
Posts: 5
Joined: Tue Nov 27, 2018 11:17 am

Re: installing electrum fails on pyqt5

Fri Jun 07, 2019 4:38 am

Imperf3kt wrote:
Fri Jun 07, 2019 12:04 am
Have you considered using a virtualenvironment?
https://www.geeksforgeeks.org/creating- ... ows-linux/
I contemplated it briefly, but I've got no experience with that. I would still need another version of pyQt, and I thought these envouirments are meant as a throw away thing.

Return to “Troubleshooting”