Pull requests

#36 Declined
Repository
diogobaeder
Branch
default
Repository
tarek
Branch
default

Fixes for Python 3

Author
  1. Diogo Baeder
Reviewers
Description

Despite the documentation saying that distribute works with Python 3, this is what I have when trying to install the latest version in a virtualenv with Python 3:

 ~ ❯ tmp ▶ $ ▶mkvirtualenv distribute-py3.3 -p python3.3 --distribute
Running virtualenv with interpreter /usr/bin/python3.3
Using base prefix '/usr'
New python executable in distribute-py3.3/bin/python3.3
Also creating executable in distribute-py3.3/bin/python
Please make sure you remove any previous custom paths from your /home/diogobaeder/.pydistutils.cfg file.
Installing distribute.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done.
Installing pip................done.
 ~ ❯ tmp ▶ $ ▶workon distribute-py3.3
 distribute-py3.3 ▶ ~ ❯ tmp ▶ $ ▶pip install -U distribute
Downloading/unpacking distribute from http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz#md5=e55298c7e3a233df1a47a4881a0c9800
  Downloading distribute-0.6.35.tar.gz (644kB): 644kB downloaded
  Running setup.py egg_info for package distribute
    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "./setuptools/__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "./setuptools/extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "./setuptools/dist.py", line 103
        except ValueError, e:
                         ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 3, in <module>

  File "./setuptools/__init__.py", line 2, in <module>

    from setuptools.extension import Extension, Library

  File "./setuptools/extension.py", line 5, in <module>

    from setuptools.dist import _get_unpatched

  File "./setuptools/dist.py", line 103

    except ValueError, e:

                     ^

SyntaxError: invalid syntax

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/diogobaeder/Envs/distribute-py3.3/build/distribute
Storing complete log in /home/diogobaeder/.pip/pip.log

So I started to fix some of the issues I found so far, in the project (by simply trying to install the working tree into a virtualenv with Python 3, and checking what was going wrong). I had to stop at something that seems like a circular import:

 distribute-py3.3 ▶ ~ ❯ applications ❯ projects ❯ python ❯ distribute ▶ default ▶ $ ▶pip install .
Unpacking /home/diogobaeder/applications/projects/python/distribute
  Running setup.py egg_info for package from file:///home/diogobaeder/applications/projects/python/distribute
    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "./setuptools/__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "./setuptools/extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "./setuptools/dist.py", line 6, in <module>
        from setuptools.command.install import install
      File "./setuptools/command/__init__.py", line 8, in <module>
        from setuptools.command import install_scripts
    ImportError: cannot import name install_scripts
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 3, in <module>

  File "./setuptools/__init__.py", line 2, in <module>

    from setuptools.extension import Extension, Library

  File "./setuptools/extension.py", line 5, in <module>

    from setuptools.dist import _get_unpatched

  File "./setuptools/dist.py", line 6, in <module>

    from setuptools.command.install import install

  File "./setuptools/command/__init__.py", line 8, in <module>

    from setuptools.command import install_scripts

ImportError: cannot import name install_scripts

Anyway, here are the fixes I've done so far. I hope to be able to go on until I have it installable in a Python 3 environment.

  • Learn about pull requests

Comments (4)

  1. Lennart Regebro

    The error you have is a known bug in pip which is also pretty hard to fix. You can install distribute with pip under Python 3, but you can not upgrade it. Since you likely already have distribute installed, otherwise you wouldn't get this error, you can upgrade it with easy_install instead.

    Your changes also break compatibility with Python 2.4 and 2.5.

  2. Diogo Baeder author

    Ah, thanks for the update, I didn't know that these parts were on purpose because of backwards-compatibility only, and that we were using 2to3 before installing. I also didn't know about the pip issue, thanks for letting me know. :-)

    Is there a plan to ditch 2.4 and 2.5 support? How much time will distribute still have to keep up with them?

  3. Lennart Regebro

    There's no official time plan as I'm aware of. At the moment I think we need to wait until the current security review on the cheeseshop is done, and see what it entails.