Bitcoin Forum
April 20, 2024, 03:22:25 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum 3.3.2: SyntaxError: invalid syntax  (Read 372 times)
tUnes3 (OP)
Jr. Member
*
Offline Offline

Activity: 55
Merit: 4


View Profile
December 23, 2018, 12:25:44 PM
Merited by HCP (1)
 #1

Below are the packages that I have installed to get the previous version 3.2.3 running:

python3-pyqt5
python3-dnspython
python3-pyaes
python3-ecdsa
python3-qrcode
python3-protobuf
python3-jsonrpclib-pelix
python3-socks

As usual I do not want to install Electrum. I just want to be able to run it like:

Code:
python3 run_electrum

I had no problems running 3.2.3 in the above manner but I do encounter the following issue when I try to run 3.3.2:

Code:
File "run_electrum", line 53
    sys.exit(f"Error: {str(e)}. Try 'sudo python3 -m pip install <module-name>'")
                                                                               ^
SyntaxError: invalid syntax

I appreciate your help in fixing the above issue.
1713583345
Hero Member
*
Offline Offline

Posts: 1713583345

View Profile Personal Message (Offline)

Ignore
1713583345
Reply with quote  #2

1713583345
Report to moderator
1713583345
Hero Member
*
Offline Offline

Posts: 1713583345

View Profile Personal Message (Offline)

Ignore
1713583345
Reply with quote  #2

1713583345
Report to moderator
1713583345
Hero Member
*
Offline Offline

Posts: 1713583345

View Profile Personal Message (Offline)

Ignore
1713583345
Reply with quote  #2

1713583345
Report to moderator
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
NeuroticFish
Legendary
*
Offline Offline

Activity: 3654
Merit: 6349


Looking for campaign manager? Contact icopress!


View Profile
December 23, 2018, 02:34:15 PM
Merited by Abdussamad (1)
 #2

Code:
SyntaxError: invalid syntax

One of the things I've seen is that "The minimum python version was increased to 3.6" in Electrum 3.3.0.
Maybe I'm completely wrong, since I'm far from best with Linux, but this is what I'd start with when checking.
I don't know if "sudo apt-get install python3-setuptools python3-pyqt5 python3-pip" does actually re-install the dependencies, but this can also be an idea.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
joniboini
Legendary
*
Offline Offline

Activity: 2170
Merit: 1789



View Profile WWW
December 25, 2018, 02:54:58 AM
Last edit: December 26, 2018, 04:10:28 AM by joniboini
 #3

AFAIK invalid syntax means there is no command registered with "run_electrum" by phyton3. It means python can't find any program/file/command named "run_electrum" from your working directory, installed module or path variable. I don't think this is dependency issues.

Update: The problem is missing dependencies, update your phyton.

Where did you try to run the command? From the desktop?
Try to run the command from the Electrum files folder that you've downloaded. Download the latest electrum package, it contains a file named "run_electrum". This is what executed by that command.

You can simply use this command to run Electrum from the root directory:
Code:
./run_electrum


███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
December 25, 2018, 08:59:49 PM
Merited by joniboini (1)
 #4

AFAIK invalid syntax means there is no command registered with "run_electrum" by phyton3. It means python can't find any program/file/command named "run_electrum" from your working directory, installed module or path variable. I don't think this is dependency issues.


That's not what it means. It means the python interpreter he has does not think the code is correct. That's because he's using an older version of python as NeuroticFish pointed out above. He needs to update to python 3.6 or stick with electrum 3.2.3.
joniboini
Legendary
*
Offline Offline

Activity: 2170
Merit: 1789



View Profile WWW
December 26, 2018, 04:09:29 AM
 #5

That's not what it means. It means the python interpreter he has does not think the code is correct. That's because he's using an older version of python as NeuroticFish pointed out above. He needs to update to python 3.6 or stick with electrum 3.2.3.

Thanks for correcting me. I just try it by myself and the error case is different. Silly me. Needs to learn more.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
tUnes3 (OP)
Jr. Member
*
Offline Offline

Activity: 55
Merit: 4


View Profile
December 26, 2018, 03:45:47 PM
Last edit: December 26, 2018, 08:08:45 PM by tUnes3
Merited by o_e_l_e_o (1)
 #6


One of the things I've seen is that "The minimum python version was increased to 3.6" in Electrum 3.3.0.
Maybe I'm completely wrong, since I'm far from best with Linux, but this is what I'd start with when checking.




That's not what it means. It means the python interpreter he has does not think the code is correct. That's because he's using an older version of python as NeuroticFish pointed out above. He needs to update to python 3.6 or stick with electrum 3.2.3.

This is how I built Python 3.7.2 from source on Debian Stretch

The steps:

1. Update all system packages first

Code:
sudo apt-get update && sudo apt-get upgrade
2. Install the required build tools for Python 3.7.2

Code:
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
sudo apt-get install -y libncurses5-dev  libncursesw5-dev xz-utils tk-dev
3. Download the latest version 3.7.2 source file and its SIG file using wget

Code:
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz.asc

4. Verify the authenticity of the source file

Code:
gpg -v Python-3.7.2.tgz.asc

5. Unpack the source file

Code:
tar xvf Python-3.7.2.tgz

6. Enter the Python-3.7.2 directory and run ‘./configure’ to prepare the build

Code:
cd Python-3.7.2
./configure --enable-optimizations

7. Run the following command to build Python 3.7.2

Code:
make -j 8

8. Run the following command to install Python 3.7.2

Code:
sudo make altinstall

9. Reboot the machine

After installing Python 3.7.2, below are the steps that I took to run Electrum 3.3.2:

9. Go to the folder where the downloaded file Electrum-3.3.2.tar.gz is

10. Unpack the gzipped file

11. Go to the directory where run_electrum is located

12. Type python3.7 run_electrum in a terminal

13. The following error appears:

Code:
Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'
/usr/local/lib/python3.7/asyncio/events.py:88: RuntimeWarning: coroutine 'ignore_exceptions.<locals>.wrapper' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

14. I went back to Step 8 and instead of altinstall, I typed the command:

Code:
sudo make install

and rebooted the machine. This time Python3.7 is the default on my Debian Stretch

15. I typed the command python3.7 run_electrum and the same error message appeared:

Code:
Error: Could not import PyQt5 on Linux systems, you may try 'sudo apt-get install python3-pyqt5'
/usr/local/lib/python3.7/asyncio/events.py:88: RuntimeWarning: coroutine 'ignore_exceptions.<locals>.wrapper' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Please note that python3-pyqt5 has already been installed when I was using version 3.2.3

Thomas (developer): If you are reading this post, could you help me out please?

By the way, season's greetings to all of the folks here.
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
December 27, 2018, 01:04:55 AM
Merited by xtraelv (1)
 #7

The pyqt5 you have is for the version of python that comes with debian not the one you just installed. This is why you don't install from source if you can help it. It makes dealing with dependencies and maintaining the system harder.

My suggestion is that you add debian testing to your list of repos and install pyqt5 from there. It has the updated version. If that doesn't work remove the python version you installed from source and then install the one on testing.

You can use your apt preferences file to only install certain packages from testing repos.
tUnes3 (OP)
Jr. Member
*
Offline Offline

Activity: 55
Merit: 4


View Profile
December 27, 2018, 02:30:59 AM
 #8

Few suggestion :
1. Force reinstall python3-pyqt5 package
2. Purge (not remove) and install python3-pyqt5 package
3. Make sure you have rwx permission to use the package (i think it's most likely case)

I had done that before you wrote the above post. It does not work.
tUnes3 (OP)
Jr. Member
*
Offline Offline

Activity: 55
Merit: 4


View Profile
December 27, 2018, 02:36:01 AM
 #9


My suggestion is that you add debian testing to your list of repos and install pyqt5 from there. It has the updated version. If that doesn't work remove the python version you installed from source and then install the one on testing.

You can use your apt preferences file to only install certain packages from testing repos.


Thanks for your reply.

Below is the advice from Debian (paragraph lifted from "Don't make a FrankenDebian" https://wiki.debian.org/DontBreakDebian):

Quote
Debian Stable should not be combined with other releases. If you're trying to install software that isn't available in the current Debian Stable release, it's not a good idea to add repositories for other Debian releases. The problems might not happen right away, but the next time you install updates.

The reason things can break is because the software packaged for one Debian release is built to be compatible with the rest of the software for that release. For example, installing packages from buster on a stretch system could also install newer versions of core libraries including libc6. This results in a system that is not testing or stable but a broken mix of the two.

Repositories that can create a FrankenDebian if used with Debian Stable:

    Debian testing release (currently buster)

    Debian unstable release (also known as sid)

    Ubuntu, Mint or other derivative repositories are not compatible with Debian!

    Ubuntu PPAs

Conclusion: I will just not use Electrum 3.3.2 on my Debian system.
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
December 27, 2018, 03:35:14 AM
 #10


My suggestion is that you add debian testing to your list of repos and install pyqt5 from there. It has the updated version. If that doesn't work remove the python version you installed from source and then install the one on testing.

You can use your apt preferences file to only install certain packages from testing repos.


Thanks for your reply.

Below is the advice from Debian (paragraph lifted from "Don't make a FrankenDebian" https://wiki.debian.org/DontBreakDebian):

Quote
Debian Stable should not be combined with other releases. If you're trying to install software that isn't available in the current Debian Stable release, it's not a good idea to add repositories for other Debian releases. The problems might not happen right away, but the next time you install updates.

The reason things can break is because the software packaged for one Debian release is built to be compatible with the rest of the software for that release. For example, installing packages from buster on a stretch system could also install newer versions of core libraries including libc6. This results in a system that is not testing or stable but a broken mix of the two.

Repositories that can create a FrankenDebian if used with Debian Stable:

    Debian testing release (currently buster)

    Debian unstable release (also known as sid)

    Ubuntu, Mint or other derivative repositories are not compatible with Debian!

    Ubuntu PPAs

Conclusion: I will just not use Electrum 3.3.2 on my Debian system.

Yes there's a slight risk mixing repos like that but it's a lot less than installing from source. It's in fact quite common to use some packages from testing because debian tends to have pretty old packages in stable. I suggest asking on debian forums if you don't believe me. Also note that testing is what's going to eventually become the new stable version so you'll be upgrading to it anyway.
tUnes3 (OP)
Jr. Member
*
Offline Offline

Activity: 55
Merit: 4


View Profile
December 27, 2018, 05:17:20 AM
 #11


Yes there's a slight risk mixing repos like that but it's a lot less than installing from source. It's in fact quite common to use some packages from testing because debian tends to have pretty old packages in stable. I suggest asking on debian forums if you don't believe me.

About installing from source on Debian systems, here's the advice from Debian (below paragraph lifted from "'make install' can conflict with packages" https://wiki.debian.org/DontBreakDebian)

Quote
It's quite easy to compile software from source code tarballs downloaded from the software's website, but not always so easy to remove it later. Often the instructions that come with the source code include instructions to use commands like ./configure && make && make install.

When you install software this way, you will not be able to remove it with apt-get or Synaptic. The APT packaging system can only remove software that was installed by the APT packaging system. Even worse, software installed this way can sometimes conflict with the software packaged for Debian.

Software installed this way also does not benefit from security updates the way that Debian packages do. If you want to keep your system up to date without having to manually compile and reinstall for every update, stick to the Debian packages.

The make install script may make invalid assumptions about where the compiled binary and its associated files should exist in the filesystem and under what set of permissions / ownership it should run. Software installed this way could also replace important software vital to system and package maintenance, making it difficult to repair your system using standard Debian tools.

Thanks for your suggestion. I have decided to stick with Debian Stable and its packages, including from stretch-backports.

On Debian forums, Debian developers have always advised against using Frakenbuilds.

Also note that testing is what's going to eventually become the new stable version so you'll be upgrading to it anyway.

Yes, you are right.

As a general rule of thumb, Debian stable releases are on a two-year cycle. Debian Stretch (9.0) is currently on its last leg of being the stable release. If everything goes smoothly, we can expect Debian Buster (currently known as Debian Testing) to be released in May 2019.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!