Skip to content
Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
Close

Search

Home/Knowledge Base/Use virtual environments with Anaconda
Knowledge Base

Use virtual environments with Anaconda

By Laszlo Pinter
April 7, 2022 2 Min Read
0

Anaconda (conda) can create a python bubble for you with no preinstalled packages. You can create a Python virtual environment for each of your projects to isolate them and only install the required packages.

When we distribute our code, we should specify the list of referenced Python packages including their versions in the requirements.txt file. This enables any other developer ( and the Docker container build process ) to install the appropriate packages and be able to successfully run our application.

When you install packages with pip, those packages are global, every project can see them. When we execute the pip freeze > requirements.txt command, all installed packages will show up in the requirements.txt file, not just the short list needed for the particular application.

When you execute your application, Python will prompt you to install the referenced packages. The resulting list is usually much shorter, than the long list of globally installed packages.

Install Anaconda

Download the installer from https://www.anaconda.com/products/individual

Create your first virtual environment

To create an environment with only generic packages installed execute the command:

conda create -n MY_ENVIRONMENT_NAME python=3.10
# At the time of writing python version 3.10
# is the latest for Anaconda packages

To create a new environment based on a requirements.txt file:

conda env create -f=requirements.txt -n MY_ENVIRONMENT_NAME

To create a new environment based on an environment.yml file:

conda env create -f=environment.yml

Working with virtual environments

List the Python virtual environments. The asterisk (*) shows to current environment.

conda env list

Activate an environment

conda activate MY_ENVIRONMENT_NAME

Delete an Anaconda environment

conda deactivate
conda env remove -n MY_ENVIRONMENT_NAME

Generate the dependency list for you project

Generate a standard text file with the list of packages and their versions installed in the current Python environment. This enables the Docker build or any developer to reproduce the same Python environment you have on your developer workstation.

pip freeze > requirements.txt

Tags:

Python
Author

Laszlo Pinter

Follow Me
Other Articles
Previous

ERROR HMAC did not pass!!

Next

Install multiple Python versions with Pyenv

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Last Changes

  • DevOps Engineering part 1. (Mac) - Make your Macintosh easier to use June 25, 2026
  • Japan travel tips June 22, 2026
  • How to stop the rain and snow in Cities: Skylines II June 20, 2026
  • Cities: Skylines II Developer Mode June 20, 2026
  • 'CSII_MANAGEDPATH' has incorrect path(s) when building Cities: Skylines II mod June 20, 2026

Tags

.NET .NETcore 3Dprinting ASP.NET Core AutodeskInventor AWS C# Chef cloud DevOps Docker EntityFramework Games Git Go iOS iPad iPhone iPod Java Kubernetes Linux MacOSX MSSQL MVC Node.js Packer PowerShell Python RDS RightScale Ruby security Splunk TeamCity Terraform TestKitchen Tomcat Ubuntu Vagrant VirtualBox VisualStudio Windows WordPress Xcode

Recent Comments

  • Zengei László on MyHeritage családfa exportálása és küldése emailben
  • Raúl Castillo on DynDns update error
  • MICHAEL on Windows Media Player 12 cannot find the album information
  • Nargis on Configure Epson ET-3850 scanning on Windows 11
  • Venczelné Zemen Erika on Delta S2302 termosztát programozása

–

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Pinter Computing. All rights reserved.