Conda is a tool that can package and build python projects. We can use it as an alternative to pip and virtualenv to setup Python environments and install PyPi packages.

Install Conda

Conda or variations of it can be installed via the official website. Once install run in a shell to test the install:

Create a new environment within a project

Conda can create virtual environments with the command. In our examples lets create a python 3 project and write some unit tests.

Conda will download packages and create a new environment called with python 3.10 installed. We can activate the environment with the command.

Install packages

Lets install a package from PyPi using Conda. We can install the MailSlurp email testing library. First we need to enable pip support for Conda so we can find libraries on the Python package index.

Then install the package using the Conda linked pip command:

We can verify the result by running:

Save packages to requirements file

Freeze your package versions to a lockfile called by using the Conda list command:

The file can be used to install packages again with the conda command: