3

I'm not able to create any virtual environments for python 3.8 after upgrading to Pop OS 21.04. Getting the following error -

sudo apt-get install python3.8-venv
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python3.8-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python3.8-venv' has no installation candidate

I have already tried adding deadsnakes repo (blog post). Unfortunately, it isn't helping. Also, I found the following info -

apt show python3.8
Package: python3.8
Version: 3.8.10-0ubuntu1~20.10.1
Status: install ok installed
Priority: important
Section: python
Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Installed-Size: 521 kB
Depends: python3.8-minimal (= 3.8.10-0ubuntu1~20.10.1), libpython3.8-stdlib (= 3.8.10-0ubuntu1~20.10.1), mime-support
Suggests: python3.8-venv, python3.8-doc, binutils
Breaks: python3-all (<< 3.6.5~rc1-1), python3-dev (<< 3.6.5~rc1-1), python3-venv (<< 3.6.5-2)
Download-Size: unknown
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: Interactive high-level object-oriented language (version 3.8)
 Python is a high-level, interactive, object-oriented language. Its 3.8 version
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.

The Apt-Sources item seems a bit strange to me. The default python version is 3.9.5 in the updated system.

Any idea how this can be resolved ?

sophros
  • 14,672
  • 11
  • 46
  • 75
BotKnight
  • 93
  • 2
  • 7

3 Answers3

0

PyCharm 2021.1.3 Community Edition
Pop!_OS 21.04
Python 3.9.5

Had exact same issue. This worked for me: When creating a new project and making a new venv, select python3.9 as the base interpreter (3.8 was the default selection for me).

I can recreate this error by selecting python3.8 when creating a new project.

After receiving the error, I went into directory and deleted the contents of the venv directory. In PyCharm I went to Settings --> Project: [project_name] --> Python Interpreter and created a new venv with python3.9 and no errors, packages install.

Subsequently, I created new projects making sure that python3.9 is selected instead of python3.8 and I do not get errors, additional packages install without issue.

0

for pop os 21.04

default python version is 3.9.5

it need make install below

sudo apt install python3.9-venv -y
Sylvain P
  • 11
  • 1
-1

venv is part of the standard library as of Python 3.6. You do not need to install it. Just call:

python3.8 -m venv /path/to/new/virtual/environment
sophros
  • 14,672
  • 11
  • 46
  • 75
  • 1
    I wish it had solved the problem - already tried this. `python3.8 -m venv 38_myenv 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.8-venv You may need to use sudo with that command. After installing the python3-venv package, recreate your virtual environment. Failing command: ['/home/.../38_myenv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']` – BotKnight Jul 01 '21 at 14:23
  • Interesting.... looks a bit like a vicious cycle. Unless you are able to make `ensurepip` available or [fix the environment some other way](https://stackoverflow.com/a/39539571/6573902). – sophros Jul 01 '21 at 15:18
  • Already tried the locale solution, it didn't work. And I can't get `ensurepip` to install for python3.8. BTW can you throw some light on `Apt-Sources` item ? Seems a bit strange to me. I tried changing it via `apt edit-sources python3.8` but it seems I'm getting the format wrong resulting in a parsing error. – BotKnight Jul 02 '21 at 02:12