3  Appendix: Conda environment for BSF

This chapter is only relevant to students following both Bioinformatics and Programming and Biomolekylær Struktur og Funktion.

In bioinformatics, we install packages and programs to use them in our analyses and pipelines. Sometimes, however, the packages you need for one project conflict with the ones you need for other projects you work on in parallel. Such conflicts seem like an unsolvable problem. Would it not be fantastic if you could create a small insulated world for each project, which then only contained the packages you needed for that particular project? If each project had its own isolated world, then there would be no such version conflicts. Fortunately, a tool lets you do just that, and its name is Conda.

Conda is an open-source package management and environment management system for installing multiple versions of software packages and their dependencies and easily switching between them.

The small worlds that Conda creates are called “environments.” You can create as many environments as you like and then use each for a separate bioinformatics project, a course, a bachelor project, or whatever you want to insulate from everything else. Conda also downloads and installs the packages for you, ensuring that the software packages you install in each environment are compatible. It even makes sure that packages needed by packages (dependencies) are also installed. Conda is truly awesome.

Creating an environment for BSF

When you install Anaconda, Conda makes a single base environment for you. It is called “base,” and this is why it says “(base)” on your terminal.

Many of you take the “Biomolecular Structure and Function” (let us call that BSF) alongside this course. In BSF, you must install programs (e.g., PyMol) that may conflict with the packages you need for Bioinformatics and Programming. So, we will create isolated Conda environments for each course to avoid such conflicts. Conda is a program you run from the command line, like python or cd. So open your terminal (i.e., the “Terminal” program if you are on a Mac and the “Anaconda Powershell Prompt” program if you are on Windows). You need two different commands depending on your computer’s chipset. If you have a new Mac, it may have the new M1 or M2 chips. If you click the top left apple icon and select “About This Mac,” it will say “Apple M1” or “Apple M2” if it is.

If your Mac is an M1/M2 Mac, you create a conda environment for BSF by copying/pasting the command line below into the terminal. Before you press return (enter), check that the pasted command looks the same. Sometimes, a space between words needs to be included. Now press return.

Terminal
conda create -y -n BSF --platform osx-64 -c conda-forge -c anaconda -c schrodinger pyqt pymol-bundle=3.1 python=3.12 vtk-m=1.8

Otherwise, you create a conda environment for BSF by copying/pasting the command line below into the terminal. Before you press return (enter), check that the pasted command looks exactly the same. Sometimes, a space between words needs to be included. Now press return.

Terminal
conda create -y -n BSF --platform osx-64 -c conda-forge -c anaconda -c schrodinger pyqt pymol-bundle=3.1 python=3.12 vtk-m=1.8

Notice how the command prompt changed from “(base)” to “(bioprog)” to show that you are now in the bioprog environment. It looks like nothing has changed, but now you have access to terminal commands that are not available in the base environment. You’ll be able to learn about these later. Try this command:

Terminal
conda deactivate

Notice how it again says “(base)” on your command prompt. That is because you are back in your base environment. Every time you start a new terminal window, you will need to run conda activate BSF to activate the BSF environment and access Pymol. Try it out:

Terminal
conda activate BSF

and press enter. Voila, you are now back in the BSF environment. Notice how the command prompt changed from “(base)” to “(BSF)” to show that you are now in the BSF environment. To run the PyMol that you installed in this environment, just type

Terminal
pymol

and hit enter.

Now try to close PyMol. Then go back to your terminal and type:

Terminal
conda deactivate

Notice how it now again says “(base)” on your command prompt. That is because you are back in your base environment. Try to type pymol (and hit enter). Your terminal will tell you it could not find anything called pymol. This is the way it should be. That is because PyMols is installed in the BSF environment, not in the base environment. It illustrates how the base environment is entirely separate from the BSF environment you just made.

Starting PyMol

From now on, you can start PyMol by typing these commands into the terminal (Anaconda Powershell Prompt on Windows):

Terminal
conda activate BSF

(hit enter)

Terminal
pymol

(hit enter)