Say I have a coworker who doesn't use conda, but instead uses a global python environment.
Is there a way for the coworker to use conda to create a conda environment from his global python environment?
The goal is for me to easily create a conda environment on my computer which matches his python environment.
On his side:
pip freeze > requirements.txt
On your side:
conda env create -n [ENV_NAME] -f requirements.txt
EDIT: This only works when 1) both environments are the latest python version, and 2) every package in the specific version that your coworker has, exists in conda. 1 can be resolved through:
conda create -n [ENV_NAME] python=[PYTHON_VER] -f requirements.txt
There isn't a one-step way to do 2 in conda afaik, what I would do is to (as stated in Lokinou's answer) first create a conda env in the desired python version, then install via pip:
conda create -n [ENV_NAME] python=[PYTHON_VER]
conda activate [ENV_NAME]
pip install -r requirements.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With