On this page:
Table of Contents |
---|
...
Overview
In IDAS, Python packages can be installed in several ways:
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.
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 conda Conda and Python virtual environmentsVirtual Environments 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.
...
3. Write the following code in a new cell of the notebook, filling in the name of the package that you want to install. Run the cell with the keyboard shortcut Shift+Enter
:
Code Block |
---|
!pip3 install --upgrade package-name |
...
In the following screenshot, 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.
...
Run the code from a Jupyter notebook:
...
Click on the screenshot to view an enlarged version.
...
Notes about Python package installation
...
Code Block |
---|
/home/HawkID/.local/lib/pythonx.x/site-packages |
where HawkID
is your HawkID, and pythonx.x
indicates the Python version, for example, Python 3.11.
...
3. After installing a Python package in Terminal, if you have trouble importing the package, you might need to add your user library to the PATH
environment variable.
The following steps are done in Terminal:
First, crease a .bashrc
if you haven't done so before:
...
If you have any questions or comments, please contact ITS - Research Services at research-computing@uiowa.edu.