Search code examples
pythonpipanacondacondavirtual-environment

How to export installed packages(using pip in a conda environment) in to requirements.txt?


I installed some Python libraries in the Conda environment using the conda command. Again I installed some other packages/libraries e.g. stable-baselines using pip also in that Conda environment.

After that I exported environments in the requirements.txt file, using the command:

(conda_env) D:\userone> conda list --explicit>requirements.txt

After that, I opened and checked that file using VS Code. I found all packages/libraries which were installed using conda. But couldn't find the stable-baselines packages and others which were installed using pip.

I want to export those pip installed packages also in requirements.txt.


Solution

  • I think it will works

    pip3 freeze > C:\PATH\TO\FOLDER\requirements.txt
    

    It may be needed to run terminal as administrator - if you cannot I recommend just write 'pip3 freeze' and copy output to the proper file.