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 1459947 - python-cryptography and python2-cryptography should require python-setuptools as a dependency
Summary: python-cryptography and python2-cryptography should require python-setuptools...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-cryptography
Version: 7.3
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Christian Heimes
QA Contact: ipa-qe
URL:
Whiteboard:
: 1526064 1538609 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-08 16:04 UTC by jcastran
Modified: 2021-09-09 12:21 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 11:36:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0720 0 None None None 2018-04-10 11:37:05 UTC

Description jcastran 2017-06-08 16:04:53 UTC
Description of problem:
Users are unable to import "fernet" which is provided by python-cryptography and python2-cryptography unless python-setuptools is installed. python-setuptools is not a dependency of this package and is not installed by default so importing fernet results in :

Traceback (most recent call last):
  File "./t.py", line 2, in <module>
    from cryptography.fernet import Fernet
  File "/usr/lib64/python2.7/site-packages/cryptography/fernet.py", line 16, in <module>
    from cryptography.hazmat.backends import default_backend
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
ImportError: No module named pkg_resources

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Version-Release number of selected component (if applicable):
   python-setuptools-0.9.8-3.el7.noarch
   python2-cryptography-1.3.1-3.el7.x86_64

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How reproducible:
   Everytime

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steps to Reproduce:
1. confirm python-setuptools is NOT installed
2. # yum install python-cryptography
3. # python
   >> from cryptography import fernet

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Actual results:

Traceback (most recent call last):
  File "./t.py", line 2, in <module>
    from cryptography.fernet import Fernet
  File "/usr/lib64/python2.7/site-packages/cryptography/fernet.py", line 16, in <module>
    from cryptography.hazmat.backends import default_backend
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
ImportError: No module named pkg_resources

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expected results:

python-cryptography and python2-cryptography pull in python-setuptools as a dependency.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additional info:

# python
   Python 2.7.5 (default, Feb 11 2014, 07:46:25) 
   [GCC 4.8.2 20140120 (Red Hat 4.8.2-13)] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import os.path
   >>> print os.path.abspath(pkg_resources.__file__)
   /usr/lib/python2.7/site-packages/pkg_resources.pyc

# rpm -qf /usr/lib/python2.7/site-packages/pkg_resources.pyc
       python-setuptools-0.9.8-4.el7.noarch

Comment 2 Kyle Walker 2017-06-08 16:26:06 UTC
The failure is due to the following import operation:

    /usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py
    <snip>
    import pkg_resources
    <snip>


The specfile looks to just need:

diff --git a/python-cryptography.spec b/python-cryptography.spec
index b9c3bd6..eae04c3 100644
--- a/python-cryptography.spec
+++ b/python-cryptography.spec
@@ -82,6 +82,7 @@ Requires:       python-six >= 1.4.1
 Requires:       python-cffi >= 1.4.1
 Requires:       python-enum34
 Requires:       python-ipaddress
+Requires:       python-setuptools
 
 %description -n python2-cryptography
 cryptography is a package designed to expose cryptographic primitives and
@@ -98,6 +99,7 @@ Requires:       python3-idna >= 2.0
 Requires:       python3-pyasn1 >= 0.1.8
 Requires:       python3-six >= 1.4.1
 Requires:       python3-cffi >= 1.4.1
+Requires:       python3-setuptools
 
 %description -n python3-cryptography
 cryptography is a package designed to expose cryptographic primitives and


- Kyle Walker

Comment 8 Mohammad Rizwan 2018-01-19 07:52:35 UTC
Steps:
1. confirm python-setuptools is NOT installed
2. # yum install python-cryptography
3. # python
   >> from cryptography import fernet

Actual result:

[root@master ~]# rpm -qa python-setuptools
[root@master ~]# yum install python-cryptography
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package python2-cryptography.x86_64 0:1.7.2-2.el7 will be installed
--> Processing Dependency: python-setuptools for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Running transaction check
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================
 Package                                          Arch                               Version                                 Repository                                 Size
=============================================================================================================================================================================
Installing:
 python2-cryptography                             x86_64                             1.7.2-2.el7                             beaker-Server                             503 k
Installing for dependencies:
 python-setuptools                                noarch                             0.9.8-7.el7                             beaker-Server                             397 k

Transaction Summary
=============================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 899 k
Installed size: 4.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): python-setuptools-0.9.8-7.el7.noarch.rpm                                                                                                       | 397 kB  00:00:00     
(2/2): python2-cryptography-1.7.2-2.el7.x86_64.rpm                                                                                                    | 503 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                        5.7 MB/s | 899 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-setuptools-0.9.8-7.el7.noarch                                                                                                                      1/2 
  Installing : python2-cryptography-1.7.2-2.el7.x86_64                                                                                                                   2/2 
  Verifying  : python-setuptools-0.9.8-7.el7.noarch                                                                                                                      1/2 
  Verifying  : python2-cryptography-1.7.2-2.el7.x86_64                                                                                                                   2/2 

Installed:
  python2-cryptography.x86_64 0:1.7.2-2.el7                                                                                                                                  

Dependency Installed:
  python-setuptools.noarch 0:0.9.8-7.el7                                                                                                                                     

Complete!
[root@master ~]# python
Python 2.7.5 (default, Dec  8 2017, 16:39:59) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-25)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography import fernet
>>> exit(0)
[root@master ~]# 


Based on above observations, marking bug as verified.

Comment 11 errata-xmlrpc 2018-04-10 11:36:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2018:0720

Comment 12 Christian Heimes 2019-02-26 16:46:16 UTC
*** Bug 1538609 has been marked as a duplicate of this bug. ***

Comment 13 Christian Heimes 2019-02-26 16:47:16 UTC
*** Bug 1526064 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.