sphinx-apidoc command not found

In this troubleshooting guide we learn how to fix sphinx-apidoc command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

sphinx-apidoc: command not found

or when using sudo you get the following error message

sudo: sphinx-apidoc: command not found

Solutions to sphinx-apidoc: command not found

How To Fix sphinx-apidoc: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu sphinx-apidoc is provided by python3-sphinx package.

python3-sphinx is:

Sphinx is a tool for producing documentation for Python projects, using reStructuredText as markup language.

Sphinx features:

  • HTML, CHM, LaTeX output,
  • Cross-referencing source code,
  • Automatic indices,
  • Code highlighting, using Pygments,
  • Extensibility. Existing extensions:
    • automatic testing of code snippets,
    • including docstrings from Python modules.

Build-depend on sphinx if your package uses /usr/bin/sphinx-* executables. Build-depend on python3-sphinx if your package uses the Python API (for instance by calling python3 -m sphinx).

To fix this problem, we can install more using the command below.

sudo apt-get -y install python3-sphinx

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install python3-sphinx.

sudo apt -y install python3-sphinx

Or if you have aptitude installed you can use the following command.

sudo aptitude install python3-sphinx

Summary

In this tutorial we learn how to fix sphinx-apidoc command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.