code-guide icon indicating copy to clipboard operation
code-guide copied to clipboard

Errors while installing Pygments

Open Poshi opened this issue 4 years ago • 0 comments

I tried to install Pygments in a python 2.7.3 setup as a standard user (shared cluster, no root access), but it went bad and not pygmentize is also throwing an error. The installation looks like:

$ pip install --index-url=https://pypi.python.org/simple/ --user Pygments
Downloading/unpacking Pygments
  Downloading Pygments-2.6.1.tar.gz (3.3MB): 3.3MB downloaded
  Running setup.py egg_info for package Pygments
Installing collected packages: Pygments
  Running setup.py install for Pygments
    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/formatters/html.py', 554, 31, '                          file=sys.stderr)\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/lexer.py', 49, 22, 'class Lexer(metaclass=LexerMeta):\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/style.py', 171, 22, 'class Style(metaclass=StyleMeta):\n'))

    SyntaxError: ('invalid syntax', ('/home/user/.local/lib/python2.7/site-packages/pygments/cmdline.py', 161, 43, '        print("%s not found!" % what, file=sys.stderr)\n'))

    Installing pygmentize script to /home/user/.local/bin
  Could not find .egg-info directory in install record for Pygments
Successfully installed Pygments
Cleaning up...

And the actual error is:

$ pygmentize
Traceback (most recent call last):
  File "/home/user/.local/bin/pygmentize", line 11, in <module>
    load_entry_point('Pygments==2.6.1', 'console_scripts', 'pygmentize')()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 560, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2642, in load_entry_point
    return ep.load()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2296, in load
    return self.resolve()
  File "/apps/PYTHON/2.7.3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2302, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/user/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 161
    print("%s not found!" % what, file=sys.stderr)
                                      ^
SyntaxError: invalid syntax

Any ideas why is this happening?

Poshi avatar Mar 18 '20 19:03 Poshi