pip freeze creates some weird path instead of the package version


Python Problem Overview

I am working on developing a python package. I use pip freeze > requirements.txt to add the required package into the requirement.txt file. However, I realized that some of the packages, instead of the package version, have some path in front of them.

pandas @ file:///opt/concourse/worker/volumes/live/38d1301c-8fa9-4d2f-662e-34dddf33b183/volume/pandas_1592841668171/work

Whereas, inside the environment, I get:

>>> pandas.__version__

Do you have any idea how to address this problem?

Python Solutions

Solution 1 - Python

It looks like this is an open issue with pip freeze in version 20.1, the current workaround is to use:

pip list --format=freeze > requirements.txt

In a nutshell, this is caused by changing the behavior of pip freeze to include direct references for distributions installed from direct URL references.

You can read more about the issue on GitHub:

pip freeze does not show version for in-place installs

Output of "pip freeze" and "pip list --format=freeze" differ for packages installed via Direct URLs

Better freeze of distributions installed from direct URL references

Solution 2 - Python

Also, you can create txt file with another name and it won't include direct references then you can change the file name to requirements.txt

pip freeze > req.txt


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaeem KhoshnevisView Question on Stackoverflow
Solution 1 - PythonadamgyView Answer on Stackoverflow
Solution 2 - PythonRecep Emre BaşarView Answer on Stackoverflow