Cannot create `venv` for installing `pytest` on Ubuntu 22.04, as `sudo apt install python3.10-venv` fails

Hello everyone! I want to install pytest according to the documentation. The there-mentioned article about using python -m pip instead of just pip also states:

DO NOT install into your global Python interpreter! ALWAYS try to use an environment when developing locally!

However, when I try setting up the venv on my Ubuntu 22.04 machine using python3 -m venv [my Exercism Python directory], I get:

The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.10-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Trying to run sudo apt install python3-venv:

The following packages have unmet dependencies:
 python3-venv : Depends: python3.8-venv (>= 3.8.2-1~) but it is not going to be installed
                Depends: python3 (= 3.8.2-0ubuntu2) but 3.10.6-1~22.04 is to be installed
                Depends: python3-distutils (>= 3.8.2-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

:man_shrugging: How to proceed from here? Do I even need pytest for exercism test or can I submit the code for testing, before submitting it for good?

Turns out I don’t have to run tests locally; after submitting with exercism submit, the tests are executed.

It might still be useful to run the tests locally – if you work locally and not in the online editor–, so that you don’t need to submit each time you want to see if the tests pass.

The error you received indicates some problems with the set of packages you have installed. There could be problems with your APT source files, check your /etc/apt/sources.list or additional sources in /etc/pat/sources.list.d if you have any. You could try to run a sudo apt-get update ; sudo apt-get install -f to try to fix the broken packages, but by the look of it it probably won’t fix anything unless you found a problem in the source files above.

You might have some problems following an upgrade to 22.04, or perhaps you used some custom Python installation.

In any case, this is not the right forum, I think, for Ubuntu troubles.

You should try to search for a solution on Ubuntu forums, or ask for help there.