How to import an existing requirements.txt into a Poetry project?
27 Feb 2026, 17:27 UTC
I am trying out Poetry in an existing project. It used pyenv and virtual env originally so I have a requirements.txt file with the project's dependencies.
I want to import the requirements.txt file using Poetry, so that I can load the dependencies for the first time. I've looked through poetry's documentation, but I haven't found a way to do this. Is there a way to do it?
I know that I can add all packages manually, but I was hoping for a more automated process, because there are a lot of packages.
1 answer
Accepted answer · original discussion
04 Mar 2026, 05:27 UTC
poetry doesn't support this directly. But if you have a handmade list of required packages (at best without any version numbers), that only contain the main dependencies and not the dependencies of a dependency you could do this:
$ cat requirements.txt | xargs poetry add
Your perspective belongs here.
Sign in with a verified account to contribute.
2 question comments
Use comments to ask for clarification. Post a solution as an answer.
01 Mar 2026, 05:27 UTC
requirements.txt file. I would like to import it into Poetry without having to type in the packages manually.02 Mar 2026, 17:27 UTC
requirements.txt. You can use dephell, but I don't know how good or reliable that is. Honestly, I'd always do dependency porting by hand, since it's one of the parts of an app that can lead to serious problems and technical debt if it's not cared for as good as possible.