Last Updated:

Installing pip for python

 

 

 

Most Python packages are now designed to be compatible with the Python pip package manager. But if you have a package that isn't pip compatible, you'll need to manually install the Python packages.

What is a PIP?

PIP is a recursive abbreviation that stands for "PIP Installs Packages" or "Preferred Installer." It is a command line utility that allows you to install, reinstall, or uninstall PyPI packages with a simple and straightforward command: pip.

Install Python and PIP

Installation Guide for macOS:

  1. Go to https://www.python.org/downloads/windows/ and download Python 3.6.4 (since later versions are not supported at the time of writing).
  2. Once you've downloaded it, run it and be sure to select a custom installation option. This will take you to the configuration dialog where you can select pip as the option to install.
  3. It is recommended that you select them all.
  4. Check if python version is 3.6.4.
    python —version
  5. Install pip
    Sudo easy_install pip
  6. You can now use Python run time and pip installer for macOS 🙂

Windows 10 Installation Guide:

  1. Go to https://www.python.org/downloads/windows/ and download Python 3.6.4 (since later versions are not supported at the time of writing).
  2. Once you've downloaded it, run it and be sure to select a custom installation option. This will take you to the configuration dialog where you can select pip as the option to install.
  3. We recommend that you select all options during installation. 
    python option
  4. After the installation is complete, open the terminal type:
    python
  5. Exit the Python interpreter.
    exit()
  6. Check your pip setup.
    pip -V

You can now use Python run time and pip installer for Windows.)

Packages that cannot be installed using Pip

 

Preliminary steps to take:

  • Download the package and extract it to a local directory.
  • If you come with your own set of installation instructions, you should follow them.

Otherwise, the most common method of manually installing a package is to implement setup.py.

Install Python packages using setup.py

 

To install a package that includes setup.py file, open a command or terminal window and:

  • cd to the root directory where the setup.py is located
  • Type: python setup.py installation

Setup.py development environment

 

Packages installed with setup.py are build requirements that developers must adhere to. However, some requirements are optional.

Examples

Make sure that the updated version of setuptools is installed:

python -m pip install —upgrade setuptools

Include keyword arguments install_requires in the setup.py. install_requires is setuptools setup.py the keyword used to specify the minimum requirements of the package. For example:

install_requires=['<packagename>'], # Optional keyword

The complete package build requirements for setup.py based installation is described in PyPA (PythonPackagingAuthority) in the Sample Project section.

Example project

The sample project is a template package with setup.py file to manually install the package. The file is annotated for configuring the script and for the overall build environment of the package.

[https://github.com/pypa/sampleproject ]

The sample project is based on the setup tools package: "Setup tools-based configuration module."

https://github.com/pypa/sampleproject/blob/master/setup.py ]

setup.py is a script for building packages built using setup tools.

Installation. ExamplePy (No annotations)

importsetuptools

with open(«README.md», «r») as fh:

long_description = fh.read()

setuptools.setup(

name="<template-package-username>", # Replace with your username

version=»1.0.0″,

author="<name of the author>",

author_email=»<authorname@templatepackage.com>»,

description=»<Template Setup.py package>»,

long_description=long_description,

long_description_content_type=»text/markdown»,

url=»<https://github.com/authorname/templatepackage>»,

packages=setuptools.find_packages(),

classifiers=[

«Programming language :: Python :: 3»,

«License :: OSI Approved :: MIT License»,

«Operating System :: OS Independent»,

],

python_requires=’>=3.6′,

)

Installing Stats model: (OPTIONAL)

  1. You can get the latest source code from our github repository. Or if you have git:
    gitclone installed git://github.com/statsmodels/statsmodels.git
  2. Change to the stats model directory.
    Cd stats models
  3. If you want to keep up to date with the source code on github, just do it periodically:
    gitpull
  4. Once you have received the source, you can do this (after you open the terminal as an administrator):


pythonsetup.py build
python setup.py install