Unable to install rpm packages created via "python setup.py bdist_rpm" due to python3 dependency

Solution Verified - Updated -

Issue

  • How do I build a rpm in python3 environment using python3 from rhscl as it will requires python(abi) = 3.6 when rh-python36-python provides rh-python36-python(abi) = 3.6 ?

  • Example with requests:

    • Download src code from pypi e.g. one of the most common one: https://pypi.org/simple/requests/
    • Make sure you have python 3 installed in your Red Hat environment:
    # yum install rh-python36-python.x86_64`)
    
    • Switch your current environment to python3:
    # scl enable rh-python36 bash
    # python -V
    Python 3.6.3
    
    • Build the rpm:
    cd requests-2.21.0/
    python setup.py bdist_rpm
    
    • Try to install the rpm:
     yum install dist/requests-2.21.0-1.noarch.rpm
    Loaded plugins: enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
    Examining dist/requests-2.21.0-1.noarch.rpm: requests-2.21.0-1.noarch
    Marking dist/requests-2.21.0-1.noarch.rpm to be installed
    Resolving Dependencies
    --> Running transaction check
    ---> Package requests.noarch 0:2.21.0-1 will be installed
    --> Processing Dependency: python(abi) = 3.6 for package: requests-2.21.0-1.noarch
    --> Finished Dependency Resolution
    Error: Package: requests-2.21.0-1.noarch (/requests-2.21.0-1.noarch)
               Requires: python(abi) = 3.6
               Installed: python-2.7.5-77.el7_6.x86_64 (@rhel-7-server-rpms)
                   python(abi) = 2.7
                   python(abi) = 2.7
               Available: python-2.7.5-16.el7.x86_64 (rhel-7-server-rpms)
    ...
    
    • The dependency can't be satisfied as python(abi) = 3.6 is not provided by any package.

Environment

  • Red Hat Enterprise Linux 7
  • python 3
  • SCL Software Collection
  • rpm

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In