Daniel Roy Greenfeld

Daniel Roy Greenfeld

About | Articles | Books | Jobs | News | Tags

Pip Installing Dependencies Into Conda Envs

I prefer to use Conda because once installed it works essentially the same everywhere. Including Windows.

Step 1: Create a Virtual Environment

conda create -n credible python=3.10

After agreeing to install some dependencies, it places them in an out-of-the way location. Here's where they are on my work, personal laptops, and a 2018-era Windows laptop I sometimes test on:

  • /Users/drg/opt/miniconda3/envs/
  • /Users/danny/opt/miniconda3/envs/
  • c:\Users\danielandaudrey\.conda\envs

Get the list of current envs:

$ conda env list
base                  *  /Users/drg/opt/miniconda3
credible                 /Users/drg/opt/miniconda3/envs/credible
system                   /Users/drg/opt/miniconda3/envs/system
that                     /Users/drg/opt/miniconda3/envs/that
just                     /Users/drg/opt/miniconda3/envs/just
works                    /Users/drg/opt/miniconda3/envs/works
everywhere               /Users/drg/opt/miniconda3/envs/everywhere

Step 2: Activate a Virtual Environment

conda activate credible

This prefixes the CLI shell with (credible), exactly like venv or virtualenv.


Step 3: Install Dependencies Using Pip Into a Conda Env

Just like many any other virtual environments for Python, use pip to install/uninstall dependencies

(credible) python -m pip install typer

That's right. I'm using pip to manage packages in a conda env. Conda works great with pip. Conda has worked great with pip for years.


Because I know you have them.

1. What about conda install for dependencies?

I rarely use conda install on MacOS or Linux. On Windows, conda install is sometimes useful because it handles non-python binaries that otherwise require Docker, Chocolately, or other tools.

2. Why not pyenv-win instead of conda?


  1. I always struggled to get pyenv-win to work on Windows
  2. Didn't handle non-python binaries well, requiring use of Chocalatey
  3. Conda just works

3. Did you ever teach classes with Conda?

Yes. Conda was awesome when I used to teach. Conda is a universal installation system that works for everyone regardless of operating system. Once people got it installed we got to teaching instead of dealing with setup issues.

4. What about Docker instead of Conda?

My classes focused more on teaching Python and Django rather than Docker. Docker is a whole different world.

5. What does Audrey use?

Audrey uses pyenv and loves it. Taught people to use pyenv and pyenv-win.


Source: https://rna.colostate.edu/2020/lib/exe/detail.php?id=wiki%3Asoftwareinstall&media=wiki:python-conda.png Source of Image

Tags: python conda MacOS Windows Linux
← Back to home