Repository: pypa/pip

Issue:
SyntaxError in vendored html5lib
If you `pip install pip==9 -v`, it ends with:

    Installing collected packages: pip
      *** Error compiling '/tmp/pip-build-xvt_4sme/pip/pip/_vendor/html5lib/treewalkers/etree.py'...
        File "/tmp/pip-build-xvt_4sme/pip/pip/_vendor/html5lib/treewalkers/etree.py", line 13
          from pip._vendor. import string_types
                                 ^
      SyntaxError: invalid syntax
    
    
      changing mode of /home/xfernandez/.virtualenvs/tmp-8096e8a0e248648/bin/pip to 755
      changing mode of /home/xfernandez/.virtualenvs/tmp-8096e8a0e248648/bin/pip3 to 755
      changing mode of /home/xfernandez/.virtualenvs/tmp-8096e8a0e248648/bin/pip3.5 to 755
    Successfully installed pip-9.0.0
    Cleaning up...

cc @dstufft 


Discussion:
https://github.com/pypa/pip/blob/c8e8a99b7a6f9404536bc9d895a1a42a060f7f91/pip/_vendor/html5lib/treewalkers/etree.py#L13

By the way, related to #4055, it might be interesting to commit the scripts used currently for the different vendoring.

Hi,
i also receive similar install 9.0
it seems to install - with these errors 

  File "build\bdist.win32\egg\pip_vendor\html5lib\treewalkers\etree.py", line 13
    from pip._vendor. import string_types
                           ^
SyntaxError: invalid syntax

  File "c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg\pip_vendor\html5lib\treewalkers\etree.py", line 13
    from pip._vendor. import string_types
                           ^
SyntaxError: invalid syntax

Processing pip-9.0.0.tar.gz
Writing c:\users\adm-ru~1\appdata\local\temp\easy_install-hnrnav\pip-9.0.0\setup.cfg
Running pip-9.0.0\setup.py -q bdist_egg --dist-dir c:\users\adm-ru~1\appdata\local\temp\easy_install-hnrnav\pip-9.0.0\egg-dist-tmp-i3bjdv
removing 'c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg' (and everything under it)
creating c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg
Extracting pip-9.0.0-py2.7.egg to c:\program files (x86)\python27\arcgis10.3\lib\site-packages
pip 9.0.0 is already the active version in easy-install.pth
Installing pip-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2.7-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2.7.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2.7.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
Installing pip2.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts

Installed c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg
Processing dependencies for pip==9.0.0
Finished processing dependencies for pip==9.0.0

Pip still works after this error yes? Or is it completely broken?

Sent from my iPhone

> On Nov 2, 2016, at 6:46 PM, rudyvogt notifications@github.com wrote:
> 
> Hi,
> i also receive similar install 9.0
> it seems to install - with these errors
> 
> File "build\bdist.win32\egg\pip_vendor\html5lib\treewalkers\etree.py", line 13
> from pip._vendor. import string_types
> ^
> SyntaxError: invalid syntax
> 
> File "c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg\pip_vendor\html5lib\treewalkers\etree.py", line 13
> from pip._vendor. import string_types
> ^
> SyntaxError: invalid syntax
> 
> Processing pip-9.0.0.tar.gz
> Writing c:\users\adm-ru~1\appdata\local\temp\easy_install-hnrnav\pip-9.0.0\setup.cfg
> Running pip-9.0.0\setup.py -q bdist_egg --dist-dir c:\users\adm-ru~1\appdata\local\temp\easy_install-hnrnav\pip-9.0.0\egg-dist-tmp-i3bjdv
> removing 'c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg' (and everything under it)
> creating c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg
> Extracting pip-9.0.0-py2.7.egg to c:\program files (x86)\python27\arcgis10.3\lib\site-packages
> pip 9.0.0 is already the active version in easy-install.pth
> Installing pip-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2.7-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2.7.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2.7.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2-script.py script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2.exe script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> Installing pip2.exe.manifest script to C:\Program Files (x86)\Python27\ArcGIS10.3\Scripts
> 
> Installed c:\program files (x86)\python27\arcgis10.3\lib\site-packages\pip-9.0.0-py2.7.egg
> Processing dependencies for pip==9.0.0
> Finished processing dependencies for pip==9.0.0
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

Apparently it globally works, it just makes some noise during the installation.
No urgency here 😊

Ok. I was SUPER confused how none of our tests or manual testing caught this, but if it works it just poops out a message with -v that makes sense. 

Sent from my iPhone

> On Nov 2, 2016, at 7:11 PM, Xavier Fernandez notifications@github.com wrote:
> 
> Apparently it globally works, it just makes some noise during the installation.
> No urgency here 😊
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

@dstufft 
yes it seems to work after install - looks like a bit of noise. I could install other packages/upgrade
i have python 2.7.8 installed

> Pip still works after this error yes? Or is it completely broken?


Resolving patch:
diff --git a/pip/_vendor/html5lib/treewalkers/etree.py b/pip/_vendor/html5lib/treewalkers/etree.py
--- a/pip/_vendor/html5lib/treewalkers/etree.py
+++ b/pip/_vendor/html5lib/treewalkers/etree.py
@@ -10,7 +10,7 @@
 
 import re
 
-from pip._vendor. import string_types
+from pip._vendor.six import string_types
 
 from . import base
 from .._utils import moduleFactoryFactory


Test patch: