User Tools

Site Tools


conda environment file to install different packages from different channels


yfinance library is the easiest and fastest way to download historical stock prices. Asof 2023-05-20, it is not available in the defaults channel. But it is available in the conda-forge channel.


The goal here is to pull the yfinance package from conda-forge but everything else from the defaults channel.


 % cat env_test_yfinance.yml |
name: test_yfinance
  - defaults
  - python=3.11
  - conda-forge::yfinance

where is a python script to strip out the comments. It can be downloaded from

Create the environment

 % conda env create -f ./env_test_yfinance.yml


yfinance is downloaded from conda-forge.

 % conda list -n test_yfinance | grep conda-forge
multitasking              0.0.9              pyhd8ed1ab_0    conda-forge
yfinance                  0.2.18             pyhd8ed1ab_0    conda-forge

python is downloaded from the defaults channel

 % conda list -n test_yfinance | grep "python"     
python                    3.11.3               h7a1cb2a_0  
python-dateutil           2.8.2              pyhd3eb1b0_0

See also

conda_environment_file_to_install_different_packages_from_different_channels.txt · Last modified: 2023/07/28 22:32 by raju