PyCharm 2024.2 Help

Install, uninstall, and upgrade packages

PyCharm provides methods for installing, uninstalling, and upgrading Python packages for a particular Python interpreter. It means that each project has its own set of packages, which is considered a best practice for Python dependency management. By default, PyCharm uses pip to manage project packages. For conda environments you can use the conda package manager.

In PyCharm, you can preview and manage packages in the Python Packages tool window and in the Python interpreter settings.

Manage packages in the Python Packages tool window

The Python Packages tool window provides the quickest and neat way to preview and install packages for the currently selected Python interpreter. This tool window is enabled by default, and you can open it by clicking Python Packages on the left. At any time you can open it using the main menu: View | Tool Windows | Python Packages.

The Python Packages tool window shows installed packages and the packages available in the PyPI and conda package repositories. Use the search field to filter the list of the available packages.

Python Packages tool window

You can preview the package documentation in the documentation area, or click the Documentation link and open it in a browser.

Install packages

  1. Start typing the package name in the search field of the Python Packages tool window. The matching packages are displayed.

    Search for the package in the Python Packages tool window

    If the current Python interpreter is a conda virtual environment, the packages available in the conda package repository are also displayed.

  2. Select the package and then do one of the following:

    • Click Install next to the package name and choose the version.

      Installing the package from the search results
    • Expand the list of the available versions and select the version. Then click the Install with pip or Install with conda button.

    Selecting the package version to be installed
  3. If a popup with an error message appears, refer to the Troubleshooting guide for a solution.

Manage package repositories

  1. To specify a custom repository, for example devpi or a private PyPi server, click Settings next to the search field.

  2. In the Python Packages Repositories dialog, click Add. If no authorization is required, for example, in the case of a local repository, type the repository URL and click OK.

    Adding a Python repository: No Authorization
  3. If you want to install Python packages from a repository that requires HTTP authorization, click Basic HTTP and type the repository URL and the login credentials. Click OK to complete the task.

    Adding a Python repository: Basic HTTP Authorization

Install packages from Version Control System

  1. Click the Add Package link on the Python Packages toolbar and select From Version Control.

  2. Specify a path to the target git repository. For more information about supported path formats, refer to pip documentation.

    Install from Version Control
  3. Select Install as editable (-e) if you want to install the package in the editable mode (for example, setuptools develop mode).

Install packages from disk

  1. Click the Add Package link on the Python Packages toolbar and select From Disk.

    Install package from disc
  2. Specify a path to the package directory or an archive (zip or whl).

  3. Select Install as editable (-e) if you want to install the package in the editable mode (for example, setuptools develop mode).

Upgrade packages

  • If a newer version of the package is available, a link with the current version and the newest version is displayed next to the package name. Click the link to upgrade the package to the latest version.

    A newer version of the package is available

    If a popup with an error message appears, refer to the Troubleshooting guide for a solution.

Uninstall packages

  • To delete an installed package, click More actions for an installed package More next to the package version and select Delete Package.

    Uninstalling a package in the Python Packages tool window

Manage packages in Python interpreter settings

To manage Python packages for a project Python interpreter, go to Settings | Project: <project_name> | Python Interpreter or select Interpreter Settings in the Python Interpreter selector. Then select the interpreter in the Python Interpreter field.

Viewing the installed Python packages

Install packages

  1. Click the Install on the toolbar.

    Add a package
  2. In the Available Packages dialog that opens, type the name of the package in the search field.

    Show available packages
  3. If required, select the following checkboxes:

    • Specify version: if this checkbox is selected, you can select the desired version from the list. By default, the latest version is installed.

    • Options: If this checkbox is selected, you can type the pip install command-line options in the text field.

    • Install to user's site packages directory <path>: If this checkbox is disabled (by default), the package will be installed into package directory of the current interpreter. If the checkbox is enabled, the package will be installed into the mentioned directory. This option is available only for conda environments.

  4. Select the package and click Install Package.

  5. If a popup with an error message appears, refer to the Troubleshooting guide for a solution.

Install packages from conda package repository

  • If you select a Python interpreter with the configured conda environment, the Use Conda Package Manager toggle appears in the packages area toolbar.

    Using the Conda package manager

    Use this toggle to install and upgrade packages from the conda package repository. This toggle is enabled by default for conda environments.

Uninstall packages

  1. In the list of packages, select the packages to be uninstalled.

  2. Click Uninstall on the toolbar.

    Uninstalling a Python package

PyCharm tracks the status of packages and recognizes outdated versions by showing the currently installed package version (column Version), and the latest available version (column Latest version). When a newer version of a package is detected, PyCharm marks it with the New version is available Upgrade icon.

By default, the Latest version column shows only stable versions of the packages. If you want to extend the scope of the latest available versions to any pre-release versions (such as beta or release candidate), click Show early releases.

Show latest available versions including beta and release candidates

Upgrade packages

  1. In the list of packages, select the package to be upgraded.

  2. Click Upgrade on the toolbar.

    Upgrading Python packages

    The selected package will be upgraded to the latest available version.

  3. Click OK to complete upgrading.

If you're accustomed to installing packages from the command line, you can proceed with your workflow using the Terminal.

Reuse installed packages

Last modified: 11 October 2024