Building cpython/Doc on Linux

python-logoFor all the gory details, check out the Python Developers Guide.

Installing and Building the Doc

Here’s the process I followed to be able to work on the CPython documentation on Linux debian/mint:

  1. See if mercurial is installed by running: which hg
  2. If not installed, install it by running: sudo apt-get install mercurial
  3. Go to your source directory. e.g.: cd ~/src
  4. Get a working copy of the in-development branch of CPython in the subdirectory cpython by running: hg clone
  5. Run: cd cpython/Doc
  6. Run: make html
  7. If make tells you sphinx-build can’t be found, install it by running:
    sudo  pip install sphinx

You can browse the built documentation at file:///home/uname/src/cpython/Doc/build/html/

Caveat Emptor

Never look free software in the mouth. Doubly true for free documentation. The Installing Sphinx page says that sphinx-build can be installed like this:

sudo apt-get install python-sphinx

That command installed Sphinx v1.1.3, about which “make html” complained:

Sphinx version error:
This project needs at least Sphinx v1.2 and therefore cannot be built with this version.

Next, I tried:

sudo apt-get remove python-sphinx
pip install sphinx

This failed  with a permissions error:

error: could not create ‘/usr/local/lib/python2.7/dist-packages/sphinx’: Permission denied

Next, I tried:

sudo  pip install sphinx
sphinx-build -h

This failed with:

bash: /usr/bin/sphinx-build: No such file or directory

Closing the command tool and opening a new on fixed this, and make html was happy. Weird!

About jimbelton

I'm a software developer, and a writer of both fiction and non-fiction, and I blog about movies, books, and philosophy. My interest in religious philosophy and the search for the truth inspires much of my writing.
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s