- Published on
Working Out an Existing Python Project's requirements.txt file
- Authors
- Name
- Yair Mark
- @yairmark
I have spent the past day or two trying to get a Python project running. The problem with this project is there is no requirements.txt
file so I have to keep running the code and trying to install any missing dependencies.
Luckily today I came across this excellent article. The portion that helped me the most was installing and using pipreqs.
Pipreqs is fairly simple:
- You install it globally:
pip install pipreqs
. - You then point it to the project you want to generate the
requirements.txt
file for:pipreqs /path/to/python/codebase
. - Pipreqs then looks at the project's imports and places a
requirements.txt
in the root of the target project.
I had to do a few more things to get the dependencies to install but pipreqs got me 99% of the way there.