0

I have globally installed pip 21.2.4, but each time that I create a Virtual Environment an install a module I get the following warning:

WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.

Then I update the pip version in the Virtual Environment as follow:

$ pip3 install --upgrade pip==21.2.4

But this change is only for this Virtual Environment and I have to repeat the same process each time I create a new Virtual Environment.

How could I do for all new Virtual Environments created used the latest pip version as I have globally?

5
  • What command do you use to create the virtual environment? What Python version do you use to create the virtual environment? Commented Aug 24, 2021 at 8:39
  • I use the following command: python3 -m venv postgres-workspace But when I activate the virtual environment the following command: $ which python Returns: postgres-workspace/bin/python Commented Aug 24, 2021 at 8:54
  • 1
    What is your version of Python (python3 -V)? Assuming it is a recent enough version of Python (3.9+), you should be able to use the following command python3 -m venv --upgrade-deps postgres-workspace, this will create a virtual environment as usual then update both pip and setuptools in that environment. But you need to use the flag for each creation. Commented Aug 24, 2021 at 9:06
  • @sinoroc I have Python 3.9.6. Your solution is right, in this way there is no warning. Thank you very much for your help. It's not possible for me to mark your answer as the right one because it is in a comment, if you write it in an answer I could mark it as correct. Commented Aug 24, 2021 at 9:16
  • stackoverflow.com/a/56229305/7976758 Found in stackoverflow.com/search?q=%5Bpip%5D+%5Bvirtualenv%5D+version Commented Aug 24, 2021 at 14:25

2 Answers 2

0

Since Python 3.9 the venv command line utility has a --upgrade-deps option, which will force the udpdate of pip and setuptools within the newly created virtual environment. For example:

path/to/python3.9 -m venv --upgrade-deps something 

Related:

Sign up to request clarification or add additional context in comments.

Comments

0

changing your python version would certainly do it.

1 Comment

Hi @Iska, Could you please explain it with more details? I really don't know what you mean.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.