Ubuntu is a free, Linux-based open source operating system with a long list of releases. When you first log in to an Ubuntu system, it is always a good idea to check the version of Ubuntu on the machine before you do anything on it. Finding which version of Ubuntu runs on your system may be essential to fix problems or seek installation guides. In this tutorial, we’ll show you several ways to find your Ubuntu version using the command line or from the graphical interface.
Python is an emerging language in the developer field. It’s great as first language because it’s concise, easy to read, fast enough for most tasks and has a large ecosystem which fits mostly everything from web development to scientific programming.
Back then when I was new to Python, one of the thing that frustrates me the most was IndentationError: unindent does not match any outer indentation level. Look at how it made people pull their hair out :
Fixing this error is easy, and should be easy, but to understand why it happens so that you can write clean, concise, maintainable code requires more reading.
Python is a popular general purpose programming language that can be used to serve many different use cases. Created by Guido van Rossum with the name inspired from British comedy show Monty Python, it was set out to be straightforward and easy-to-use, emphasized in wp-block-code readability. Python 3 is the latest version of the language and is considered to be the future of Python.
The set up of Python 3 on your Linux machine should be straightforward without any error, but sometimes you will encounter locale.Error: unsupported locale setting – one of the most common problem of Python. This tutorial will show you how to fix it explicitly on Ubuntu 18.04, but the process remains the same for other distro.
pip is the standard, de-facto package installer for Python. Created to be a better alternative to easy_install, It enables you to install and manage additional packages from PyPI that are not part of the standard Python library. This tutorial will show you the official, recommended way to install pip for both Python 2 and Python 3 on Ubuntu 18.04 LTS and how they will coexist peacefully.
Why do I need to care about pip for Python2 and pip for Python 3?
Ubuntu 18.04 ships with both Python 2 and Python 3 preinstalled. One pip installation works with only one Python distribution, so we need to separate both the command to invoke pip and the installation itself. For example, pip, by default, calls pip-for-python2 and pip3 is equivalent to pip-for-python3.
Installing pip3 and pip from Ubuntu Repository
Start off by updating system repository using the following command :
Proceed by using the python version of your choice to run the script. Be cautious as the script doesn’t coordinate well with the preinstalled pip version and can cause conflict if you have get-pip.py installed over the preinstalled one.
For example, the command for installing pip for Python 3 system-wide would be
sudo python3 get-pip.py
If you want to install pip for Python 3 for the current user, run
python3 get-pip.py --user
Similarly, the command for pip-on-Python2 should be
sudo python get-pip.py
python get-pip.py --user
Basic pip usage
Installing a package with pip
pip is made to manage the installation of third-party packages, one of the functionality is installing packages via the following command.
pip install <package_name>
Uninstalling a package
If you don’t need the package anymore you can uninstall it easily with the following command
pip uninstall <package_name>
Searching for Libraries
One can fire up the browser and search for a package on PyPI official website, but you can also do that using command line. For our example let’s look for packages related to “requests“. The search command shows us an extensive list similar to the one below.
pip search requests
requests-hawk (1.0.0) - requests-hawk
requests-dump (0.1.3) - `requests-dump` provides hook functionsfor requests.
pydantic-requests (0.1.1) - A pydantic integration with requests.
requests-foauth (0.1.1) - Requests TransportAdapter for foauth.org!
requests-auth (4.0.1) - Easy Authentication for Requests
Requests-OpenTracing (0.0.1) - OpenTracing support for Requests
yamlsettings-requests (1.0.0) - YamlSettings Request Extension
requests-aws4auth (0.9) - AWS4 authentication for Requests
requests-middleware (0.1.2) - Composable HTTP middleware for requests
jupyter-requests (0.0.2) - Send requests to a Jupyter server.
requests-twisted (0.1.2) - Twisted adapter for the requests library.
requests-oauthlib (1.2.0) - OAuthlib authentication support for Requests.
requests-ftp (0.3.1) - FTP Transport Adapter for Requests.
requests-async (0.5.0) - async-await support for `requests`.
requests-cache (0.5.0) - Persistent cache for requests library
requests-circuit (0.1.0) - A circuit breaker for Python requests
requestor-requests (0.1.0) - Requestor Helper to request package
requests-core (0.0.0) - A minimal HTTP Client, for Requests.
.........and many more.................
Batch installing depencies
Python codes distributed online often includes requirements.txt file declaring all the depencies. If you see this file, you can run this command to install all depencies instead of manually run pip install for each depency.
pip install -r requirements.txt
Show what files are installed and its paths
Sometimes you want to analyze a package’s code, then this command will help you locate its files.
Because rclone is written in Go programing language, it comes in a single binary file.
There are several ways to install it on Ubuntu. The easiest approach would be to use official package for apt or the snap package manager. Alternatively, you can install rclone using a bash install script provided by its development team.
We will walk you through all of them in this article.
Install rclone the official package from Ubuntu repositories (for Ubuntu 18.04 onwards).
Since Ubuntu 18.04 Bionic Beaver, rclone has become mature enough to become a part of the official repositories. To most users, this is the best way as you will have the most stable, well-tested version of rclone on your system. If the package manager of your choice is apt, simply run these commands in your terminal. We’ll first make sure that the system is fully updated.
Unfortunately, if you prefer snap app store, I have bad news for you : rclone development team has abandoned support for the snap package because it’s too hard to make it work properly (and peacefully) with the security confinement of snap.
Install rclone using the official bash script
If you have any problem with the package provided by Ubuntu (which is quite rare by the way), you can always install rclone using an official bash script from the development team. Open up your terminal and run the following commands :
You have to make sure curl is installed on your system :
If you see something like this, then you’re good to go:
If you see something like this, you will need to install curl first :
Command 'curl' not found, did you mean:
command 'curl'from deb curl
Try: sudo apt install
Get curl to your system :
sudo apt install curl -y
Download the bash script and let it does the install :
curl https://rclone.org/install.sh | sudo bash
If you have any difficulties in installing rclone using any of the methods above, please dont hesitate, let me know in the comments below.
Privacy & Cookies Policy
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.