Author

Topic: Electrum 3.3.2: SyntaxError: invalid syntax (Read 391 times)

jr. member
Activity: 55
Merit: 4
December 27, 2018, 12: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)

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.
legendary
Activity: 3682
Merit: 1580
December 26, 2018, 10:35:14 PM
#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.
jr. member
Activity: 55
Merit: 4
December 26, 2018, 09:36:01 PM
#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.
jr. member
Activity: 55
Merit: 4
December 26, 2018, 09:30:59 PM
#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.
legendary
Activity: 3682
Merit: 1580
December 26, 2018, 08:04:55 PM
#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.
jr. member
Activity: 55
Merit: 4
December 26, 2018, 10:45:47 AM
#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..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..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.
legendary
Activity: 2170
Merit: 1789
December 25, 2018, 11:09:29 PM
#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.
legendary
Activity: 3682
Merit: 1580
December 25, 2018, 03:59:49 PM
#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.
legendary
Activity: 2170
Merit: 1789
December 24, 2018, 09:54:58 PM
#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

legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
December 23, 2018, 09:34:15 AM
#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.
jr. member
Activity: 55
Merit: 4
December 23, 2018, 07:25:44 AM
#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 '")
                                                                               ^
SyntaxError: invalid syntax

I appreciate your help in fixing the above issue.
Jump to: