Error after upgrade

Issue #1208 resolved
R. Padraic Springuel
created an issue

I use pygments through the MacPorts installation package and after updating from 2.0.2 to 2.1 yesterday, have run into an error. When I invoke pygmentize -V at the command-line I get the following:

Traceback (most recent call last):
  File "/opt/local/bin/pygmentize", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3138, in <module>
    @_call_aside
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3124, in _call_aside
    f(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3151, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 663, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 676, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Pygments==2.0.2' distribution was not found and is required by the application

That last line tells me pygmentize is looking for the wrong version. If I revert the py27-pygments package to 2.0.2_1 then the error goes away, but of course that's because I'm using the old version (I do not need to revert the py-pygments package).

Can anyone tell me why command line tool (pygmentize) would still be looking for the old version after upgrade and what I might to do fix it?

If this is a MacPorts issue, I apologize for the noise here. Please let me know and I'll file a bug report over there.

Comments (5)

  1. R. Padraic Springuel reporter

    When I first installed pygments, I recall having some trouble getting a working installation before settling on the MacPorts version. While I would have done my best to remove any vestiges of the non-working installs at the time, I suppose that there might still be some vestiges left over that I missed. For what and where should I be looking to tell if that is the case?

  2. Georg Brandl repo owner

    Well, I'm not a Mac person, so I'm not sure about all the possible locations. Just look for occurences of pygmentize scripts in bin-like directories, and pygments/__init__.py files in lib-like directories.

  3. R. Padraic Springuel reporter

    Using terminal I did/got the following:

    cd /
    sudo find . -name "pygmentize" -print -xdev
    ./opt/local/bin/pygmentize
    ./opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pygmentize
    ./usr/local/bin/pygmentize
    

    Invoking each of these commands specifically, the first one fails with the above error while the other two work fine. Using which I find that the first and third are in PATH with the first (the one which fails) being first. Since /opt/local is the MacPorts directory, this makes me think that my problem is MacPorts related.

    As a final check I do/get the following:

    sudo find . -name "pygments" -print -xdev -type d
    ./Applications/calibre.app/Contents/Resources/Python/site-packages/pygments
    ./opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygments
    

    The first pygments site-package is safely tucked away inside an application bundle, so it's shouldn't be causing the problems. The second is the MacPorts installed one. This seems to confirm my above suspicion of a MacPorts problem.

    So, I guess I'll head on over to MacPorts and report the problem there. Feel free to correct me if you think I'm wrong, but otherwise thanks for the pointers and sorry for the noise.

  4. Log in to comment