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.

Install the latest available (and at least v11.0) Datasets package:

$ pip install ncbi-datasets-pylib~=11.0

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:

11.8.1
Generated October 22, 2021