Friday, March 11, 2022

Installing from the local source code using pip

Once we have updated the package with new files, we are ready to install it using the pip utility. The simplest way to install it is by executing the following command with the path to the masifutilv2 folder:

> pip install <path to masifutilv2>

The following is the console output of the command when run without installing the wheel package:

Processing ./masifutilv2

Using legacy 'setup.py install' for masifutilv2, since package 'wheel' is not installed.

Installing collected packages: masifutilv2

Running setup.py install for masifutilv2 ... done

Successfully installed masifutilv2-0.1.0

The pip utility installed the package successfully but using the egg format since the wheel package was not installed. Here is a view of our virtual environment after the installation:


After installing the package under the virtual environment, we tested it with our pkgmain3.py program, which worked as expected.

As a next step, we will install the wheel package and then reinstall the same package again. Here is the installation command:

> pip install <path to masifutilv2>

The console output will be similar to the following:

Processing ./masifutilv2

Building wheels for collected packages: masifutilv2

Building wheel for masifutilv2 (setup.py) ... done

Created wheel for masifutilv2: filename=masi

futilv2-0.1.0-py3-none-any.whl size=3497

sha256=038712975b7d7eb1f3fefa799da9e294b34

e79caea24abb444dd81f4cc44b36e

Stored in folder: /private/var/folders/xp/g88fvmgs0k90w0rc_

qq4xkzxpsx11v/T/pip-ephem-wheel-cache-l2eyp_wq/wheels/

de/14/12/71b4d696301fd1052adf287191fdd054cc17ef6c9b59066277

Successfully built masifutilv2

Installing collected packages: masifutilv2

Successfully installed masifutilv2-0.1.0

The package is installed successfully using wheel this time and we can see it appears in our virtual environment as follows:


In this blog, we have installed a package using the pip utility from the local source code. In the next blog, we will publish the package to a centralized repository (Test PyPI).

Share:

0 comments:

Post a Comment