ImportError: No module named urllib.parse

4,461 views
Skip to first unread message

John Schmitt

unread,
Jun 18, 2015, 2:02:11 PM6/18/15
to revie...@googlegroups.com
Which module must I install to run rbt?

        # which rbt
       
/usr/bin/rbt
       
# rpm -q --whatprovides /usr/bin/rbt
       
RBTools-0.7.2-1.el7.noarch
       
# rbt --help
       
Traceback (most recent call last):
         
File "/usr/bin/rbt", line 9, in <module>
            load_entry_point
('RBTools==0.7.2', 'console_scripts', 'rbt')()
         
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
           
return get_distribution(dist).load_entry_point(group, name)
         
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
           
return ep.load()
         
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
            entry
= __import__(self.module_name, globals(),globals(), ['__name__'])
         
File "/usr/lib/python2.7/site-packages/rbtools/commands/__init__.py", line 12, in <module>
           
from six.moves.urllib.parse import urlparse
       
ImportError: No module named urllib.parse

However, I can import urllib without error:

        # python
       
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
       
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
       
Type "help", "copyright", "credits" or "license" for more information.
       
>>> import urllib
       
>>>


Barret Rennie

unread,
Jun 18, 2015, 2:04:24 PM6/18/15
to revie...@googlegroups.com
Hi John,

That import doesn’t specifically import urllib.parse; it imports it from Six, a Python 2 — 3 compatibility layer. Can you verify that importing “six.moves.urllib.parse.urlparse” does not work in terminal?

Regards,
Barret Rennie
--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Schmitt

unread,
Jun 18, 2015, 2:34:18 PM6/18/15
to revie...@googlegroups.com


On Thursday, June 18, 2015 at 11:04:24 AM UTC-7, Barret Rennie wrote:
Hi John,

That import doesn’t specifically import urllib.parse; it imports it from Six, a Python 2 — 3 compatibility layer. Can you verify that importing “six.moves.urllib.parse.urlparse” does not work in terminal?

Regards,
Barret Rennie

Hi Barret.  Is this what you mean?

# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import six.moves.urllib.parse.urlparse
Traceback (most recent call last):

 
File "<stdin>", line 1, in <module>
ImportError: No module named urllib.parse.urlparse




Barret Rennie

unread,
Jun 18, 2015, 4:33:55 PM6/18/15
to revie...@googlegroups.com
Hi John,

Yes thats what I mean. I’ll take a look at it.

Can you tell me what version of six is installed?

Thanks,
Barret Rennie

John Schmitt

unread,
Jun 18, 2015, 5:04:48 PM6/18/15
to revie...@googlegroups.com


On Thursday, June 18, 2015 at 1:33:55 PM UTC-7, Barret Rennie wrote:
Hi John,

Yes thats what I mean. I’ll take a look at it.

Can you tell me what version of six is installed?

python-six-1.3.0-4.el7.noarch

 

Stephen Gallagher

unread,
Jun 19, 2015, 10:21:18 AM6/19/15
to revie...@googlegroups.com
OK, so we have a problem here (and one I'm really embarassed not to have noticed; I usually just bump and rebuild RBTools on EPEL 7 assuming it will continue to work there the same way that it does on EPEL 6.

Well, it turns out that EPEL 6 has a newer version of python-six than RHEL 7 does, and RBTools is completely broken on the latter platform because of it. (RHEL/CentOS 7.1 only ships with python-six 1.3.0 and the six.move.urllib.parse support was added in python-six 1.4.0)

The good news is that RHEL/CentOS 7.2 should include python-six 1.9.0[1]. The bad news is that's a ways out, so this will be broken in the meantime.

I have two choices:
1) Revert RBTools back to a version prior to this requirement. That looks like 0.6.3, which is almost certainly not a good idea.
2) Ship RBTools broken in the standard repository and direct people to pull an unofficial python-six package from a COPR repository.

I'm going to go with 2) for now, updating the version of RBTools in EPEL to have an explicit requirement on python-six >= 1.4 so that it won't be installable without using my COPR repository until RHEL 7.2 is released.

Given that RBTools has been broken like this for months, I suspect this won't actually affect a great many people, but I'd still like to ask that the Review Board devs add a note in the online documentation pointing people to drop https://copr.fedoraproject.org/coprs/sgallagh/EPEL7-rbtools/repo/epel-7/sgallagh-EPEL7-rbtools-epel-7.repo into /etc/yum.repos.d until RHEL 7.2 is released. This repository will contain only a rebased python-six package.

It'll be available in a couple hours (right now, there's an unplanned outage going on causing COPR builds to fail).


Christian Hammond

unread,
Jun 19, 2015, 9:31:46 PM6/19/15
to revie...@googlegroups.com, Stephen Gallagher
Hey Stephen,

I haven't been able to look into this yet (and will be out for a few days), but is this something that we can patch in our tree? Or is it a bug in six?

If it's something we can fix in RBTools, then we can just fix it and get a new release out.

Christian 

--
Christian Hammond - chri...@beanbaginc.com
Review Board - https://www.reviewboard.org
Beanbag, Inc. - https://www.beanbaginc.com

David Trowbridge

unread,
Jun 19, 2015, 9:45:36 PM6/19/15
to reviewboard, Stephen Gallagher
This isn't something we can work around in RBTools (at least not without regressing in our python 3.x compatibility). The problem is that older versions of six didn't ship moves for all of the urllib/urllib2 changes.

-David

Stephen Gallagher

unread,
Jun 20, 2015, 8:34:05 AM6/20/15
to David Trowbridge, reviewboard
Unfortunately, as David says, it's not realistic to fix in RBTools. As I said above, it's resolved by updating to a newer Python-six, which is coming in RHEL-7.2. In the meantime, I'm going to provide a COPR repo with the newer Python-six package.
Reply all
Reply to author
Forward
0 new messages