source /path/to/miniconda3/bin/activate
conda init --all
conda config --set auto_activate_base false
conda create -f environment.yml
conda update pip
conda export --from-history > environment.yml
update pip let conda konw what pips are installed. --from-history packages only manually installed, so it's much cleaner.
The above method somehow failed if
pipis not installed byconda, use pip freeze to export pip requirements
pip freeze > requirements.txt