2

when i try to run git-review i get the below error:

[root@localhost ~]# git-review
Traceback (most recent call last):
  File "/usr/bin/git-review", line 7, in <module>
    from git_review.cmd import main
  File "/usr/lib/python2.7/site-packages/git_review/cmd.py", line 33, in <module>


    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 32, in <module>
    from .exceptions import InvalidURL
  File "/usr/lib/python2.7/site-packages/requests/exceptions.py", line 10, in <module>
    from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
  File "/usr/lib/python2.7/site-packages/requests/packages/__init__.py", line 95, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3'

but the requests package is already installed on the system:

[root@localhost ~]# yum install python-requests
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.net.in
 * epel: del-mirrors.extreme-ix.org
 * extras: del-mirrors.extreme-ix.org
 * updates: del-mirrors.extreme-ix.org
Package python-requests-2.6.0-1.el7_1.noarch already installed and latest version
Nothing to do

This is my os config:

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

I tried uninstalling/installing packages from scratch but no luck. any help would be great here.

EDIT: Here is the extra info asked in the comments:

[root@localhost ~]# pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

[root@localhost ~]# python --version
Python 2.7.5

[root@localhost ~]# pip freeze
backports.ssl-match-hostname==3.4.0.2
blivet==0.61.15.65
Brlapi==0.6.0
certifi==2018.4.16
cffi==1.6.0
chardet==3.0.4
configobj==4.7.2
configshell-fb==1.1.23
coverage==3.6b3
cryptography==1.7.2
cssselect==1.0.3
cupshelpers==1.0
decorator==3.4.0
di==0.3
dnspython==1.12.0
enum34==1.0.4
ethtool==0.8
firstboot==19.5
fros==1.0
git-review==1.26.0
gssapi==1.2.0
idna==2.6
iniparse==0.4
initial-setup==0.3.9.40
ipaddress==1.0.16
IPy==0.75
javapackages==1.0.0
jwcrypto==0.2.1
kitchen==1.1.1
kmod==0.1
langtable==0.0.31
lxml==4.2.1
netaddr==0.7.5
netifaces==0.10.4
ntplib==0.3.2
perf==0.1
ply==3.4
policycoreutils-default-encoding==0.1
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.14
pycups==1.9.63
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
pyinotify==0.9.4
pykickstart==1.99.66.12
pyliblzma==0.5.3
pyOpenSSL==0.13.1
pyparsing==1.5.6
pyparted==3.9
pysmbc==1.0.13
python-augeas==0.5.0
python-dateutil==1.5
python-dmidecode==3.10.13
python-ldap==2.4.15
python-linux-procfs==0.4.9
python-meh==0.25.2
python-nss==0.16.0
python-yubico==1.2.3
pytz==2016.10
pyudev==0.15
pyusb==1.0.0b1
pyxattr==0.5.1
PyYAML==3.12
qrcode==5.0.1
requests==2.18.4
robotframework==3.0.2
rtslib-fb==2.1.63
schedutils==0.4
seobject==0.1
sepolicy==1.1
setroubleshoot==1.1
six==1.9.0
slip==0.4.0
slip.dbus==0.4.0
SSSDConfig==1.15.2
targetcli-fb===2.1.fb46
urlgrabber==3.10
urllib3==1.22
urwid==1.1.1
yum-langpacks==0.4.2
yum-metadata-parser==1.1.4
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)

EDIT 2:

>>> import requests.packages.urllib3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 32, in <module>
    from .exceptions import InvalidURL
  File "/usr/lib/python2.7/site-packages/requests/exceptions.py", line 10, in <module>
    from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
  File "/usr/lib/python2.7/site-packages/requests/packages/__init__.py", line 95, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3'



>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 25, in <module>
    from . import certs
ImportError: cannot import name certs
cool77
  • 1,086
  • 4
  • 15
  • 31
  • 3
    I'm pretty sure CentOS 7 comes with both Python 2 and 3. I'm not sure which one is the default one, but if it's the 3.x that's default, the `python-requests` RPM would be for 3.x, and the default `pip` would also be looking at the 3.x packages—but `git-review` is explicitly using 2.x. – abarnert Apr 26 '18 at 18:29
  • has anyone got a chance to have a look at it and help me out? – cool77 Apr 29 '18 at 06:27
  • Can *you* import `requests.packages.urllib3`? – Ignacio Vazquez-Abrams Apr 29 '18 at 07:32
  • @IgnacioVazquez-Abrams i tried importing `requests.packages.urllib3` and i get the same error. plz see my EDIT 2 in the question for the output. – cool77 Apr 29 '18 at 18:15
  • any pointers on this will be great ? – cool77 Apr 30 '18 at 18:29

1 Answers1

0
  • try pip install --upgrade --force-reinstall 'requests==2.6.0' urllib3
  • if not try yum reinstall python ,it works well for me.
Yingl
  • 1
  • 1