For a test of compiling some other package I require the exact version of sphinx on my Ubuntu 18.04.01.

I tried the following:

sudo apt-get install sphinx=1.3.6

but it says that there is no 'package sphinx'.

So how to do it?


First of all - there is only one package for Sphinx named as sphinx - it is its source package.

According to the search results on Ubuntu 18.04 LTS you can get only 1.6.7-1ubuntu1 version.

But if you need only Python binding - you can try to install it from pip/pip3.

Other possible solution is to build older 1.3.6-2ubuntu1 Sphinx (from 16.04 LTS) from source.

If you want to take all the risk (as you will never get the security updates for Sphinx) then continue with manual installation of Sphinx 1.3.6 on Bionic:

cd ~/Downloads
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sphinx/libjs-sphinxdoc_1.3.6-2ubuntu1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sphinx/python-sphinx_1.3.6-2ubuntu1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sphinx/python3-sphinx_1.3.6-2ubuntu1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sphinx/sphinx-common_1.3.6-2ubuntu1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/s/sphinx/sphinx-doc_1.3.6-2ubuntu1_all.deb
sudo apt install ./*sphinx*.deb

and pin (lock) installed Sphinx packages:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-sphinx
Package: libjs-sphinxdoc
Pin: version 1.3.6-2ubuntu1
Pin-Priority: 1337

Package: python3-sphinx
Pin: version 1.3.6-2ubuntu1
Pin-Priority: 1337

Package: python-sphinx
Pin: version 1.3.6-2ubuntu1
Pin-Priority: 1337

Package: sphinx-common
Pin: version 1.3.6-2ubuntu1
Pin-Priority: 1337

Package: sphinx-doc
Pin: version 1.3.6-2ubuntu1
Pin-Priority: 1337


To make your system more secure consider to remove this pin-file after the compilation of dependent packages with sudo rm /etc/apt/preferences.d/pin-sphinx and upgrade to supported Sphinx with sudo apt dist-upgrade.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.