Description of problem: fedpkg doesn't work at all, it errors with pkg_resources.DistributionNotFound: The 'rpm-py-installer' distribution was not found and is required by rpkg Version-Release number of selected component (if applicable): fedpkg-1.33-1.fc29 How reproducible: Easy Steps to Reproduce: 1. fedpkg Actual results: Traceback (most recent call last): File "/usr/bin/fedpkg", line 6, in <module> from pkg_resources import load_entry_point File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3088, in <module> @_call_aside File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3072, in _call_aside f(*args, **kwargs) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 574, in _build_master ws.require(__requires__) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 778, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'rpm-py-installer' distribution was not found and is required by rpkg Expected results: no error :)
rpkg depedns on rpm-py-installer but in fact in Fedora it depends on python3-rpm. So we should patch setup.py in Fedora spec to not have this: $ cat /usr/lib/python3.6/site-packages/rpkg-1.54-py3.6.egg-info/requires.txt ... rpm-py-installer However, it later fails with: pkg_resources.DistributionNotFound: The 'koji>=1.15' distribution was not found and is required by rpkg And even if I remove koji, it fails with: $ fedpkg Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/fedpkg/__main__.py", line 84, in main sys.exit(client.args.command()) AttributeError: 'Namespace' object has no attribute 'command' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/fedpkg", line 11, in <module> load_entry_point('fedpkg==1.33', 'console_scripts', 'fedpkg')() File "/usr/lib/python3.6/site-packages/fedpkg/__main__.py", line 89, in main (client.args.command.__name__, e)) AttributeError: 'Namespace' object has no attribute 'command' But that's a different problem and still allows to run a fedpkg sub-commnad.
https://pagure.io/rpkg/pull-request/319
*** Bug 1579422 has been marked as a duplicate of this bug. ***
Here is what another python project fixed this kind of issue. https://github.com/rebase-helper/rebase-helper/blob/master/setup.py
Sorry, maybe I should add a note on the document of rpm-py-installer for people to consider this situation. I opened the ticket here. https://github.com/junaruga/rpm-py-installer/issues/134
For the python3-koji, the package does not include egg-info docker run --rm -i -t registry.fedoraproject.org/fedora:28 [root@bd497b97ff79 /]# dnf install python3-koji [snip] [root@bd497b97ff79 /]# python3 Python 3.6.4 (default, Feb 24 2018, 19:29:29) [GCC 8.0.1 20180222 (Red Hat 8.0.1-0.16)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pkg_resources >>> pkg_resources.get_distribution('koji') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 564, in get_distribution dist = get_provider(dist) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 436, in get_provider return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 984, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 870, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'koji' distribution was not found and is required by the application >>> [root@bd497b97ff79 /]# rpm -q --list python3-koji /usr/lib/python3.6/site-packages/koji /usr/lib/python3.6/site-packages/koji/__init__.py /usr/lib/python3.6/site-packages/koji/__pycache__ /usr/lib/python3.6/site-packages/koji/__pycache__/__init__.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/__init__.cpython-36.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/plugin.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/plugin.cpython-36.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/util.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/util.cpython-36.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/xmlrpcplus.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji/__pycache__/xmlrpcplus.cpython-36.pyc /usr/lib/python3.6/site-packages/koji/plugin.py /usr/lib/python3.6/site-packages/koji/util.py /usr/lib/python3.6/site-packages/koji/xmlrpcplus.py /usr/lib/python3.6/site-packages/koji_cli /usr/lib/python3.6/site-packages/koji_cli/__init__.py /usr/lib/python3.6/site-packages/koji_cli/__pycache__ /usr/lib/python3.6/site-packages/koji_cli/__pycache__/__init__.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji_cli/__pycache__/__init__.cpython-36.pyc /usr/lib/python3.6/site-packages/koji_cli/__pycache__/commands.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji_cli/__pycache__/commands.cpython-36.pyc /usr/lib/python3.6/site-packages/koji_cli/__pycache__/lib.cpython-36.opt-1.pyc /usr/lib/python3.6/site-packages/koji_cli/__pycache__/lib.cpython-36.pyc /usr/lib/python3.6/site-packages/koji_cli/commands.py /usr/lib/python3.6/site-packages/koji_cli/lib.py I'm going to file an issue for koji as well. rpkg might have to be patched before Koji team fixes it.
(In reply to Jun Aruga from comment #4) > Here is what another python project fixed this kind of issue. > https://github.com/rebase-helper/rebase-helper/blob/master/setup.py Thank you for the info. After installing rpm-py-installer, there are both distributions rpm-py-installer and rpm. Also in a f28 container, >>> import pkg_resources >>> pkg_resources.get_distribution('rpm') rpm 4.14.1 (/root/env/lib/python3.6/site-packages/rpm-4.14.1-py3.6-linux-x86_64.egg) >>> pkg_resources.get_distribution('rpm-py-installer') rpm-py-installer 0.7.0 (/root/env/lib/python3.6/site-packages) I think, for the use case of rpkg, we could do try: import rpm except ImportError: rpm = None if rpm is None: # For the case of running in a clean Python virtualenv. # Next time, rpm will be available. install_requires.append('rpm-py-installer') else: # Whatever in a Python virtualenv with rpm-py-installer installed, # and python3-rpm is installed in the system. install_requires.append('rpm')
(In reply to cqi from comment #6) > I'm going to file an issue for koji as well. rpkg might have to be patched > before Koji team fixes it. There was one filed a few days ago https://pagure.io/koji/issue/912
> Thank you for the info. After installing rpm-py-installer, there are both distributions rpm-py-installer and rpm. Also in a f28 container, Yes, that's an expected behavior. > I think, for the use case of rpkg, we could do > ... Sure, it looks good logic.
Or like this as the simpler version. ``` try: import rpm except ImportError: # For the case of running in a clean Python virtualenv. # Next time, rpm will be available. install_requires.append('rpm-py-installer') else: # Whatever in a Python virtualenv with rpm-py-installer installed, # and python3-rpm is installed in the system. install_requires.append('rpm') ```
(In reply to Jun Aruga from comment #10) > Or like this as the simpler version. > > ``` > try: > import rpm > except ImportError: > # For the case of running in a clean Python virtualenv. > # Next time, rpm will be available. > install_requires.append('rpm-py-installer') > else: > # Whatever in a Python virtualenv with rpm-py-installer installed, > # and python3-rpm is installed in the system. > install_requires.append('rpm') > ``` Awesome! :)
Hopefully importing rpm during rpmbuild won't blow up into our faces. If it does, try to pkg_resources.get_distribution('rpm') without importing it.
import pkg_resources try: pkg_resources.get_distribution('rpm') except pkg_resources.DistributionNotFound: install_requires.append('rpm-py-installer') else: install_requires.append('rpm')
Thank you all for the great ideas. PR: https://pagure.io/rpkg/pull-request/320
Just to be clear, the workaround is to remove koji and rpm-py-installer lines from /usr/lib/python3.6/site-packages/rpkg-1.54-py3.6.egg-info/requires.txt
(In reply to Miro Hrončok from comment #1) > And even if I remove koji, it fails with: > > $ fedpkg > Traceback (most recent call last): > File "/usr/lib/python3.6/site-packages/fedpkg/__main__.py", line 84, in > main > sys.exit(client.args.command()) > AttributeError: 'Namespace' object has no attribute 'command' > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/usr/bin/fedpkg", line 11, in <module> > load_entry_point('fedpkg==1.33', 'console_scripts', 'fedpkg')() > File "/usr/lib/python3.6/site-packages/fedpkg/__main__.py", line 89, in > main > (client.args.command.__name__, e)) > AttributeError: 'Namespace' object has no attribute 'command' > > But that's a different problem and still allows to run a fedpkg sub-commnad. This has been reported upstream as https://pagure.io/fedpkg/issue/221
May I suggest to stop looking for a perfect solution and patch this quickly in spec as soon as possible? People are asking on mailing list about this, this affects a lot of Fedora packagers.
A patch here and under testing now. https://src.fedoraproject.org/rpms/rpkg/pull-request/19. Once it is ready and merged, it'll be quick to build new packages.
@cqi, with all due respect breaking stuff for everyone on Thursday then still waiting for someone else to review/fix/push on Monday is not really ideal packager conduct.
Rawhide has new build. Please try it.
(In reply to cqi from comment #20) > Rawhide has new build. Please try it. rpkg-1.54-2.fc29 works for me. Thanks
rpkg-1.54-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e720c88e8f
rpkg-1.54-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-035317d7ea
rpkg-1.54-2.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-ad307d35b4
rpkg-1.54-2.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-69704fa410
rpkg-1.54-2.el7 has been pushed to the Fedora EPEL 7 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-EPEL-2018-69704fa410
rpkg-1.54-2.el6 has been pushed to the Fedora EPEL 6 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-EPEL-2018-ad307d35b4
rpkg-1.54-2.fc27 has been pushed to the Fedora 27 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-035317d7ea
rpkg-1.54-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-e720c88e8f
rpkg-1.54-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
rpkg-1.54-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.
rpkg-1.54-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.
rpkg-1.54-2.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.