Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

When using env.yml with conda whats the difference between dependencies and pip dependencies?

I am creating a .SH script for setting up automatically my dev environment in Azure ML, according to this:

https://learn.microsoft.com/en-gb/azure/machine-learning/how-to-customize-compute-instance

The script looks like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#!/bin/bash
 
set -e
# https://pypi.org/project/azure-ai-ml/ 
# Requires: Python <4.0, >=3.7
# This script creates a custom conda environment and kernel based on a sample yml file.

conda env create  python=3.10
#conda env create -f env.yml

echo "Activating new conda environment"
conda activate envname
conda install -y ipykernel
echo "Installing kernel"
sudo -u azureuser -i <<'EOF'
conda activate envname
python -m ipykernel install --user --name envname --display-name "mykernelp310v2"
echo "Conda environment setup successfully."
pip install azure-ai-ml
EOF

my env looks like this:

name: p310v2

dependencies:
  - python=3.10
  - numpy
  - matplotlib
  - pandas
  - scikit-learn
  - pip:
       -kaggle==1.5

When I check this document:

https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/04-sharing-environments/index.html

I am confused between the dependencies section and the pip section. For example scikit-learn I could put in dependencies but also on the pip section, so whats the deal here?

>Solution :

dependencies are conda dependencies; listing them is equivalent to run conda install <deps>. For example conda installs numpy from https://anaconda.org/conda-forge/numpy .

pip means pip dependencies for pip install command; pip installs them from PyPI.org. For example, https://pypi.org/project/numpy/

The same for scikit-learn: https://anaconda.org/search?q=scikit-learn and https://pypi.org/search/?q=scikit-learn

See also https://stackoverflow.com/search?q=%5Bconda%5D+%5Bpip%5D+difference

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading