guy
guy

Reputation: 1131

How to pip freeze source package

I am learning how to use venv here: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#installing-from-source

And it says I can install a source package by:

python3 -m pip install .

Which works, but now if I do pip freeze then I see:

my-package @ file:///Users/joesmith/my-package

The problem is if I export this to a requirements.txt and try to install this environment on another machine then it won't work cause the path to source changed obviously.

What is the proper way to use a source package locally like i did but also export it afterwards so that another person can recreate the environment/run the code on another machine?

Upvotes: 0

Views: 799

Answers (2)

Kerrim
Kerrim

Reputation: 523

Pip has support for VCS like git. You can upload your code to git (e.g. Github, Gitlab, ..) for example and then use the requirements.txt. like this:

git+http://git.example.com/MyProject#egg=MyProject

https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support

Upvotes: 1

Kholdarbekov
Kholdarbekov

Reputation: 1150

You would install package from PyPI rather than from source.

i.e. pip install requests

In this way other developers will also easily run your project.

Upvotes: 1

Related Questions