> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing conda packages

export const TroubleshootSolution = ({children}) => <>
    <hr className="my-3 w-full" />
    <details className="mt-3">
      <summary className="cursor-pointer font-semibold text-base mb-1">
        Solution
      </summary>
      <div className="mt-2 ml-4" data-component-part="step-content">
        {children}
      </div>
    </details>
  </>;

export const TroubleshootCause = ({children}) => <details className="mt-3 mb-2">
    <summary className="cursor-pointer font-semibold text-base mb-1">
      Cause
    </summary>
    <div className="mt-2 ml-4" data-component-part="step-content">
      {children}
    </div>
  </details>;

export const TroubleshootTitle = ({children}) => <>
    <p className="m-0 font-semibold text-xl leading-tight mb-2" role="heading" aria-level={3}>
      {children}
    </p>
    <hr className="my-3 w-full" />
  </>;

export const Troubleshoot = ({children}) => <div className="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border troubleshoot-admonition dark:troubleshoot-admonition" data-callout-type="troubleshoot">
    <div className="mt-0.5 w-4">
      <svg width="14" height="14" viewBox="0 0 640 640" fill="currentColor" className="w-4 h-4" aria-label="Troubleshoot">
        <path d="M541.4 162.6C549 155 561.7 156.9 565.5 166.9C572.3 184.6 576 203.9 576 224C576 312.4 504.4 384 416 384C398.5 384 381.6 381.2 365.8 376L178.9 562.9C150.8 591 105.2 591 77.1 562.9C49 534.8 49 489.2 77.1 461.1L264 274.2C258.8 258.4 256 241.6 256 224C256 135.6 327.6 64 416 64C436.1 64 455.4 67.7 473.1 74.5C483.1 78.3 484.9 91 477.4 98.6L388.7 187.3C385.7 190.3 384 194.4 384 198.6L384 240C384 248.8 391.2 256 400 256L441.4 256C445.6 256 449.7 254.3 452.7 251.3L541.4 162.6z" />
      </svg>
    </div>
    <div className="prose min-w-0 w-full">{children}</div>
  </div>;

export const Comments = ({children}) => {
  return <div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-zinc-500/20 bg-zinc-50/50 dark:border-zinc-500/30 dark:bg-zinc-500/10" data-callout-type="comments">
      <div class="w-4">
        <svg width="14" height="14" viewBox="0 0 640 640" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" aria-label="Comments">
            <path d="M320 112C434.9 112 528 205.1 528 320C528 434.9 434.9 528 320 528C205.1 528 112 434.9 112 320C112 205.1 205.1 112 320 112zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM280 400C266.7 400 256 410.7 256 424C256 437.3 266.7 448 280 448L360 448C373.3 448 384 437.3 384 424C384 410.7 373.3 400 360 400L352 400L352 312C352 298.7 341.3 288 328 288L280 288C266.7 288 256 298.7 256 312C256 325.3 266.7 336 280 336L304 336L304 400L280 400zM320 256C337.7 256 352 241.7 352 224C352 206.3 337.7 192 320 192C302.3 192 288 206.3 288 224C288 241.7 302.3 256 320 256z" />
        </svg>
      </div>
      <div class="text-sm prose min-w-0 w-full">
        {children}
      </div>
    </div>;
};

A conda package is a file that installs a specific software library or tool into a <Tooltip tip="An isolated folder containing specific conda packages and dependencies that won't interfere with other projects. Each environment maintains its own versions of libraries and packages, so changes in one environment don't affect others.">conda environment</Tooltip>, along with any required dependencies. You can install packages from sources like Anaconda's [public repository](https://repo.anaconda.com/pkgs/), [Anaconda.org](https://anaconda.org/), or [conda-forge](https://conda-forge.org/). For more information about installing packages, see the [official conda documentation](https://docs.conda.io/projects/conda/en/stable/commands/install.html).

<Note>
  Because conda is a command-line tool, this page outlines the most common workflows for installing packages in your environment using [Anaconda Prompt](/reference/glossary#anaconda-prompt) (Terminal for macOS/Linux users). If you prefer to use a graphical interface, you can also perform these actions using [Anaconda Navigator](/tools/anaconda-navigator/tutorials/manage-packages#installing-a-package).

  ***

  Anaconda *strongly recommends* creating [separate conda environments](/getting-started/working-with-conda/environments#creating-an-environment) for each of your projects. This protects your `base` environment from breaking due to complex package dependency conflicts, helps to simplify environment management, and aids in the reproducibility of your environment on other machines.
</Note>

## Using conda install

Use the `conda install` command to install packages into an environment. Run `conda install --help` to see a list of available options.

<Tabs>
  <Tab title="Single package">
    To install a single package, run the following command:

    ```sh theme={null}
    conda install <PACKAGE>
    ```

    <Comments>
      Replace \<PACKAGE> with the name of the package you want to install.
    </Comments>
  </Tab>

  <Tab title="Multiple packages">
    To install multiple packages, list the packages separated by a space:

    ```sh theme={null}
    conda install <PACKAGE> <PACKAGE> <PACKAGE>
    ```

    <Comments>
      Replace \<PACKAGE> with the name of the package you want to install.
    </Comments>
  </Tab>
</Tabs>

### Specifying an environment

<Note>
  If no environment is specified in the command, conda installs the requested package(s) in your currently active environment.
</Note>

To install a package in an environment that is not your currently active environment, specify the environment name:

```sh theme={null}
conda install <PACKAGE> --name <ENVIRONMENT>
```

<Comments>
  Replace \<PACKAGE> with the name of the package you want to install.<br />
  Replace \<ENVIRONMENT> with the name of the environment where you want to install the package.
</Comments>

### Specifying a channel

By default, conda installs packages using the [channel priority](/getting-started/concepts/what-is-a-channel#channel-priority) defined in your `.condarc` configuration file. You can override this behavior in one of two ways, depending on how you want conda to handle the package dependencies:

<Tabs>
  <Tab title="Using double-colon syntax">
    Using the double-colon syntax `::` in the command installs the specified package from the specified channel, but immediately falls back to your user-defined channel priorities to install any necessary package dependencies.

    ```sh theme={null}
    conda install <CHANNEL>::<PACKAGE>
    ```

    <Comments>
      Replace \<PACKAGE> with the name of the package you want to install.<br />
      Replace \<CHANNEL> with the URL or name of the channel you want to install from.
    </Comments>
  </Tab>

  <Tab title="Using the --channel flag">
    Using the `--channel` flag in the command installs the specified package and as many dependencies as possible from the specified channel before falling back to your user-defined channel priorities.

    ```sh theme={null}
    conda install --channel <CHANNEL> <PACKAGE>
    ```

    <Comments>
      Replace \<PACKAGE> with the name of the package you want to install.<br />
      Replace \<CHANNEL> with the URL or name of the channel you want to install from.
    </Comments>
  </Tab>
</Tabs>

### Specifying package versions

By default, when installing packages from the command line, conda retrieves the latest possible versions of the requested package(s) (and their dependencies) that are compatible with the current environment. To define package versions, conda uses MatchSpec as its query language. MatchSpec also allows for wildcard characters and match ranges. For more information, see the official conda documentation on [match specifications](https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html#package-match-specifications).

Here is an example command that installs NumPy version `2.2.2` and its dependencies:

```sh theme={null}
conda install numpy=2.2.2
```

## Downloading a package file

Conda downloads package archive files (`.conda` or `.tar.bz2`) to your package cache when you install a new package. This makes conda more efficient when you need to use the same package in multiple places, but the package cache also enables you to copy or use the package archive file in different ways.

<Accordion title="Where is my package cache?">
  Your package cache is located in the `/pkgs` folder of your installation folder. Possible default installation locations include:

  | Operating System | Installer                      | File Location                  |
  | :--------------- | :----------------------------- | :----------------------------- |
  | Windows          | Graphical installer (`.exe`)   | `\Users\<USERNAME>\anaconda3\` |
  | macOS            | Graphical installer (`.pkg`)   | `/opt/anaconda3/`              |
  | macOS            | Command line installer (`.sh`) | `/anaconda3/`                  |
  | Linux            | Command line installer (`.sh`) | `/anaconda3/`                  |

  <Note>
    Replace `anaconda3` with `miniconda3` for Miniconda installations

    ***

    To see your exact package cache file location, open Anaconda Prompt (Terminal in macOS/Linux) and run the following command:

    ```sh theme={null}
    conda info
    ```
  </Note>
</Accordion>

Some uses for package archive files include [offline installing of packages onto an air-gapped machine](#installing-packages-from-a-local-file-air-gapped-networks) or the creation of custom channels for local or network file system use. For more information on creating custom channels, see [Creating custom channels](https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/create-custom-channels.html) in the official conda documentation.

To download a package file *without* installing the package, run the following command:

```sh theme={null}
conda install <PACKAGE>=<VERSION> --download-only
```

<Comments>
  Replace \<PACKAGE> with the name of the package you want to download.<br />
  Optionally, specify the package \<VERSION>.
</Comments>

This command downloads the package file to your package cache without installing it to your currently active environment.

<Accordion title="How do I know what file type a package is?">
  One way to determine what archive file type a package install uses is to use the `--info` flag when searching for the package:

  ```sh theme={null}
  conda search <PACKAGE>=<VERSION> --info
  ```

  <Comments>
    Replace \<PACKAGE> with the name of the package you are searching for.<br />
    Optionally, specify the package \<VERSION> to shorten the search list.
  </Comments>

  The extension in the file name and url for each package version shows what type of file will be downloaded:

  ```sh Example package information highlight={3,11} theme={null}
  tqdm 4.67.1 py39h33ce5c2_0
  --------------------------
  file name   : tqdm-4.67.1-py39h33ce5c2_0.conda
  name        : tqdm
  version     : 4.67.1
  build       : py39h33ce5c2_0
  build number: 0
  size        : 134 KB
  license     : MPL-2.0 AND MIT
  subdir      : osx-arm64
  url         : https://repo.anaconda.com/pkgs/main/osx-arm64/tqdm-4.67.1-py39h33ce5c2_0.conda
  md5         : 80aa4362a9cbae52debf8ee965f51732
  timestamp   : 2025-02-07 15:55:08 UTC
  constraints :
    - ipywidgets >=6
  dependencies:
    - python >=3.9,<3.10.0a0
  ```
</Accordion>

## Installing packages from a local file (air-gapped networks)

If you're working on a machine without internet access, you can install packages in an environment directly from `.conda` or `.tar.bz2` files that are stored on your local file system:

```sh theme={null}
conda install <PATH_TO_PACKAGE>.conda
```

<Comments>
  Replace \<PATH\_TO\_PACKAGE> with the relative or absolute path to the package file.
</Comments>

<Tip>
  If conda can't find the file, try using an absolute path instead of a relative one.
</Tip>

Conda supports both `.conda` and `.tar.bz2` file types, but `.conda` archive files are the most common. For more information on the `.conda` file format, see [.conda file format](https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/packages.html#conda-file-format) in the official conda documentation.

<Warning>
  Installing a package directly from a local file does not resolve its dependencies. If your installed package does not work, you might have missing dependencies that need to be resolved manually.
</Warning>

## Troubleshooting

<Troubleshoot>
  <TroubleshootTitle>
    ### command not found: conda
  </TroubleshootTitle>

  <TroubleshootCause>
    The `command not found: conda` error occurs when your command line interface (CLI) can't find the conda command in order to use it. This might be because:

    * You don't have conda properly initialized.
    * You have set `auto_activate_base` to `false`.
    * You're using a shell that conda doesn't support.
    * Conda is not installed or the install was incomplete or corrupted.

    <Note>
      These issues primarily occur on macOS/Linux computers. Anaconda Distribution and Miniconda installations on Windows include [Anaconda Prompt](/reference/glossary#anaconda-prompt), which opens with conda initialized by default.
    </Note>
  </TroubleshootCause>

  <TroubleshootSolution>
    <AccordionGroup>
      <Accordion title="Initialize conda in your shell">
        If you recently installed Anaconda Distribution or Miniconda, make sure you closed and reopened your CLI to make conda's initialization take effect.

        <Tip>
          If you don't want to close your CLI, you can also use one of the following `source` commands to refresh your shell:

          <CodeGroup>
            ```sh bash theme={null}
            source ~/.bashrc
            ```

            ```sh zsh theme={null}
            source ~/.zshrc
            ```

            ```sh fish theme={null}
            source ~/.config/fish/config.fish
            ```

            ```sh cshrc theme={null}
            source ~/.cshrc
            ```

            ```sh xonshrc theme={null}
            source ~/.xonshrc
            ```
          </CodeGroup>

          <Comments>
            Use the command that matches your shell.
          </Comments>
        </Tip>

        You can also initialize conda directly from its `bin` directory:

        <CodeGroup>
          ```sh Initialization command theme={null}
          <PATH_TO_CONDA>/bin/conda init
          ```

          ```sh Examples theme={null}
          miniconda3/bin/conda init
          /opt/miniconda3/bin/conda init
          anaconda3/bin/conda init
          /opt/anaconda3/bin/conda init
          ```
        </CodeGroup>

        <Comments>
          Replace \<PATH\_TO\_CONDA> with a path to your conda installation.
        </Comments>
      </Accordion>

      <Accordion title="Set auto_activate_base to true">
        To see the value for `auto_activate_base`, run the following command:

        ```sh theme={null}
        conda config --describe auto_activate_base
        ```

        If your terminal returns `false`, this means that conda is not automatically activating your base environment when you start a new shell. This behavior emulates your system Python, and some users prefer to have their conda environment be inactive until they need it. However, this is not conda's default behavior after installation.

        To change the value of `auto_activate_base` to `true`, run the following command:

        ```sh theme={null}
        conda config --set auto_activate_base true
        ```

        If you have `auto_activate_base` set as `false`, the conda command will still be available as a shell function, but your base environment will not be active when a new shell is started. To activate your base environment, run `conda activate`.
      </Accordion>

      <Accordion title="Use a shell that conda supports">
        For information on which shells conda supports, see [Conda activate](https://docs.conda.io/projects/conda/en/stable/dev-guide/deep-dives/activation.html#conda-activate) in the official conda documentation.
      </Accordion>

      <Accordion title="Verify your installation of conda">
        If you have tried to initialize conda in your shell but it didn't work, try uninstalling and reinstalling [Anaconda Distribution](/getting-started/anaconda/main) or [Miniconda](/getting-started/miniconda/main).

        <Tip>
          Make sure that you say yes to the initialization option, and, if installing from the CLI, reinitialize your shell by restarting it or using its `source` command. For more information, see [Initialize conda in your shell](#initialize-conda-in-your-shell).
        </Tip>
      </Accordion>
    </AccordionGroup>
  </TroubleshootSolution>
</Troubleshoot>

<Troubleshoot>
  <TroubleshootTitle>
    ### DirectoryNotACondaEnvironmentError: The target directory exists, but it is not a conda environment
  </TroubleshootTitle>

  <TroubleshootCause>
    This error means that you don't have a conda environment currently active. You might have used `conda deactivate` while in your `base` environment and deactivated conda.
  </TroubleshootCause>

  <TroubleshootSolution>
    Activate your `base` environment or another environment:

    ```sh theme={null}
    # Activate your base environment
    conda activate

    # Activate an environment by name
    conda activate <ENV_NAME>
    ```

    <Comments>
      Replace \<ENV\_NAME> with the name of the environment.
    </Comments>
  </TroubleshootSolution>
</Troubleshoot>
