What is pip?
Python is a popular programming language. A package is a ready-made piece of code that other people wrote. Pip is the tool that fetches those packages and installs them. It works like a delivery service for code.
Before you start
- You need a server with Ubuntu 18.04.
- You need root access or a user that can run
sudo. Sudo means "run this command with admin power". - You need an SSH client. SSH is a safe way to type commands on a faraway server. Your welcome email has your login details.
Steps
- Log in to your server with SSH.
- Refresh the software list:
This command asks Ubuntu for the newest list of software it can install.sudo apt update - Install pip for Python 3:
This command downloads pip and its helper files. Typesudo apt install python3-pipywhen it asks to continue. - Check the version:
This command shows which pip you have. A version number means it worked.pip3 --version - Install a test package:
This command installs a package namedpip3 install requestsrequests.
Useful pip commands
| Command | What it does |
|---|---|
pip3 list | Shows installed packages |
pip3 install name | Installs a package |
pip3 uninstall name | Removes a package |
pip3 install --upgrade name | Updates a package |
If something goes wrong
- If you see "E: Unable to locate package", run
sudo apt updateagain. - If you see "Permission denied", put
sudoat the front of the command. - If the server cannot download anything, check that it is online. Then ask Hostvento support for help.
Tip: Ubuntu 18.04 is an older release. Newer Ubuntu versions use very similar commands.
Quick recap
- Pip installs Python packages.
- Run
sudo apt updatefirst. - Install with
sudo apt install python3-pip. - Confirm with
pip3 --version.