ensurepip is disabled in Debian/Ubuntu for the system python
There is a related bug report here
ensurepip component is missing/disabled on Ubuntu
The way around it is to create a virtual environment without pip
python3 -m venv myvenv --without-pip
ensurepip component isn't called and a new environment is created in this case.
However missing pip in virtual environment can be a problem.
One solution is to install system pip3 package and use system pip module inside your virtual environment directly.
Virtual environment has to have access to system site packages to be able to use system pip module.
-
install system python3 pip package
sudo apt-get install python3-pip
-
create virtual environment without pip and with access to system site packages
python3 -m venv myvenv --without-pip --system-site-packages
You can use system pip module to install python packages into your virtual environment now.
Instead of pip install Django
you have to use explicit
myvenv/bin/python3 -m pip install Django
or you may activate your virtual environment first
source myvenv/bin/activate
python3 -m pip install Django
python3 -m pip --version
may comes handy to see which python environment is used.
Based on solution found here, but don't use proposed python get-pip.py
in virtual environment, because it will steal system pip
command
I had the same problem and installing python3-venv
as instructed was not solving the ensurepip
unavailability issue! However, since my python3 version is 3.7.5
installing
python3.7-venv` instead solved my issue.
Anaconda involucred
If you are using Anaconda or Conda this solution may help you:
Conda manages python itself as a package, so that conda update python is possible, in contrast to pip, which only manages Python packages. Conda is available in Anaconda and Miniconda (an easy-to-install download with just Python and conda).
very disturbing for me but well, hands to the keyboard in a terminal window:
conda update python
Look at this picture the result, maybe this help you, have a nice day!