25

First time this is happening to me, and I have no idea why pip is outputting the requirements in such strange form. I'm using a conda environment. Output example from pip freeze:

aioredis @ file:///home/conda/feedstock_root/build_artifacts/aioredis_1591809643295/work
amqp @ file:///home/conda/feedstock_root/build_artifacts/amqp_1591005859311/work
asgiref==3.2.7
async-timeout==3.0.1
attrs==19.3.0

Why aren't aioredis and amqp listed with their respective version just like the other requirements?

Filipe Aleixo
  • 3,924
  • 3
  • 41
  • 74

1 Answers1

48

This solves it:

pip list --format=freeze > requirements.txt
Filipe Aleixo
  • 3,924
  • 3
  • 41
  • 74
  • 1
    This is universal: it prints also packages installed with conda and by pip from both PyPI and Github. – mirekphd Aug 26 '20 at 10:08
  • 1
    Majorly saved my butt. Thanks – Ring Oct 13 '20 at 22:30
  • 1
    This works, but can you explain why the other doesn't? – j7skov Jul 20 '22 at 16:27
  • 1
    This works as long as there is no [pip package installed from a VCS](https://stackoverflow.com/a/35998253/1256347). For those packages the `pip freeze` command does show the correct output. Do you know how to combine the best of `--format freeze` and `pip freeze`? – Saaru Lindestøkke May 01 '23 at 09:42