No module named pygments when trying ReviewRequestApprovalHook or SignalHook

421 views
Skip to first unread message

Petr Grenar

unread,
Apr 15, 2020, 5:18:01 AM4/15/20
to Review Board Community
Hello,

so I managed to install ReviewBoard all over again on my virtual CentOS7 test machine.  I installed everything using yum. RB is now up and running. Then I created a sample extension. I had to install python wheels using pip to build the package. The extension is up and running too. In the apache log, I can see how it initialize and shutdown.

The next step for me was to try some of the signal hooks. My goal is to create an extension that will automatically push files to CVS that are shipped and submitted. I was following the manual. But when I try to run setup.py I am getting an error with pygments.

Can you help me with this?

RB_admin.png

RB.png



The error I am getting after python setup.py bdist_wheel bdist_egg sdist:
running bdist_wheel
running build
running build_py
running build_static_files
Error loading the extension for entry point sample_signal_extension
Traceback (most recent call last):
  File "setup.py", line 14, in <module>
    'sample_signal_extension = sample_signal_extension.extension:SampleSignalExtension',
  File "/usr/lib/python2.7/site-packages/reviewboard/extensions/packaging.py", line 48, in setup
    setuptools_setup(**setup_kwargs)
  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 223, in run
    self.run_command('build')
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/djblets/extensions/packaging.py", line 424, in run
    self.run_command('build_static_files')
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/djblets/extensions/packaging.py", line 283, in run
    extension = entrypoint.load(require=False)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/extension_signal/sample_signal_extension/extension.py", line 4, in <module>
    from reviewboard.extensions.hooks import ReviewRequestApprovalHook
  File "/usr/lib/python2.7/site-packages/reviewboard/extensions/hooks.py", line 11, in <module>
    from reviewboard.accounts.backends import (register_auth_backend,
  File "/usr/lib/python2.7/site-packages/reviewboard/accounts/backends.py", line 31, in <module>
    from reviewboard.accounts.models import LocalSiteProfile
  File "/usr/lib/python2.7/site-packages/reviewboard/accounts/models.py", line 19, in <module>
    from reviewboard.reviews.models import Group, ReviewRequest
  File "/usr/lib/python2.7/site-packages/reviewboard/reviews/models/__init__.py", line 6, in <module>
    from reviewboard.reviews.models.file_attachment_comment import \
  File "/usr/lib/python2.7/site-packages/reviewboard/reviews/models/file_attachment_comment.py", line 9, in <module>
    from reviewboard.attachments.models import FileAttachment
  File "/usr/lib/python2.7/site-packages/reviewboard/attachments/models.py", line 15, in <module>
    from reviewboard.attachments.mimetypes import MimetypeHandler
  File "/usr/lib/python2.7/site-packages/reviewboard/attachments/mimetypes.py", line 13, in <module>
    from pygments import highlight
ImportError: No module named pygments

Christian Hammond

unread,
Apr 15, 2020, 5:52:22 AM4/15/20
to revie...@googlegroups.com
Hi Petr,

Looks like the pygments Python module is either not installed or not in a place where the running installing of Review Board is finding it. Mixing yum-installed Python packages and pip-installed Python packages can cause such issues.

You're also running Review Board 2.5.x, which is old and no longer maintained. We don't maintain the yum packages, and there are limitations on how long those can be realistically maintained for older distros, so you're probably hitting issues with this.

For now, try installing pygments using:

    pip install pygments==2.5.2

(This is the last version of Pygments that officially supports Python 2.7)

You'll probably want to set aside some time to get onto a modern version of Review Board at some point, off of yum and onto pip-installed packages. Once we release 4.0, we'll be easing 3.0 into retirement.

Christian

--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/bc8b8bbf-cd24-4c93-8818-e2380975ce52%40googlegroups.com.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board

Petr Grenar

unread,
Apr 15, 2020, 7:20:12 AM4/15/20
to Review Board Community
Hello Christian,

thank you for a fast reply. This solved my problem. I know that I am working with an old version. I just started a new job and they were using it already. My task now is to add an extension as I described before.

Now I am finally getting some response from installed extension in the apache log file. So I hope, that I am on the right path to finish it :)

Petr

Dne středa 15. dubna 2020 11:52:22 UTC+2 Christian Hammond napsal(a):
To unsubscribe from this group and stop receiving emails from it, send an email to revie...@googlegroups.com.

Petr Grenar

unread,
Apr 15, 2020, 9:29:33 AM4/15/20
to Review Board Community
Hi again,

I asked my colleague about the RB version and he told me that it is the only one available in EPEL release. I am new to this so I don't know much about it. Maybe this will help you to improve the next versions of RB.


Petr

Dne středa 15. dubna 2020 11:52:22 UTC+2 Christian Hammond napsal(a):
Hi Petr,
To unsubscribe from this group and stop receiving emails from it, send an email to revie...@googlegroups.com.

Christian Hammond

unread,
Apr 15, 2020, 4:04:18 PM4/15/20
to revie...@googlegroups.com
Official packages are installed via `pip`, which doesn't use EPEL. We don't ourselves have any control over the EPEL packages, and they won't be able to be maintained by the package authors indefinitely. There's not much we can do there except recommend people replace their setup with a pip-based setup (or use pip when installing for the first time on a new system).

Christian

To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/0eea7dbd-2879-4c1b-8556-ff7639c02f0c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages