How to Use PyPI & PIP

Reading Time: 3 minutes
pypi logo

In this article, we will discuss how to access and utilize the Python Package Index or PyPI via the pip command.

PyPI is the default software repository for Python developers to store created Python programming language software developers and programmers alike use to publicize and share their software.

Continue reading “How to Use PyPI & PIP”

How to Install Scikit-Learn on Ubuntu 18.04

Reading Time: 5 minutes

In this tutorial, we are going to walk through how to install scikit-learn on an Ubuntu 18.04 server. We are going to walk through the installation both in a virtual environment with the Python package manager, Pip, and via Anaconda.

Continue reading “How to Install Scikit-Learn on Ubuntu 18.04”

How to Setup a Python Virtual Environment on Ubuntu 18.04

Reading Time: 3 minutes

In this article, we learn how to set up a python virtual environment on Ubuntu 18.04. Python is a high-level dynamic programming language. Its straightforward syntax makes it a great choice for fast development. Python is used by system administrators to automate workloads and by developers for application development as well.

Continue reading “How to Setup a Python Virtual Environment on Ubuntu 18.04”

How to Install PIP on Ubuntu 18.04

Reading Time: 3 minutes

What is PIP?

In this article, we will discuss how to install PIP on Ubuntu 18.04. PIP is a tool used to install and manage Python packages. This tutorial will show how to install and check the version of PIP as well as run a few basic commands for using PIP on Ubuntu 18.04.

The Python programming language is deemed to be one of the most popular and easiest to learn due to its emphasis on code readability. Python is cross-platform, which means it can be run on multiple operating systems, including Windows Server OS. We do need to note that PIP is not installed by default on Ubuntu 18.04.

Pre-Flight Check

  • These instructions are based on a Ubuntu 18.04 LTS server. We are logged in as the root user.
  • If you are using a different operating system, check out our other pip installation guides.
  • We need to confirm that Python is installed.

Verify Python Is Installed

To verify that Python is installed on your server, run the following command:

root@host:~# python
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

This checks the Python version and ensures that Python 3 is installed on our Ubuntu system. Exit out of the Python shell by typing Ctrl+C.

Install PIP

Let’s start by updating Ubuntu.

root@host:~#  apt update
root@host:~# python3 --version
Python 3.7.5

Next, we install PIP.

root@host:~# apt install python3-pip
...
...
...
After this operation, 129 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
...
...
Setting up python3.6-dev (3.6.8-1~18.04.3) ...
Setting up libpython3-dev:amd64 (3.6.7-1~18.04) ...
Setting up build-essential (12.4ubuntu1) ...
Setting up python3-dev (3.6.7-1~18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@host:~# 

Now, let’s check the version we have installed.

root@host:~# pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Use Cases

In order to use PIP, we have several options. We can stay within a virtual environment to test out programs within a distinct or “virtual” Python environment, or we can run PIP globally, which runs the programs on the server itself. In this case, we will work on our projects within a virtual Python environment (using venv) to limit any interaction with the project’s dependencies and to avoid wider conflicts with the system’s default Python environment. To show all of the available options for pip, we can run:

root@host:~# pip3 --help

Usage:   
  pip3 <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM
                              format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for download.
                              Implied with --no-index.

You can also get more information about a “specific” PIP command using pip –help. For example to get more information about the install command, type:

root@host:~# pip3 install --help

To search for a specific package, we can use:

root@host:~# pip3 search <search_string>

root@host:~# pip3 search pypi
go-pypi (0.0.4)                       - Go pypi
pypi-api (0)                          - pypi-api
upt-pypi (0.5)                        - PyPI frontend for upt
pypi-chat (0.0.4)                     - A project of pypi chat.
pypi-xmlrpc (2019.4.13)               - pypi XML-RPC
Flask-Pypi-Proxy (0.5.1)              - A Pypi proxy
pypi-task-demo (0.0.1)                - PyPI demo
pypi-test-fiveplus (0.0.2)            - PyPI Test
hello-pypi-yue (0.1.1)                - The Pypi test
aeverall-testing-pypi (0.1)           - Test of PyPI

To see all of the installed packages, we can run:

pip3 search installed package

This will usually output a significant number of packages.

To install a package using PIP, we use:

pip3 install <package_name>

Finally, to uninstall a package using PIP, we simply run:

pip3 uninstall <installed_package_name>

Check Us Out!

Should you run into any issues using PIP, simply reach out to one of our experienced systems administrators who can provide more information about this handy tool!

Give us a call today at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Solutions or Hosting advisors today!

How To Install TensorFlow on Ubuntu 18.04

Reading Time: 2 minutes

In this tutorial, we are going to set up TensorFlow in a virtual Python environment on Ubuntu 18.04. TensorFlow is an open-source framework, developed by the Google Brain team, designed to be a high-level interface for implementing machine learning and mathematical operations. This library provides developers an avenue to work on complex projects like neural networks through an easy to use Python API. One of the significant benefits of having a Python front-end is that it is portable between operating systems like Linux and Windows.

Continue reading “How To Install TensorFlow on Ubuntu 18.04”

Installing Python WSGI Applications on cPanel

Reading Time: 2 minutes

In this article, we will be installing a simple Python app on a cPanel server utilizing WSGI or Web Server Gateway Interface.

Continue reading “Installing Python WSGI Applications on cPanel”

Install TensorFlow on Windows

Reading Time: 2 minutes

Whether you’re a beginner or a professional, TensorFlow is an end-to-end platform that makes building and deploying Machine Learning models a snap! Because TensorFlow is based on the Python system, you can install it on multiple operating systems, including Windows. This article will take you through the necessary steps to get TensorFlow installed on your Windows server.

Continue reading “Install TensorFlow on Windows”

What Is WSGI?

Reading Time: 2 minutes

Have you ever wondered how Python web applications work on an Apache or NGINX web server? The answer is WSGI or Web Server Gateway Interface.

Python is rapidly gaining in popularity for various web applications and software options. WSGI is one of the numerous powerful frameworks that are enabling this forward-looking acceptance. You may be new to Python web applications and wondering how this type of application is deployed in a production environment or you may have already used this type of framework previously, but want to know more about what WSGI is. 

Continue reading “What Is WSGI?”

Configuring WSGI on Ubuntu/Centos

Reading Time: 3 minutes

This article outlines the process of configuring a server for Python 3 web applications with Apache 2.4 using mod_wsgi. 

What is mod_wsgi?

Mod_wsgi is an Apache module that allows Python web applications to function on a server. This module provides a web framework for Flask, Django, and other Python based frameworks to operate within a production environment on a server.

Continue reading “Configuring WSGI on Ubuntu/Centos”

Getting Started With Flask

Reading Time: 1 minute

What is Flask?

Flask is a micro web framework for Python that allows unlimited possibilities to the structure and format for building powerful web applications. This article demonstrates how to get started with Flask using Python 3.7 inside of a virtual environment.

Flask_logo
Continue reading “Getting Started With Flask”