Update Python Packages (PIP)

We’ve had a run of Python packages recently and you can tell that I’m a fan because today we will discuss how to update Python packages that were installed via PIP. This should be a pretty easy article to follow along with.

Before diving into the world of installing Python packages from a centralized repository (via PIP), you should probably be familiar with the entire process. So, read these two articles before proceeding:

Install Python’s PIP Part One

And then follow up with this article:

Install Python’s PIP Part Two

It’s important to upgrade the packages you’ve installed with PIP. All software requires updates. Bugs are fixed with newer software but, more importantly, security issues are addressed with updates. This doesn’t just apply to Python. It applies to your whole computer. Software gets updated and you need to apply those updates.

So, today we’re going to do some maintenance and we’re going to update Python packages. Rather than waste time with a long intro, let’s get started!

Update Python Packages:

Just so you know, Python packages are installed in the terminal. So, it stands to reason that updates are also done in the terminal. To follow along in this article, you will need an open terminal. So, if you want to update Python packages you should start by opening a terminal. You can usually just CTRL + ALT + T to open your default terminal emulator.

With your terminal open, let’s first ensure PIP is installed with this command:

Next, make sure PIP is updated to the newest version:

With PIP upgraded to the most current version, you can check to see which Python packages you have previously installed. That’s done like this:

Now, you can see which packages can be updated to newer packages:

That will give you an output similar to this:

Now, you can update the packages, like so:

You can also do multiple packages at the same time:

By doing this, you can update your Python packages, at least those installed via PIP. That is indeed pretty easy.

However, I have a command that I certainly didn’t come up with. This is a command I found in my notes and I do not see a reference URL – or I’d cite the source. Doing some searching, I saw that this command is referenced at multiple sites. So, finding the source is problematic for me.

If you want to upgrade all the Python packages at once, try this command:

I tested this and it appears to work well enough. PIP does love to throw errors in the terminal but generally works okay. That command should update all the packages you’ve installed with PIP – including any Python dependencies that were installed at the same time.

See? It’s pretty easy to update Python packages…

Closure:

Well, now you know how to update Python packages. I figured that this was an important article to write. If you’re going to use PIP to install Python packages, you might as well know how to keep yourself secure and how to keep yourself updated. That seemed reasonable.

However, my Python skills aren’t that great. I can do a Hello World program and that’s about it. I haven’t even done that in a while. So, don’t go asking me detailed Python questions! I probably won’t have an answer. My use is pretty limited to things I can trivially install with PIP.

Also, you may not want to ask me questions. While I’ll be polite, my time is constrained these days. I’m just as likely to refer you to a forum or two. You can ask questions. If they’re good, I’ll maybe answer them in an article. I’m just pointing out that you shouldn’t expect too much from me.

“If you don’t expect too much from me, you might not be let down.”

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Disable Ubuntu Snaps

People have a variety of reasons why they want to disable and remove Snap apps from Ubuntu. It’s relatively easy to disable Snaps and this article shows you how.

Let’s start with the basics. What is a Snap? It’s another form of packaging software and Canonical’s Snapcraft page describes it like this:

Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store, the app store for Linux with an audience of millions.

Canonical is the company that makes Ubuntu and if you’ve been using Linux for any length of time, you’ve probably heard of them and Snaps. The reality is that, if you want to use Ubuntu or official Ubuntu flavors, you might want to make your peace with them. They’re going to be everywhere.

Right now, you can find Snaps being more or less mandatory in current Ubuntu Core versions. If you want to use Livepatch to keep your running system protected then you’ll need to use snaps. The list of places Snaps are in use goes on, but more and more applications are being packaged exclusively as Snaps and that trend looks likely to continue.

To be frank, I can’t blame the developers. Package it once and it runs everywhere – or it can run everywhere. This saves time, presents a single point of contact, and helps to ensure uniformity across the myriad distros out there. It does away with things like ‘Dependency Hell’. It even makes it more secure.

In an ideal world, it’d be great!  Maybe you don’t live in that ideal world? Maybe you don’t want Snaps? I don’t need to know your reason. Let’s just disable them.

Removing/Disabling Snaps

Let’s start by cracking open your terminal. You’re gonna want to start there for this. It’s as easy as using your keyboard to press CTRL + ALT + T. Then, enter the following commands into your terminal, one by one and pressing ENTER after each one:

The first command will completely purge ‘snapd’ – the service that controls and installs Snaps. The next three commands remove any remnants of Snaps that you have on your system. The final command will reboot your system, so that everything is cleared out of memory and so that you start fresh and without Snaps.

And, there you go. You can disable Ubuntu snaps! You’re Snap free! Everything is now just as you wanted it. You no longer have any Snaps on your system, nor do you have to worry about installing them by mistake. 

At the same time, it may well be time for dedicated Ubuntu users to adjust and learn to use Snaps. They do have their benefits. They do things like auto-update, automatically revert to the previous version if it’s broken, and keep applications isolated from the rest of the system. For the most part, they just work, without you needing to worry about anything.

So, before you decide to completely remove Snaps from your system, you might just want to take a minute to make peace with them and learn to use them. Yeah, they take up more space, their permissions are wonky, and they’re still a work in progress. You’re probably going to end up using them eventually. The sooner you get used to managing them, the easier it’s probably going to be.

Anyhow, thanks for reading. I appreciate the readers and welcome you to contribute. There’s a whole host of ways you can do so, from joining to donating. You can even write articles without registering, share this article at your favorite sites, and you can sign up for the newsletter so that you know you’re getting these articles (and no spam) in your inbox.

Use an RPM on a DEB-based System

Once in a while, you’ll come across a piece software that’s only in RPM format. It’s possible to convert RPM to DEB and you may be able to install that software on your DEB-based system.

You’ll find that it’s not unusual to come across software packaged in a format that you can’t use. That’s just the name of the game. Developers and package maintainers are going to concentrate on the stuff they themselves use. It’s not selfishness that prevents them from packaging it in different formats, it’s just a matter of time and priorities. 

It’s times like these when you can use a nifty little tool called ‘alien‘. Alien has been around for a long time and is really useful. It can actually be used in both directions, converting between .deb and .rpm interchangeably. 

Convert With ‘alien’

So, let’s get started. This won’t take very long and will be a valuable tool for your tool-chest. If you don’t need it today, put it aside for a future date. As you progress along your Learning Linux Journey, it may well prove valuable.

As you know, the tool we’ll be using is ‘alien’ and the man-page defines it as this:

alien – Convert or install an alien binary package

You’ll install it with your package manager. As we’re using an apt-based system, we’ll be using apt to install the software. Crack open your terminal with CTRL + ALT + T and enter the following:

That’s going to pull in quite a few dependencies. On a stock Lubuntu installation, it pulls in about 200 MB worth dependencies, so you should be aware of this.

Now that you have it installed, there are a couple of ways you are most likely to use it. The first, given that we’re talking about Debian/Ubuntu/derivatives, would be converting an .rpm to a .deb. That’s pretty easy. Just do this:

That will convert the package to .deb and you can install it in the normal ways. Seeing as you’re right there in the terminal already, you can just use:

You can skip all that and do the conversion and installation all at the same time. To do this, you simply use the -i switch. It looks like this:

NOTE: This won’t always work. The package you converted may not work, usually due to dependencies that can’t be satisfied. If it doesn’t work, you’ll have to look for other solutions.

If you want to go the other direction, you can use this:

There are other ways to use alien, but those are the most common ways that I see it being used – and the ways I’ve historically used it. It has been effective most of the times I’ve tried it, but I am just a single data point and anecdotes aren’t really data.

If you’re interested in other uses (such as tgz or slp), you can consult the man-page or read the online man page. It’s a fairly versatile application and one that all Linux users should know about.

Once again, thanks for reading. Don’t forget that there’s a newsletter and that you can now donate to help cover any hosting costs. If you want to contribute, there are all sorts of ways that you can help – just let me know.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.