Installing via python: pip3 externally managed environment

Hello everyone!
I’m new to the Qubes Community and loving the OS so far :slight_smile:
I’d like to experiment a bit with the Specter Bitcoin wallet in an isolated environment and thus tried to install it using python as recommended here:

Now I always get an error that this environment is externally managed. I’m not sure what’s the proper way to solve this since I lack experience here, expecially with Qubes. Can someone help me out?

Thanks in advance!

That’s not a Qubes issue. Python uses PEP 668 on Debian, which gives the error you see.

If you still want to do things the old way, you can move the following file:

sudo mv /usr/lib/python3.11/EXTERNALLY-MANAGED ~/

Or use this option when installing a package: --break-system-packages

1 Like

Thank you! Can you tell me more about the implications and risks of the different approaches?
Is it different for Fedora and might it make more sense to use such a template for this use case?

The difference is that it installs the package system-wide instead of isolating it to a specific environment (venv) and could “break” system packages installed in other ways, like apt. Installing system-wide could be a problem on a classic system if a package is malicious, but in the case of Qubes, a specific qube is used for the package, so the impact is quite limited.

Fedora doesn’t have PEP 668 enforced last time I checked. If you think it’s easier for you to use, then you can try it.

1 Like

Thanks a bunch!

1 Like

@Bits , take a look at pyenv.

2 Likes

Same issue on Fedora.

What actually does ```
sudo mv /usr/lib/python3.11/EXTERNALLY-MANAGED ~/

The linked topic is about Whonix and not Fedora, so which one do you need?

It’s removing the marker:

As described in detail in the next section, the first behavior change involves creating a marker file named EXTERNALLY-MANAGED, whose presence indicates that non-virtual-environment package installations are managed by some means external to Python, such as a distro’s package manager.