Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add note about restarting kernel

...

  • Option 1: Use pip to install Python packages from the Python Package Index (PyPI)

    • This may be suitable for users who are starting to use Python and/or planning to use Python very little.

    • For details, please see the below sections in this article.

  • Option 2: Use pip and venv to create a virtual environment and install packages in that virtual environment (recommended)

    • This is a recommended option for users who plan to use Python extensively or have multiple projects using Python.

    • For details on how to use venv in IDAS, please see Python Virtual Environments.

  • Option 3: Use conda to create a conda virtual environment and install packages in that conda virtual environment (recommended)

    • This is a recommended option for users who plan to use Python extensively or have multiple projects using Python.

    • For details on how to use conda in IDAS, please see Conda.

This article outlines the steps to install Python packages using pip (Option 1 above). We also recommend using tools like Python Virtual Environments and Conda in IDAS to manage your projects.

Installing Python packages in Jupyter Notebook

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.

2. In JupyterLab, click the "Python 3" tile under "Notebook" to start a Jupyter notebook.

...

Code Block
!pip3 install --upgrade package-name

4. In some cases, you might need to restart the notebook’s kernel:

  • Save the notebook by pressing Ctrl + S or clicking the Save and create checkpoint button:

...

  • Click the Restart the kernel button:

...

Example

For example, suppose we want to install the package TheFuzz, which is available from PyPI: https://pypi.org/project/thefuzz/.

In the following screenshot, cell

  • Cell 1 shows the installation command and its output in a Jupyter notebook.

  • Cells 2 and 3 test a simple example from https://pypi.org/project/thefuzz/ to ensure the package has been installed.

Click on the screenshot to view an enlarged version.

...

Installing Python packages in Terminal

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.

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

...