Edgewall Software

Opened 8 years ago

Last modified 6 years ago

#12282 closed defect

Traceback from trac.mimeview.pygments when wheel is installed — at Initial Version

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.10
Component: general Version:
Severity: normal Keywords: setuptools wheel
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I've installed Trac with pip, which defaults to installing a wheel.

$pip --version
pip 7.1.2 from /Users/rjollos/Documents/Workspace/trac-dev/next-ticket/pve/lib/python2.7/site-packages (python 2.7)
$pip install ../trac-1.0-stable/
Processing /Users/rjollos/Documents/Workspace/trac-dev/trac-1.0-stable
Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.6b1 in ./pve/lib/python2.7/site-packages (from Trac==1.0.10.dev0)
Collecting Genshi>=0.6 (from Trac==1.0.10.dev0)
Building wheels for collected packages: Trac
  Running setup.py bdist_wheel for Trac
  Stored in directory: /Users/rjollos/Library/Caches/pip/wheels/3f/60/12/c10dd2a8966cbc743d8922432155940b4a67ddc617edfedd51
Successfully built Trac
Installing collected packages: Genshi, Trac
Successfully installed Genshi-0.7 Trac-1.0.10.dev0

Now there is a traceback when Trac is started:

14:38:59 Trac[loader] ERROR: Skipping "trac.mimeview.pygments = trac.mimeview.pygments [pygments]": 
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve1/lib/python2.7/site-packages/trac/loader.py", line 68, in _load_eggs
    entry.load(require=True)
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve1/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve1/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/rjollos/Documents/Workspace/trac-dev/pve1/lib/python2.7/site-packages/trac/mimeview/pygments.py", line 16, in <module>
    import pygments
ImportError: No module named pygments

Using the --no-use-wheel option there is no traceback:

15:54:42 Trac[loader] DEBUG: Skipping "trac.mimeview.pygments = trac.mimeview.pygments [pygments]": ("DistributionNotFound: The 'Pygments>=0.6' distribution was not found and is required by the application" not found)

It seems we are encountering a reported issue with setuptools. I get the same result seen in that ticket.

When a wheel is installed:

>>> import pkg_resources
>>> d = pkg_resources.get_distribution('trac')
>>> d.requires(d.extras)
[Requirement.parse('Genshi>=0.6'), Requirement.parse('setuptools>=0.6b1')]

When installed with --no-use-wheel:

>>> import pkg_resources
>>> d = pkg_resources.get_distribution('trac')
>>> d.requires(d.extras)
[Requirement.parse('setuptools>=0.6b1'), Requirement.parse('Genshi>=0.6'), Requirement.parse('ConfigObj'), Requirement.parse('SilverCity>=0.9.4'), Requirement.parse('Babel>=0.9.5'), Requirement.parse('docutils>=0.3.9'), Requirement.parse('textile>=2.0'), Requirement.parse('Pygments>=0.6')]

The following is a workaround:

  • setup.py

     
    105105    extras_require = {
    106106        'Babel': ['Babel>=0.9.5'],
    107107        'ConfigObj': ['ConfigObj'],
    108         'Pygments': ['Pygments>=0.6'],
     108        'pygments': ['Pygments>=0.6'],
    109109        'reST': ['docutils>=0.3.9'],
    110110        'SilverCity': ['SilverCity>=0.9.4'],
    111111        'Textile': ['textile>=2.0'],
     
    125125        trac.db.postgres = trac.db.postgres_backend
    126126        trac.db.sqlite = trac.db.sqlite_backend
    127127        trac.mimeview.patch = trac.mimeview.patch
    128         trac.mimeview.pygments = trac.mimeview.pygments[Pygments]
     128        trac.mimeview.pygments = trac.mimeview.pygments[pygments]
    129129        trac.mimeview.rst = trac.mimeview.rst[reST]
    130130        trac.mimeview.txtl = trac.mimeview.txtl[Textile]
    131131        trac.prefs = trac.prefs.web_ui

As a workaround we should perhaps just use lowercase identifiers in extras_require: tags/trac-1.0.9/setup.py@:106-111#L105.

Change History (0)

Note: See TracTickets for help on using tickets.