How can I create a requirements.txt in Google colab?

Viewed 1875

I have already tested the following:

!pip freeze > requirements.txt --> saves all packages in the environment

pipreqs --> returns an empty file

I need a compilation of all imported packages with the corresponding version. How can I do this in Google Colab without getting all installed packages?

1 Answers

You can get a list of all imported modules by doing:

import sys
print(sys.modules.keys())
Related