LINUX

How to Solve 'Errors Were Encountered While Processing: python3' Failed Package Installation on Linux

Riyad Murad1 min read
Linux package manager cover

Introduction

Encountering the error 'Errors were encountered while processing: python3' during a package installation in Linux can be frustrating. Luckily, this issue is usually straightforward to fix. In this post, we'll walk you through the steps needed to clear this error so you can get back to your work. Follow along, and you'll resolve this in no time!

If you got "Could not get lock /var/cache/apt/archives/lock. It is held by process...", you can use this guide to solve your issue :)

Python package install lock/process error message

Step 1: Kill the Process

You need to terminate the process which was displayed in the error message. Execute the command below:

bash
sudo kill 2618

Step 2: Check for Lock Files

To check whether the lock still existing, use the following command:

bash
ls /var/cache/apt/archives/lock

Checking whether apt lock file still exists

Step 3: Remove Lock Files

To remove the lock file found in the previous step, use:

bash
sudo rm /var/cache/apt/archives/lock

Step 4: Run Package Installer again

Finally, rerun the package installer again:

bash
sudo apt upgrade --autoremove

Successful apt run after lock cleanup

That's it, now it's working again :)