Bug 1387090

Summary: requests: ImportError: cannot import name utils
Product: [Fedora] Fedora Reporter: Alejandro_Perez <alejandro.perez.torres>
Component: python-requestsAssignee: Fedora Infrastructure SIG <infra-sig>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 25CC: alejandro.perez.torres, berrange, crobinso, cstratak, infra-sig, jcline, jeremy, rbean, sagarun, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-31 17:19:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alejandro_Perez 2016-10-20 04:39:57 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Open a terminal 
2. do sudo virt-manager
3.

Actual results:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager", line 33, in <module>
    from virtinst import util as util
  File "/usr/share/virt-manager/virtinst/__init__.py", line 89, in <module>
    from virtinst.distroinstaller import DistroInstaller
  File "/usr/share/virt-manager/virtinst/distroinstaller.py", line 23, in <module>
    from . import urlfetcher
  File "/usr/share/virt-manager/virtinst/urlfetcher.py", line 34, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 64, in <module>
    from . import utils
ImportError: cannot import name utils


Expected results:
 run the application

Additional info: runned as user, with sudo or root

Comment 1 Cole Robinson 2016-10-25 19:39:17 UTC
Something screwed up with the 'requests' package maybe? What does this show: python -c 'import requests'

Maybe you have an old pip installed version somewhere on your machine

Comment 2 Alejandro_Perez 2016-10-25 22:56:35 UTC
Here is the output:

python -c 'import requests'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 64, in <module>
    from . import utils
ImportError: cannot import name utils

for pip:

 pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
rpm -qa python-pip
python-pip-8.1.2-2.fc25.noarch

Comment 3 Cole Robinson 2016-10-27 11:25:49 UTC
Maybe try 'dnf reinstall python-requests'

if that doesn't fix the python command, can you provide the output of:

  find /usr -type d -name requests

and

  rpm -qa | grep requests

Comment 4 Alejandro_Perez 2016-10-30 16:56:21 UTC
that seems to be the issue python-requests do not install
Sorry the errors are in spanish

Tamaño instalado: 369 k
¿Está de acuerdo [s/N]?: s
Descargando paquetes:
python2-requests-2.10.0-4.fc25.noarch.rpm                                                                                     113 kB/s | 107 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          44 kB/s | 107 kB     00:02     
Ejecutando verificación de operación
Verificación de operación exitosa.
Ejecutando prueba de operaciones
Prueba de operación exitosa.
Ejecutando operación
  Instalando              : python2-requests-2.10.0-4.fc25.noarch                                                                                         1/1 
Error unpacking rpm package python2-requests-2.10.0-4.fc25.noarch
Error unpacking rpm package python2-requests-2.10.0-4.fc25.noarch
error: falló el desempaquetado de archivos  en archivo/usr/lib/python2.7/site-packages/requests/packages/chardet: cpio: rename
¡se suponía que python2-requests-2.10.0-4.fc25.noarch estuviera instalado, pero no lo está!
  Verificando             : python2-requests-2.10.0-4.fc25.noarch                                                                                         1/1 

Fallido:
  python2-requests.noarch 2.10.0-4.fc25                                                                                                                       

¡Listo!

Downloading the package from koji and install it using rpm give me same error:

 sudo rpm -Uvh ~/Downloads/python2-requests-2.10.0-4.fc25.noarch.rpm 
Preparando...                         ################################# [100%]
Actualizando / instalando...
   1:python2-requests-2.10.0-4.fc25   ################################# [100%]
error: falló el desempaquetado de archivos  en archivo/usr/lib/python2.7/site-packages/requests/packages/chardet: cpio: rename
error: python2-requests-2.10.0-4.fc25.noarch: instalar  falló

So looks like python2-request installation will not works.

You requested:

find /usr -type d -name requests
find: ‘/usr/share/doc/pygobject2/examples’: Permission denied
find: ‘/usr/share/doc/gnome-python2-gnomevfs/pygvfsmethod’: Permission denied
find: ‘/usr/share/doc/gnome-python2-bonobo/bonoboui’: Permission denied
find: ‘/usr/share/doc/gnome-python2-bonobo/echo’: Permission denied
find: ‘/usr/share/selinux/targeted/default/active’: Permission denied
find: ‘/usr/share/rhel/secrets’: Permission denied
/usr/share/gems/gems/fog-terremark-0.1.0/lib/fog/compute/terremark/requests
/usr/share/gems/gems/fog-radosgw-0.0.4/lib/fog/radosgw/requests
/usr/share/gems/gems/fog-softlayer-1.0.2/lib/fog/softlayer/requests
/usr/share/gems/gems/fog-atmos-0.1.0/lib/fog/storage/atmos/requests
/usr/share/gems/gems/fog-sakuracloud-1.4.0/lib/fog/sakuracloud/requests
/usr/share/gems/gems/fog-profitbricks-0.0.5/lib/fog/compute/profit_bricks/requests
/usr/share/gems/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/clodo/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/openstack/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/google/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/fogdocker/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/zerigo/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/openvz/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/xenserver/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/dynect/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/dnsimple/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/opennebula/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/ovirt/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/rage4/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/vcloud/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/vcloud_director/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/rackspace/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/libvirt/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/glesys/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/linode/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/dnsmadeeasy/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/bluebox/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/vsphere/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/ibm/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/dreamhost/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/cloudstack/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/go_grid/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/hp/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/joyent/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/internet_archive/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/cloudsigma/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/digitalocean/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/ninefold/requests
/usr/share/gems/gems/fog-1.28.0/lib/fog/bare_metal_cloud/requests
/usr/share/gems/gems/fog-voxel-0.1.0/lib/fog/compute/voxel/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/monitoring/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/dns/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/vpn/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/billing/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/support/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/network/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/storage/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/compute/storm_on_demand/requests
/usr/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/account/storm_on_demand/requests
/usr/share/gems/gems/fog-brightbox-0.9.0/lib/fog/brightbox/requests
/usr/share/gems/gems/fog-serverlove-0.1.2/lib/fog/compute/serverlove/requests
/usr/share/gems/gems/fog-aws-0.7.6/lib/fog/aws/requests
find: ‘/usr/share/polkit-1/rules.d’: Permission denied
find: ‘/usr/libexec/initscripts/legacy-actions/auditd’: Permission denied
/usr/lib/python3.5/site-packages/requests
/usr/lib/python3.5/site-packages/botocore/vendored/requests
/usr/lib/python3.5/site-packages/pip/_vendor/requests
/usr/lib/python2.7/site-packages/requests
/usr/lib/python2.7/site-packages/pip/_vendor/requests
/usr/local/share/gems/doc/fog-radosgw-0.0.4/ri/lib/fog/radosgw/requests
/usr/local/share/gems/doc/fog-radosgw-0.0.4/rdoc/lib/fog/radosgw/requests
/usr/local/share/gems/doc/fog-1.30.0/ri/lib/fog/ovirt/requests
/usr/local/share/gems/doc/fog-1.30.0/rdoc/lib/fog/ovirt/requests
/usr/local/share/gems/gems/fog-terremark-0.1.0/lib/fog/compute/terremark/requests
/usr/local/share/gems/gems/fog-radosgw-0.0.4/tests/radosgw/requests
/usr/local/share/gems/gems/fog-radosgw-0.0.4/lib/fog/radosgw/requests
/usr/local/share/gems/gems/fog-sakuracloud-1.0.1/tests/sakuracloud/requests
/usr/local/share/gems/gems/fog-sakuracloud-1.0.1/lib/fog/sakuracloud/requests
/usr/local/share/gems/gems/fog-profitbricks-0.0.2/tests/profitbricks/requests
/usr/local/share/gems/gems/fog-profitbricks-0.0.2/lib/fog/profitbricks/requests
/usr/local/share/gems/gems/fog-core-1.30.0/spec/fake_app/requests
/usr/local/share/gems/gems/fog-atmos-0.1.0/lib/fog/storage/atmos/requests
/usr/local/share/gems/gems/fog-aws-0.2.2/tests/requests
/usr/local/share/gems/gems/fog-aws-0.2.2/lib/fog/aws/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/clodo/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/openstack/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/fogdocker/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/zerigo/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/xenserver/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/dynect/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/dnsimple/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/opennebula/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/ovirt/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/rage4/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/vcloud/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/vcloud_director/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/rackspace/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/glesys/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/linode/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/dnsmadeeasy/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/brightbox/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/bluebox/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/vsphere/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/ibm/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/dreamhost/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/cloudstack/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/go_grid/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/hp/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/joyent/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/internet_archive/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/cloudsigma/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/digitalocean/requests
/usr/local/share/gems/gems/fog-1.30.0/tests/ninefold/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/clodo/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/openstack/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/fogdocker/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/zerigo/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/openvz/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/xenserver/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/dynect/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/dnsimple/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/opennebula/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/ovirt/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/rage4/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/vcloud/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/vcloud_director/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/rackspace/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/glesys/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/linode/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/dnsmadeeasy/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/bluebox/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/vsphere/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/ibm/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/dreamhost/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/cloudstack/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/go_grid/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/hp/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/joyent/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/internet_archive/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/cloudsigma/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/digitalocean/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/ninefold/requests
/usr/local/share/gems/gems/fog-1.30.0/lib/fog/bare_metal_cloud/requests
/usr/local/share/gems/gems/fog-powerdns-0.1.1/lib/fog/powerdns/requests
/usr/local/share/gems/gems/fog-voxel-0.1.0/tests/requests
/usr/local/share/gems/gems/fog-voxel-0.1.0/lib/fog/compute/voxel/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/monitoring/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/dns/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/vpn/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/billing/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/support/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/network/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/storage/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/compute/storm_on_demand/requests
/usr/local/share/gems/gems/fog-storm_on_demand-0.1.1/lib/fog/account/storm_on_demand/requests
/usr/local/share/gems/gems/fog-brightbox-0.7.1/lib/fog/brightbox/requests
/usr/local/share/gems/gems/fog-ecloud-0.1.1/lib/fog/compute/ecloud/requests
/usr/local/share/gems/gems/fog-serverlove-0.1.2/tests/compute/requests
/usr/local/share/gems/gems/fog-serverlove-0.1.2/lib/fog/compute/serverlove/requests
/usr/local/share/gems/gems/fog-softlayer-0.4.6/tests/softlayer/requests
/usr/local/share/gems/gems/fog-softlayer-0.4.6/lib/fog/softlayer/requests
/usr/local/share/gems/gems/fog-google-0.0.5/tests/requests
/usr/local/share/gems/gems/fog-google-0.0.5/lib/fog/google/requests

and

rpm -qa | grep requests
python3-requests-2.10.0-4.fc25.noarch
python2-requests-kerberos-0.10.0-2.fc25.noarch

Comment 5 Jeremy Cline 2016-10-31 13:04:40 UTC
*** Bug 1390003 has been marked as a duplicate of this bug. ***

Comment 6 Alejandro_Perez 2016-10-31 16:51:48 UTC
Solved removed requests using pip allow me to install python-requests.

Comment 7 Jeremy Cline 2016-10-31 17:19:11 UTC
(In reply to Alejandro_Perez from comment #6)
> Solved removed requests using pip allow me to install python-requests.

Great! I'm going to close this bug, then.