Bug 1583331

Summary: diffoscope does not run at all; says python-magic is not available
Product: [Fedora] Fedora Reporter: Andrew Gunnerson <accounts+fedora>
Component: diffoscopeAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: accounts+fedora, dhiru, fschwarz, jmmahler, ntl, redhat.c2zyt, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: diffoscope-95-2.fc28 diffoscope-100-1.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-10 22:45:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew Gunnerson 2018-05-28 18:32:07 UTC
Description of problem:

Whenever I run diffoscope, it seems that it is unable to find python-magic, even though I have the python3-magic package installed (stacktrace included below).

Version-Release number of selected component (if applicable):

diffoscope-91-1.fc28.noarch
python3-magic-5.33-5.fc28.noarch

How reproducible:

Always

Steps to Reproduce:
1. Install diffoscope
2. Run diffoscope with any arguments

Additional info:

[/tmp] diffoscope
Traceback (most recent call last):
  File "/usr/bin/diffoscope", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'python-magic' distribution was not found and is required by diffoscope
[/tmp] rpm -q python3-magic
python3-magic-5.33-5.fc28.noarch
[/tmp]

Comment 1 Nathan Lynch 2018-06-15 17:35:43 UTC
I have the same issue.  Workaround:
$ pip3 install --user python-magic

The "python3-magic" package apparently is not the "python-magic" package that diffoscope needs.  The latter does not seem to be packaged in Fedora?

Comment 2 Felix Schwarz 2018-07-13 16:02:17 UTC
It seems like there are two modules named "magic" (one is https://github.com/ahupp/python-magic which also uses the module identifier "python-magic"). From a quick look at the code it seems that diffoscope can use both (comparators/utils/file.py).

So we just need to remove the explicit setuptools dependency on "python-magic". This should be done by patching setup.py. As a quick workaround you can delete that line in /usr/lib/python3.6/site-packages/diffoscope-91-py3.6.egg-info/requires.txt .

Comment 3 maic 2018-09-14 17:38:15 UTC
This bug is still in Fedora 29 Beta as of today.

# dnf install diffoscope
# diffoscope
Traceback (most recent call last):
  File "/usr/bin/diffoscope", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'python-magic' distribution was not found and is required by diffoscope

Can be fixed by putting a `#` in the line that says `python-magic`:

# vim /usr/lib/python3.7/site-packages/diffoscope-98-py3.7.egg-info/requires.txt

Comment 4 Fedora Update System 2018-09-15 11:22:29 UTC
diffoscope-95-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-9ae27e45aa

Comment 5 Fedora Update System 2018-09-15 11:23:14 UTC
diffoscope-100-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-69cac24b55

Comment 6 Fedora Update System 2018-09-17 01:07:16 UTC
diffoscope-100-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-69cac24b55

Comment 7 Fedora Update System 2018-09-17 04:26:20 UTC
diffoscope-95-2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-9ae27e45aa

Comment 8 maic 2018-09-17 12:49:53 UTC
Can confirm that this works on fedora 29:

$ lsb_release -d && diffoscope --help | head -1
Description:	Fedora release 29 (Twenty Nine)
usage: diffoscope [--debug] [--debugger] [--status-fd FD] [--progress]

Comment 9 Fedora Update System 2018-10-10 22:45:29 UTC
diffoscope-95-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2018-10-30 17:15:47 UTC
diffoscope-100-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.