User Tools

Site Tools


conda

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
conda [2020/07/17 08:32]
jansen [Solutions to these pitfalls]
conda [2020/07/17 13:35] (current)
jansen [Creating an environment]
Line 18: Line 18:
  
 ===== Setup ===== ===== Setup =====
-Now that you have the ''conda'' package manager available, you can use it to complete the setup.+Now that you have the ''conda'' package manager available, you can use it to complete the setup.  
 +One bit of setup that ''conda'' insists on, is to add some initialization code to the login environment, so conda will always be active (''conda init bash'' or ''conda init tcsh''). However, see "pitfalls" section below. 
 + 
 +Other bits of setup can be done through the ''conda config''  commands, see ''conda config --help'' for details. It is also possible to edit the ''$HOME/.condarc'' directly if you know what settings you want (eg by looking them up online).
 ===== Creating an environment ===== ===== Creating an environment =====
 +One conda install can manage several environments, which are independent (except when set to inherit from another environment). The original install creates an environment ''base'', but it is best to create separate environments before using and modifying anything.
 +To create an environment called ''TEST'', you run:
 +
 +  conda create --name TEST
 +  
 +You can add package names and versions to add some packages immediately to the newly created environment, e.g.
 +  conda create --name TEST python==3.6
 +  
 +For more information, see the Anaconda websiete and output of ''conda create --help''
 +
 +Once created, you activate the environment using ''conda activate NAME''
 ===== Installing packages ===== ===== Installing packages =====
 +Install a package using ''conda install packagename'', optionally with a version as in ''conda install python==3.7'' to make sure that exact version gets installed, if available. 
 +
 +If unsure what packages are available, use ''conda search packagename'' to search for any matching names (wildcards allowed, should be enclosed in quotes). To list installed packages, use ''conda list''.
 ===== Pitfalls ===== ===== Pitfalls =====
 As you can see above, the default behaviour when installing conda or running ''conda init'' is, to add some code to your .bashrc or .tcshrc to activate conda on every shell and in every window you open. That may sound like a nice feature, until you realize, that a custom version of python with a custom set of packages may wreak havoc on any environment that relies on the system default version. And there is a lot of software that happens to be written in python, or linked with it, including big parts of the Gnome and Cinnamon desktop applications. So, if you happen to set up a non-standard version of python as default, it might not be possible for you to log in in these desktop environments any more. Or even worse, if you need to install non-standard versions of gcc or its libraries, you might not be able to run a big part of the system software any more. As you can see above, the default behaviour when installing conda or running ''conda init'' is, to add some code to your .bashrc or .tcshrc to activate conda on every shell and in every window you open. That may sound like a nice feature, until you realize, that a custom version of python with a custom set of packages may wreak havoc on any environment that relies on the system default version. And there is a lot of software that happens to be written in python, or linked with it, including big parts of the Gnome and Cinnamon desktop applications. So, if you happen to set up a non-standard version of python as default, it might not be possible for you to log in in these desktop environments any more. Or even worse, if you need to install non-standard versions of gcc or its libraries, you might not be able to run a big part of the system software any more.
Line 33: Line 50:
 Another solution is, to use a different shell for everything that requires ''conda''. So if your default login shell is ''tcsh'', you could type ''bash'' in any session where you want to do some work with ''conda'', and do ''conda init bash'' to add the conda init stuff to your ''.bashrc'' without influencing anything that runs in ''tcsh'', including your desktop login session. Another solution is, to use a different shell for everything that requires ''conda''. So if your default login shell is ''tcsh'', you could type ''bash'' in any session where you want to do some work with ''conda'', and do ''conda init bash'' to add the conda init stuff to your ''.bashrc'' without influencing anything that runs in ''tcsh'', including your desktop login session.
  
-One remaining problem: the [[x2go]] remote login facility always uses ''bash'' to run its initial login. So if you use ''x2go'', this method might not work. Of course you can reverse the role of the shells, set your default shell to ''bash'' and leave that with the default setup so all logins including ''x2go'' will work fine, and start ''tcsh'' when you need ''conda'', and run ''conda init tcsh'' to set it up.+One remaining problem: the [[linux:x2go]] remote login facility always uses ''bash'' to run its initial login. So if you use ''x2go'', this method might not work. Of course you can reverse the role of the shells, set your default shell to ''bash'' and leave that with the default setup so all logins including ''x2go'' will work fine, and start ''tcsh'' when you need ''conda'', and run ''conda init tcsh'' to set it up.
  
  
  
  
conda.1594974741.txt.gz · Last modified: 2020/07/17 08:32 by jansen