How to build and install a Python package locally without uploading to PyPI?

5.2k Views Asked by At

I created a small Python project using a project template. Now I would like to configure the project to be locally installable.

When I run the command:

$ python3.8 -m pip install fdroid_build_checker

I get the following error:

ERROR: Could not find a version that satisfies the requirement fdroid_build_checker (from versions: none)
ERROR: No matching distribution found for fdroid_build_checker

A future step would be to configure the project to be published as a small command line tool.

1

There are 1 best solutions below

0
On

Your command is searching for the package in PyPi, which won't work because you haven't published the package there.

To install a local package, you should be able to just run pip install path_containing_fdroid_build_checker/froid_buildchecker

You'll have to make sure that your package contains a setup.py file (1) in order for pip to build a wheel and install it successfully.

See https://stackoverflow.com/a/41537134/2741222

1 - https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py