Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add the conda init and source .bashrc steps

...

1. First, log in to the IDAS research instance with Python. If you are a student in a class that uses Python in IDAS, follow the instructions here to access your class instance.

22a. In JupyterLab, click the Terminal tile under Other to start a Terminal session.

...

2b. If this is your first time using conda in the Terminal in IDAS, initialize your shell by running the following command in the Terminal.

This command only needs to be run once. It will create a .bashrc file in your IDAS home directory if a .bashrc doesn’t already exist.

Code Block
conda init bash

2c. Close the Terminal by clicking the x in the upper right corner of the Terminal window.

image-20240717-225543.pngImage Added

2d. Click the Terminal tile to open the Terminal again.

image-20240717-225847.pngImage Added

2e. Run the following command in the Terminal. This will source the .bashrc file that was just created.

Code Block
source ~/.bashrc

The command prompt in your Terminal will change to indicate the active environment, which is the base environment by default.

Code Block
(base) HawkID@idas-research-HawkID:~$ 

Info

Every time you open a new Terminal session, you’ll have to run source ~/.bashrc before using a conda environment.

3. In Terminal, the conda create command can be used to create a new conda environment.

...

When prompted Proceed ([y]/n)?, press y to proceed.

Additional notes:

The conda create command can be modified to fit your needs. Below are a few additional examples:

Additional example 1: Install packages when creating an environment: 

Code Block
conda create -n another-env python=3.8 numpy requests

Additional example 2: Specify the versions of the packages: 

Code Block
conda create -n another-env python=3.7 numpy=1.16.1 requests=2.19.1

Additional example 3: Create a conda environment from an environment.yml file:

Code Block
conda env create -f environment.yml

Info

For more examples of creating conda environments, please see the section "Managing environments" in the Conda User Guide.

...

1. First, log in to the IDAS research instance with Python. If you are a student in a class that uses Python in IDAS, follow the instructions here to access your class instance.

22a. In JupyterLab, click the Terminal tile under Other to start a Terminal session.

...

2b. If this is your first time using conda in the Terminal in IDAS, initialize your shell by running the following command in the Terminal.

This command only needs to be run once. It will create a .bashrc file in your IDAS home directory if a .bashrc doesn’t already exist.

Code Block
conda init bash

2c. Close the Terminal by clicking the x in the upper right corner of the Terminal window.

image-20240717-225543.pngImage Added

2d. Click the Terminal tile to open the Terminal again.

image-20240717-225847.pngImage Added

2e. Run the following command in the Terminal. This will source the .bashrc file that was just created.

Code Block
source ~/.bashrc

The command prompt in your Terminal will change to indicate the active environment, which is the base environment by default.

Code Block
(base) HawkID@idas-research-HawkID:~$ 

Info

Every time you open a new Terminal session, you’ll have to run source ~/.bashrc before using a conda environment.

3. In Terminal, the conda create command can be used to create a new conda environment.

...

When prompted Proceed ([y]/n)?, press y to proceed.

Additional notes:

...

The following commands may be useful to manage conda environments. Type the following commands in Terminal. For more information, please refer to the "Managing environments" and "Managing packages" sections in the Conda User Guide.

List all of your environments. In the output, your current environment will be marked with an asterisk (*).

Code Block
conda info --envs

or

Code Block
conda env list

To activate a conda environment that was previously created, type (without the angle brackets):

Code Block
conda activate <environment-name>

Deactivate a conda environment once you are finished working with it:

Code Block
conda deactivate

Or, to return to the

...

base

...

environment, type (with no environment specified):

Code Block
conda activate

View a list of packages installed in an environment:

If the environment is not activated, type (without the angle brackets):

Code Block
conda list -n <environment-name>

If the environment was already activated with conda activate earlier:

Code Block
conda list

To see if a specific package is installed in an environment, type (without the angle brackets):

Code Block
conda list -n <environment-name> <package-name>

Or, if the environment was already activated with conda activate earlier, type (without the angle brackets):

Code Block
conda list <package-name>

To install a package in an environment:

Code Block
conda install --name <environment-name> <package-name>

Remove an environment:

Code Block
conda remove --name <environment-name> --all

or

Code Block
conda env remove --name <environment-name>

Using pip in a conda environment

...