How to UPdate all Python-packages (pip) in one sweep?

I’m using Python3 from MANJARO-Repository and over the time installed a bunch of Pathon-packages using pip. For some issue I have been asked to update those packages and tried to update all at once using

$ pip list --outdated    # got a bunch of packages here
$ pip list --outdated | tail -n +3 | cut -d' ' -f 1 | xargs -n 1 pip install --upgrade

This worked, but after that I fired again:

$ pip list --outdated
Package            Version Latest Type
------------------ ------- ------ -----
wxPython           4.1.1   4.2.0  sdist

So I found, that wxPython and few other packages have been installed from the repository (using pamac). So my Question: What is the recommended way to update my pip-packages?

You shouldn’t.

Use a virtual environment for your projects and maintain it using a requirements.txt (or poetry).

Then you can do a pip install -U -r requirements.txt and your dependencies are updated.

Thank you @mithrial, but this will be very cumbersome: I’m using a Python-application almost daily and would waste a lot of time, to start the virtual machine only for this. So I would appreciate to learn abot the reason or about potential problems, doing it my way.

I didn’t say virtual machine but virtual environment.

Sorry @mithrial, you are absolutely right! But I never heard before about a “virtual environment”. Actually I’m trying to understand, whta it is and how to use it. But: This descriptions gives me more questions than answers …

by default, pamac install in systeme, by default pip Intall in home (read doc) and, virtual environment is in home and in the project directory

Python packages installed using the package manager has the package name prefixed with python-.

Those will be updated when an update is available in the repos.

Installing packages using pip should be installed using the --user argument or as pointed out use a virtual environment.

install the package python-virtualenvwrapper - source the initializer and you are good to go.

A python editor like PyCharm can pick up your various environments or you can use the wrapper handle it


Thanks a lot @linux-aarhus for these valuable and understandable informations. I will work this way…