RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1626408 - sealert: AttributeError: module 'pkg_resources' has no attribute 'get_distribution'
Summary: sealert: AttributeError: module 'pkg_resources' has no attribute 'get_distrib...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python-pip
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Victor Stinner
QA Contact: Maryna Nalbandian
Lenka Špačková
URL:
Whiteboard:
: 1650327 (view as bug list)
Depends On: 1550368
Blocks: 1623566 1650327
TreeView+ depends on / blocked
 
Reported: 2018-09-07 09:02 UTC by Martin Hoyer
Modified: 2022-03-13 15:31 UTC (History)
12 users (show)

Fixed In Version: python-pip-9.0.3-11.el8
Doc Type: Bug Fix
Doc Text:
When updating a Python package, pip conflicts with dnf: it removes files installed by dnf in /usr. It causes applications run by "python3 -I" to fail to import the module installed by dnf. pip has been fixed to only install new files in /usr/local, but leave files installed by rpm in /usr/local unchanged. For example, it is now possible to have and old version of setuptools installed by dnf in /usr, and a newer version installed by pip in /usr/local.
Clone Of:
Environment:
Last Closed: 2019-06-14 01:53:01 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Hoyer 2018-09-07 09:02:17 UTC
Description of problem:
Without python2, sealert cmds are not working.

# sealert --help
Traceback (most recent call last):
  File "/usr/bin/sealert", line 56, in <module>
    from setroubleshoot.util import get_identity, load_plugins, log_init, log_debug
  File "/usr/lib/python3.6/site-packages/setroubleshoot/util.py", line 348, in <module>
    from sepolicy import get_all_file_types
  File "/usr/lib/python3.6/site-packages/sepolicy/__init__.py", line 9, in <module>
    import setools
  File "/usr/lib64/python3.6/site-packages/setools/__init__.py", line 24, in <module>
    __version__ = pkg_resources.get_distribution("setools").version
AttributeError: module 'pkg_resources' has no attribute 'get_distribution'


Version-Release number of selected component (if applicable):
setroubleshoot-server-3.3.18-1.el8.x86_64
setroubleshoot-plugins-3.3.9-3.el8.noarch
python36-3.6-5.el8+1588+796e359f.x86_64

How reproducible:
100%

Steps to Reproduce:
1.nstall RHEL-8
2.try to run sealert cmd 

Actual results:
AttributeError

Expected results:
no errors

Comment 1 Milos Malik 2018-09-07 11:06:46 UTC
I tried to add / remove various SELinux related packages on my RHEL-8.0 VM, but sealert --help still works. Could you provide NVRs of SELinux related packages?

# rpm -qa libsepol\* libsemanage\* libselinux\* setroubleshoot\* 
policycoreutils\* selinux-policy\* setools\*

Hopefully, the NVRs help us to find the cause. Thanks!

Comment 2 Petr Lautrbach 2018-09-07 15:07:42 UTC
Do you use pip? Please see https://bugzilla.redhat.com/show_bug.cgi?id=1550368#c21 and later

Comment 3 Martin Hoyer 2018-09-07 15:09:39 UTC
(In reply to Petr Lautrbach from comment #2)
> Do you use pip? Please see
> https://bugzilla.redhat.com/show_bug.cgi?id=1550368#c21 and later

Yes, that's it.

Comment 4 Miro Hrončok 2018-09-21 21:02:28 UTC
Fedora has a fix of the primary cause in https://src.fedoraproject.org/rpms/python-pip/pull-request/16

I leave it to the RHEL experts to decide if and how to fix this in RHEL.

This misbehavior has a potential of destroying systems (rendering dnf/yum unusable), so I'd suggest to take it and fix this before RC.

Comment 5 Miro Hrončok 2018-09-21 21:03:52 UTC
https://src.fedoraproject.org/rpms/python-pip/pull-request/10 has a previous (untested) version fo the patch applicable to pip 9.

Comment 6 Petr Viktorin (pviktori) 2018-09-24 14:18:43 UTC
Problem summary: Upgrading a package to the latest *upstream* release using can remove the RPM-installed version, making it unusable with the rest of the system.

It can be reproduced with:

    $ sudo python3 -m pip install --upgrade setuptools
    $ python3 -Es -c 'import pkg_resources; print(pkg_resources.get_distribution("setools").version)'


Expected: a version number, e.g.
4.1.1

Actual result:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'pkg_resources' has no attribute 'get_distribution'

Comment 7 Miro Hrončok 2018-09-24 14:27:25 UTC
I guess:

   s/using can/using sudo pip can/

Comment 10 Victor Stinner 2018-11-16 16:41:05 UTC
Note: The fix doesn't prevent pip to remove files from /usr:

# dnf install python3-pillow
# ls /usr/lib64/python3.6/site-packages/PIL/version.py 
/usr/lib64/python3.6/site-packages/PIL/version.py

# python3 -m pip uninstall Pillow
Uninstalling Pillow-5.1.1:
  /usr/lib64/python3.6/site-packages/PIL
  /usr/lib64/python3.6/site-packages/Pillow-5.1.1-py3.6.egg-info
Proceed (y/n)? y
  Successfully uninstalled Pillow-5.1.1
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# ls /usr/lib64/python3.6/site-packages/PIL/version.py 
ls: cannot access '/usr/lib64/python3.6/site-packages/PIL/version.py': No such file or directory

Comment 11 Tomas Orsava 2018-11-16 21:04:52 UTC
I've did some testing as well, didn't notice any problems. It works fine with venv as well.

The uninstallation is a known issue, we could potentially add a warning for that in a later release.

Comment 12 Victor Stinner 2018-11-19 14:20:03 UTC
python-pip-9.0.3-11.el8 is now ready for testing. See my Comment 9 for possible manual validation of the fix.

Comment 22 RHEL Program Management 2019-06-14 01:53:01 UTC
800AutoClose

The change described in this bug report should be resolved in the RHEL 8.0 release.  It has been closed with a resolution of CURRENTRELEASE.

If the solution does not work for you, open a new bug report.

Comment 23 Tomas Orsava 2019-08-26 15:58:01 UTC
*** Bug 1650327 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.