Problem with install Electrumx - Python: no 'encodings' module

I’m trying to install Qubenix instructions Electrumx

Create a virtual environment:

electrumx@host:/home/user $ virtualenv -p python3 ~/exvenv

created a CPython3.9.2.final.0-64 virtual environment in 798 ms
CPython3Posix creator(dest=/home/electrumx/exvenv, clear=False, no_vcs_ignore=False, global=False)
seeder from AppData(upload=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/electrumx/.local/share/virtualenv)
added source packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
activators BashActivator,CShellActivator,FishActivator,powersellactivator,PythonActivator,XonshActivator Activator

Link the installed packages to the virtual environment: (my Python version is 3.9)

electrumx@host:/home/user $ ln -s /usr/lib/python3/dist packages/* ~/exvenv/lib/python3.9/site packages/
ln: failed to create symbolic link '/home/electrumx/exvenv/lib/python3.9/site-packages/pip': The file exists
ln: failed to create symbolic link '/home/electrumx/exvenv/lib/python3.9/site-packages/pkg_resources': File exists
ln: failed to create symbolic link '/home/electrumx/exvenv/lib/python3.9/site-packages/setuptools': File exists
ln: failed to create symbolic link '/home/electrumx/exvenv/lib/python3.9/site-packages/wheel': File exists

At the end, I start the server and run

sudo journalctl -fu electrumx

January 25, 13:33:39 python host[3796]: ModuleNotFoundError error: there is no module named 'encodings'
January 25, 13:33:39 python host[3796]: Current thread 0x00007dc3ce8ac740 (last call first):
January 25, 13:33:39 python host[3796]: <no Python frame>
January 25, 13:33:39 host systemd[1]: electrumx.service: Main process completed, code=completed, status=1/FAILED
January 25, 13:33:39 host systemd[1]: electrumx.service: Failure with the result "exit code".
January 25, 13:33:40 host systemd[1]: electrumx.service: Scheduled restart job, restart counter is 5.
January 25, 13:33:40 host systemd[1]: Electrumx daemon stopped.
January 25, 13:33:40 host systemd[1]: electrumx.service: The startup request is repeated too fast.
January 25, 13:33:40 host systemd[1]: electrumx.service: Failure with the result "exit code".
January 25, 13:33:40 host systemd[1]: Failed to start Electrumx daemon.

I suppose that the problem is in the Python version.
I install dependencies in the Whonix-ws-16 Template with the commands
sudo apt update && sudo apt install -y python3-virtualenv python3-aiohttp

Hi @qubesplayer, welcome to the forum! I have added some Markdown formatting to make your post easier to read. I hope you don’t mind :slight_smile: .

1 Like

Thanks!

1 Like

This issue is not QubesOS related, so you should be able to solve it with a simple web search.

That said, the python3-virtualenv available on Debian 11 (and Whonix 16) is vastly outdated. Try removing it and installing an updated version. Pick your preferred method:

  1. Install it with pip
  2. Download the deb from bookworm Debian -- Details of package python3-virtualenv in bookworm
  3. [recommended] use apt pinning to install the bookworm version of python3-virtualenv with the apt package manager. A bit more complicated but there are plenty of resources online.

Thank you for your answer.
I’m a beginner and quite possibly wrong.
I am installing the latest version of Electrum 1.16.
When installing from the standard repository Template Whonix-ws-16 based on Debian 11, I have Python 3.9 (in the instructions qubenix - Python3.7) that is, I have a newer version and I thought it was compatible. from an earlier one.
I also tried to install Electrum version 1.15 (as in the qubenix instructions), however, I got the same result.

Maybe someone is willing to help on a paid basis?
Adapt the qubenix instruction for the current version of ElectrumX and Qubes-Whonix?

Have you tried updating python3-virtualenv to the latest version according to my suggestion?

Unfortunately, I just don’t know how to do it…
Maybe you can give me instructions?