close

How to pip install a local python package?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to pip install a local python package in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to pip install a local python package?

  1. How to pip install a local python package?

    What is probably happening is that you have multiple python installs and pip is run from one install while you are trying to use the package from another. 

  2. pip install a local python package

    What is probably happening is that you have multiple python installs and pip is run from one install while you are trying to use the package from another. 

Method 1

Uninstall the python package then install it using:

python -m pip install -e c:\users\worker\src\clockwork\lib\credentials

What is probably happening is that you have multiple python installs and pip is run from one install while you are trying to use the package from another. 

Method 2

The problem centers on setup.py. It needs to declare a package:

from distutils.core import setup

setup(name='credentials', version='1.0.0', packages=['credentials'])

But this setup.py must be in the parent directory of the credentials package, so in the end, the directory structure is:

...\credentials\setup.py
...\credentials\credentials\__init__.py

With this change, the module is found after reinstalling the package.

This could also be caused by two Python installs (but wasn’t in my case), and @Mr_and_Mrs_D gives an answer for that case.

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read