2

I currently have a requirements file generated with pip3 as follows:

pip3 freeze > requirements.txt

With the above command I get the following requirements.txt file:

alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work
appdirs==1.4.4
argh==0.26.2
argon2-cffi @ file:///C:/ci/argon2-cffi_1613037869401/work
astroid @ file:///C:/ci/astroid_1623162452381/work
async-generator @ file:///home/ktietz/src/ci/async_generator_1611927993394/work
atomicwrites==1.4.0
attrs @ file:///tmp/build/80754af9/attrs_1620827162558/work
autopep8 @ file:///tmp/build/80754af9/autopep8_1615918855173/work
Babel @ file:///tmp/build/80754af9/babel_1620871417480/work
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
bcrypt @ file:///C:/ci/bcrypt_1607022693089/work
beautifulsoup4==4.9.3
black==19.3b0

Given the above, what do I have to do to get it looking like the example below?

appdirs==1.4.4
argh==0.26.2
atomicwrites==1.4.0
beautifulsoup4==4.9.3
black==19.3b0
Hayden Eastwood
  • 928
  • 2
  • 10
  • 20

2 Answers2

7
pip list --format=freeze > requirements.txt

This should remove odd path references in your requirements.txt.

Kishan Lal
  • 473
  • 1
  • 5
  • 13
0

You can use grep for example.

pip3 freeze | grep -v '@ file:' > requirement.txt

It will remove all matches with substring @ file:.

I know its not perfect, but probably will help you

4d61726b
  • 427
  • 5
  • 26