1

I have gotten these consecutive errors, despite having properly installed the required dev libs and the venv lib.

here is the consecutive output in terminal.

~/Desktop/virtualenvs$ python3.8 -m venv newpy38
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-get install python3-venv

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

Failing command: ['/home/dji/Desktop/virtualenvs/newpy38/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

When i run sudo apt-get to ascertain i have installed the venv library

~/Desktop/virtualenvs$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 458 not upgraded.

When i run sudo apt-get to ascertain, again, i have installed the venv library

~/Desktop/virtualenvs$ sudo apt-get install python3.8-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.8-venv is already the newest version (3.8.0-3~18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 458 not upgraded.

I have also tried the following links but to no avail:

  1. python3.8-venv not working with python3.8 -m venv env
  2. pyvenv not working because ensurepip is not available
  3. I have also resetted by locales with "sudo dpkg-reconfigure locales" as in https://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them. But this is likely unrelated.

=== Update === Somehow, uninstalling and reinstalling python solved this venv issue. I am also not sure why.

fatbringer
  • 348
  • 2
  • 9
  • 19
  • Based on `/home/dji/Desktop/virtualenvs/newpy38/bin/python3.8` you already have a virtualenv enabled. – AKX Nov 01 '21 at 08:36
  • Yes the directory is created. But i am unable to perform source/bin activate. It says file not found. Also, thank you for helping me reformat. I tried to use inverted commas but it didn't work. – fatbringer Nov 02 '21 at 14:37
  • You don't need to activate a venv when you already have one active. – AKX Nov 02 '21 at 15:23
  • Hi yes i understand that. But there wasn't an active venv. I named my venv "newpy38", and there wasn't a (newpy38) at the start of the terminal line. In the end it seemed like reinstalling python solved the whole thing. – fatbringer Nov 05 '21 at 05:49
  • Hi i actually ended up re-flashing my embedded computer's OS and it is ok. Of course, while this is a blanket solution, I believe i had broken my python installation with poor usage of sudo apt-get autoremove. Thanks for spending time on this though ! – fatbringer Nov 08 '21 at 06:26

1 Answers1

0

Turns out this was because of a broken python installation ! Due to poor (and un-careful) usage of sudo apt-get update sudo apt-get autoremove, i ended up with a broken installation of python, which was unable to properly find its installed libraries

I reinstalled python and it is ok now.

EXTRA NOTE: As i am using this on an embedded computer (dji manifold2g), some users may not have that easy option of reinstalling python. Re-flashing the whole firmware (which comes pre-installed with python) might actually be more helpful, albeit more inconvenient.

fatbringer
  • 348
  • 2
  • 9
  • 19