Error: Problem: conflicting requests - nothing provides /usr/bin/python needed by python-chardet in CentOS 8

12,981

CentOS/RHEL 8 doesn't have any user-facing Python installed by default.

It has Python 3 installed for system apps like dnf, but to use it as a user, you need sudo dnf install python3.

Similarly, Python 2 and everything for it can be installed by using the appropriate package name suffix. To install Python 2 and the module you need:

sudo dnf install python2 python2-chardet

The recommendation/default is that the unversioned python command should not work and you should invoke the desired Python version on the shell by typing python2 instead of python.

If, for whatever reason you need unversioned python command to invoke Python 2, use the alternatives system:

sudo alternatives --set python /usr/bin/python2
Share:
12,981
shreyas.k
Author by

shreyas.k

Updated on June 14, 2022

Comments

  • shreyas.k
    shreyas.k almost 2 years

    I am using CentOS 8 and want to download a library for Python2.

    CentOS 8 has Python3 and its libraries installed by default.

    I want to download python-chardet library for Python2. So I tried to install it as below -

    $ sudo yum install python-chardet

    I got this error -

    No match for argument: python-chardet
    Error: Unable to find a match: python-chardet
    

    I searched for solution and as per this document you have to download its RPM binary and install it. https://centos.pkgs.org/7/centos-x86_64/python-chardet-2.2.1-3.el7.noarch.rpm.html

    Downloading the binary file -

    $ wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm

    Using this rpm library I tried to install python-chardet as below -

    $ sudo yum install ./python-chardet-2.2.1-3.el7.noarch.rpm

    Here I got an error like this -

    Error:
     Problem:  conflicting requests
      - nothing provides /usr/bin/python needed by python-chardet-2.2.1-3.el7.noarch
    

    Python version is

    $ python -V

    $ Python 2.7.16

    /usr/bin/python returned this

    Python 2.7.16 (default, Nov 17 2019, 00:07:27)

    GCC 8.3.1 (RedHat) on linux2

    Any help regarding this is much appreciated.

  • shreyas.k
    shreyas.k about 4 years
    python2-chardet can be installed as you said but i need to specifically install python-chardet library in CentOS 8..
  • Danila Vershinin
    Danila Vershinin about 4 years
    As I have explained, it is the same thing. With suffix
  • dny238
    dny238 over 3 years
    I read this over 2x and still can't get python-chardet installed. Are you suggesting to change the alternate python from 2 to 3? Neither work to allow python-chardet to install for me.
  • yolob 21
    yolob 21 over 2 years
    @dny238 did you manage to solve this? I am encountering the same error
  • firasKoubaa
    firasKoubaa about 2 years
    Have same problem , changing the alternative didn t fix it , did you manage how to install it ?
  • Danila Vershinin
    Danila Vershinin about 2 years
    @firasKoubaa as it was explained, you won't have any luck installing python-chardet because the equivalent package name in CentOS 8 is python*2*-chardet. Why do you insist on installing it with the obsolete name python-chardet and not with the correct python2-chardet?