Python

Python-related resources for NCBI Datasets
We recommend use of a virtualenv to install NCBI Datasets PyLib, using python >= 3.7. You can create a virtualenv in a new directory of any name you choose. The following commands create a virtualenv using the name .venv_datasets:
$ python -m venv .venv_datasets
$ source .venv_datasets/bin/activate

The remainder of this Python guide assumes you are operating within an activated virtualenv.

Note that you may need to first install wheel:

$ pip install wheel

Install the latest available Datasets package:

$ pip install --upgrade ncbi-datasets-pylib

To verify the installation, run the following command:

$ python -c 'import ncbi.datasets.openapi; print(ncbi.datasets.openapi.__version__)'

The output will be similar to the following:

12.22.1
Generated March 11, 2025