Post
Topic
Board Electrum
Re: Electrum on debian 12
by
Learn Bitcoin
on 12/10/2023, 00:36:06 UTC
I suggest instead of changing your system-wide installation sources, you better manually install Electrum with its own installation tutorial. Go to https://electrum.org/#download, on "Installation from Python sources" go ahead with "Install with PIP:"

Code:
sudo apt-get install python3-pyqt5 libsecp256k1-dev python3-cryptography python3-setuptools python3-pip
 wget https://download.electrum.org/4.4.6/Electrum-4.4.6.tar.gz
 wget https://download.electrum.org/4.4.6/Electrum-4.4.6.tar.gz.asc
 gpg --verify Electrum-4.4.6.tar.gz.asc
 python3 -m pip install --user Electrum-4.4.6.tar.gz
-snip-

I don't know what's wrong with my system. But I always end up getting this error. See the image below, please.



If I understand correctly, the problem is with Python. I searched with this error message on the internet and I got a few results. One answer is "Your distribution is trying to protect you against mixing apt provided packages and pip provided packages. Mixing two package managers (apt and pip here) is always a bad idea and the source of many issues.

PEP 668 is a way for distributions to explicitly tell users to avoid falling into this pitfall. Your distribution told you three solutions in the message, but only the 2nd one applies cleanly to your use case"


    Using apt install python3-xxx. It does not cleanly apply for you as you're having a requirements.txt, not a single dependency. It would work if you have only a few requirements in the file and can do it manually for each, like apt install python3-xxx python3-yyy python3-zzz. In this case there's no weird mixing of package managers: you installed python3 using apt, you're installing your dependencies using apt: no surprises.
    Using a venv: python3 -m venv .venv then source .venv/bin/activate, then pip install -r requirements.txt. In this case the installation is contained inside the .venv directory: no mixing of what apt does and what pip does, no surprises.
    Using pipx which does not cleanly apply to your case, pipx is good to install and use a program, like pipx install black, but here you need to install libraries listed in a requirement file, not a program.

There's another way, that I often use myself because I often need multiple different Python versions:

    Use a Python not provided by your distribution, so it does not mess with apt installed things and does not adopt PEP 668. I often compile many Python interpreters myself using a short bash function which use a --prefix=~/.local/, for testing purposes. With those Pythons I use either a venv either a good old pip install, in this case pip will install it in ~/.local/, again no clash between apt and pip, no bad surprises.

[1]


Not sure If I understood anything.


[1] https://stackoverflow.com/questions/75602063/pip-install-r-requirements-txt-is-failing-this-environment-is-externally-mana