#177 ImportError: no module named roman after upgrade


Related to #2971827, the detection of the run-time environment doesn't just affect buildout deployments, but any deployment doing an upgrade using setuptools. Consider this scenario:

1) User installs docutils 0.8.
2) User upgrades to docutils 0.8.1. During the upgrade, the install detects that roman is present (because it's part of 0.8), so doesn't include it in the install of 0.8.1. Shortly thereafter, setuptools removes 0.8 from the path. Now 0.8.1 is installed without a roman module.

This happened to me on Python 2.7.2 (see transcript below).

I can think of a few possible solutions to this issue:

1) Abandon Python 2.3 and 2.4 support (as suggested in 2971827) and depend on the roman package.
2) Keep Python 2.3 and 2.4 support, but use a more robust implementation for the roman dependency in later versions.
3) Abandon strict distutils support and require setuptools and depend on the roman package.
4) Always include the roman module as docutils.roman or similar and only import it if a system roman module is not present.

I see reports of this issue going back many years. Surely something can be done.

PS C:\Users\jaraco\projects\RecaptureDocs\recapturedocs\text> easy_install -U docutils
Searching for docutils
Reading http://pypi.python.org/simple/docutils/
Reading http://docutils.sourceforge.net/
Best match: docutils 0.8.1
Downloading http://pypi.python.org/packages/source/d/docutils/docutils-0.8.1.tar.gz#md5=2ecf8ba3ece1be1ed666150a80c838c8
Processing docutils-0.8.1.tar.gz
Running docutils-0.8.1\setup.py -q bdist_egg --dist-dir c:\users\jaraco\appdata\local\temp\easy_install-5eghqz\docutils-0.8.1\egg-dist-tmp-xl5omq
"roman" module already present; ignoring extras/roman.py.
warning: no files found matching 'MANIFEST'
warning: no previously-included files matching '.cvsignore' found under directory '*'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*~' found under directory '*'
warning: no previously-included files matching '.DS_Store' found under directory '*'
zip_safe flag not set; analyzing archive contents...
docutils.parsers.rst.directives.misc: module references __file__
docutils.writers.html4css1.__init__: module references __file__
docutils.writers.latex2e.__init__: module references __file__
docutils.writers.odf_odt.__init__: module references __file__
docutils.writers.pep_html.__init__: module references __file__
docutils.writers.s5_html.__init__: module references __file__
Removing docutils 0.8 from easy-install.pth file
Adding docutils 0.8.1 to easy-install.pth file
Installing rst2html.py script to c:\python\Scripts
Installing rst2latex.py script to c:\python\Scripts
Installing rst2man.py script to c:\python\Scripts
Installing rst2odt.py script to c:\python\Scripts
Installing rst2odt_prepstyles.py script to c:\python\Scripts
Installing rst2pseudoxml.py script to c:\python\Scripts
Installing rst2s5.py script to c:\python\Scripts
Installing rst2xetex.py script to c:\python\Scripts
Installing rst2xml.py script to c:\python\Scripts
Installing rstpep2html.py script to c:\python\Scripts

Installed c:\python\lib\site-packages\docutils-0.8.1-py2.7.egg
Processing dependencies for docutils
Finished processing dependencies for docutils
PS C:\Users\jaraco\projects\RecaptureDocs\recapturedocs\text> rst2html '.\work in progress.rst'
Traceback (most recent call last):
File "c:\python\scripts\rst2html.py", line 5, in <module>
pkg_resources.run_script('docutils==0.8.1', 'rst2html.py')
File "C:\Python\lib\site-packages\distribute-0.6.24-py2.7.egg\pkg_resources.py", line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "C:\Python\lib\site-packages\distribute-0.6.24-py2.7.egg\pkg_resources.py", line 1235, in run_script
execfile(script_filename, namespace, namespace)
File "c:\python\lib\site-packages\docutils-0.8.1-py2.7.egg\EGG-INFO\scripts\rst2html.py", line 23, in <module>
publish_cmdline(writer_name='html', description=description)
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\core.py",
line 336, in publish_cmdline
pub.set_components(reader_name, parser_name, writer_name)
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\core.py",
line 93, in set_components
self.set_reader(reader_name, self.parser, parser_name)
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\core.py",
line 83, in set_reader
self.reader = reader_class(parser, parser_name)
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\readers\__init__.py", line 49, in __init__
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\readers\__init__.py", line 60, in set_parser
parser_class = parsers.get_parser_class(parser_name)
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\parsers\__init__.py", line 46, in get_parser_class
module = __import__(parser_name, globals(), locals())
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\parsers\rst\__init__.py", line 75, in <module>
from docutils.parsers.rst import states
File "C:\Python\lib\site-packages\docutils-0.8.1-py2.7.egg\docutils\parsers\rst\states.py", line 108, in <module>
import roman
ImportError: No module named roman


  • Günter Milde

    Günter Milde - 2011-12-20
    • status: open --> closed-fixed

Log in to post a comment.