Install pip Python package manager on FreeBSD 12

Posted on 304 views

In this guide, we will look at how to  Install pip Python package manager on FreeBSD 12. pip is a package management system used to install and manage software packages written in Python.

There are two ways you can install pip on FreeBSD system. I have FreeBSD 12 installed on my Laptop:

# freebsd-version

FreeBSD 12 comes with both Python3.7 and Python3.8.

# python
python3.7         python3.7-config  python3.7m        python3.7m-config python3.8         python3.8-config

The default version I’m using is 3.8. Note that python command is not available on FreeBSD 12.

# which python
python: Command not found

You can create a symbolic link of Python3.8 binary to /usr/local/bin/python

# ln -s /usr/local/bin/python3.8 /usr/local/bin/python
# python --version
Python 3.8.13

Install Pip from py36-pip package:

# pkg install py38-pip
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	py38-pip: 20.3.4
	py38-setuptools: 57.0.0

Number of packages to be installed: 2

The process will require 19 MiB more space.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching py38-pip-20.3.4.pkg: 100%    2 MiB   2.2MB/s    00:01
[2/2] Fetching py38-setuptools-57.0.0.pkg: 100%  786 KiB 804.8kB/s    00:01
Checking integrity... done (0 conflicting)
[1/2] Installing py38-setuptools-57.0.0...
[1/2] Extracting py38-setuptools-57.0.0: 100%
[2/2] Installing py38-pip-20.3.4...
[2/2] Extracting py38-pip-20.3.4: 100%
Message from py38-pip-20.3.4:

pip MUST ONLY be used:

 * With the --user flag, OR
 * To install or manage Python packages in virtual environments

Failure to follow this warning can and will result in an inconsistent
system-wide Python environment (LOCALBASE/lib/pythonX.Y/site-packages) and
cause errors.

Avoid using pip as root unless you know what you're doing.

Create a symbolic link for Pip-3.6 package:

# which pip-3.8

# ln -s /usr/local/bin/pip-3.8 /usr/local/bin/pip
# pip --version 
pip 20.3.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

Upgrade pip:

# pip install --upgrade pip
pip 20.3.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
[email protected]:~ # pip install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (20.3.4)
Collecting pip
  Downloading pip-22.1-py3-none-any.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 25.0 MB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.4
    Uninstalling pip-20.3.4:
      Successfully uninstalled pip-20.3.4
Successfully installed pip-22.1

Test pip usage

$ pip install awscli --user

If you install Python packages with Pip as a normal user, the binary is placed under .local/bin/

Add the Path to your PATH variable.

$ vim ~/.bashrc
export PATH=$PATH:.local/bin/

You should now have PIP Python package manager installed on FreeBSD 12.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.