How do you install Docutils from the Terminal so that Django admindocs will work?
Asked Answered
P

3

12

Docutils is a great package. If you are using Django the admindocs package needs docutils. Instructions are available for installing with a web browser, but what if you are remote and logging in with a terminal over SSH? How to install in that case? What if you just want a quick recipe to do the job with the terminal?

Pashm answered 7/7, 2012 at 17:54 Comment(0)
O
26

I know I'm rather late to this question, but the accepted answer doesn't really reflect the common best practices from Python community members (and even less so from the Django community members.) While the outlined manual installation process does work, is is far more pains taking and error prone than the following:

You really should be using Pip. With Pip installing docutils system wide is as simple as:

$ sudo pip install docutils

This not only works for docutils but nearly any package on the 'Cheese Shop' as well as many other code repositories (Github, Bitbucket, etc.)

You may also want to look into other common Python best practice tools like virtualenv and virtualenvwrapper so that you can avoid global package installation.

To install Pip on Ubuntu/Debain I generally do the following:

$ sudo apt-get install python-pip

BTW: for virtualenv 'sudo apt-get install python-virtualenv' and for virtualenvwrapper 'sudo apt-get install virtualenvwrapper'.

Outfight answered 10/10, 2012 at 6:15 Comment(1)
Thanks so much for explaining sensible conventions in Python and Django development. I'm running OS X Server 10.6.8. Python has moved around a bit with the upgrade to 2.7. I've noticed that the various folder locations don't get mentioned in the otherwise excellent tutorials that are found around on the web. However with PIP being a standard I'll start using it and move or symlink directories as needed. Bump 1 for the nice reply.Pashm
P
2

The key to the install is to use the curl utility. The following will install docutils:

mkdir docutilsetup
cd docutilsetup
curl -o docutils-docutils.tar.gz http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar
gunzip docutils-docutils.tar.gz 
tar -xf docutils-docutils.tar 
cd docutils
sudo python setup.py install

This performs the following steps: Create a directory to download docutils into. cd into the directory just made, and use curl to download the zipped version of docutils. Unzip the file which creates a subdirectory docutils. cd into that directory and install with root permissions.

If you are using Django you will have to restart Django for admindocs to start working.

Pashm answered 7/7, 2012 at 17:54 Comment(1)
Even though this would work, Beau's much more sensible use of pip is much cleaner and quicker. and follows python and django conventions much closer than this method.Telegraphic
B
1

Although it is an old thread, I want to share the answer I found. To install type command

sudo apt install python-docutils

or

sudo apt install python3-docutils

This will install the dependencies too. Yesterday, I installed docutils using this command for Geany editor and it is working fine.

Bicker answered 16/12, 2020 at 14:22 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.