How do we use easy_install to install Python modules?


Easy Install is a python module that is bundled with setuptools (easy_install) that allows you to download, compile, install, and manage Python packages automatically. It was included in setuptools in 2004 and is now deprecated. It was remarkable at the time for automatically installing dependencies and installing packages from PyPI using requirement specifiers.

Pip was released later in 2008 as a replacement for easy install, albeit it was still primarily based on setuptools components. Installing Python modules should be done with pip rather than easy install. You can use easy_install to install pip if you have it. The following line of code can be used to install pip in your system using easy_install.

easy_install pip

To download a package we simply include the filename/ package name after the easy_install command. It will download the packages along with its dependencies.

easy_install numpy

The following output is obtained after the successful completion of

WARNING: The easy_install command is deprecated and will be removed in a future version.
Searching for numpy
Best match: numpy 1.18.5
Adding numpy 1.18.5 to easy-install.pth file
Installing f2py-script.py script to C:\Users\jsmur\anaconda3\Scripts
Installing f2py.exe script to C:\Users\jsmur\anaconda3\Scripts
Using c:\users\jsmur\anaconda3\lib\site-packages
Processing dependencies for numpy
Finished processing dependencies for numpy

Why we use pip over easy_install?

  • Pip was designed to improve on easy install in the following ways.

  • Before installation, all packages are downloaded. As a result, a partially completed installation does not occur.

  • On the console, care is taken to display useful output.

  • The reasons for actions are recorded. For example, while installing a package, pip keeps track of why that package was required.

  • Error messages should be informative.

  • Because the code is relatively short and cohesive, it is easier to use programmatically.

  • Packages do not have to be installed as egg archives; they can be installed in their entirety (while keeping the egg metadata).

  • Other version control systems are supported natively (Git, Mercurial and Bazaar)Other version control systems are supported natively (Git, Mercurial and Bazaar)

  • Package uninstallation

  • It is simple to define fixed sets of requirements and reproduce a set of packages in a reliable manner.

Now you can use pip to install the module you want. For example, To install the latest version of "SomeProject" we can use the following command.

pip install 'SomeProject'

To install a specific version, the following line of code can be used.

pip install 'SomeProject==1.4'

To install greater than or equal to one version and less than another, the following line of code can be used.

pip install 'SomeProject>=1,<2'

Updated on: 16-Sep-2022

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements