Skip to content

Installation fails for Python 3 #9

Closed

Description

@robagar

Both pip-3.4 install protobuf and manual installation with python3 setup.py build fail with an invalid syntax exception in ez_setup.py.

Tested 2.6.0 using Python 3.4 on Ubuntu 14.04.

Stack trace from the failed manual installation:

rob@rob-pc:~/lib/protobuf/python$ python3 setup.py build
Traceback (most recent call last):
  File "setup.py", line 199, in <module>
    "Protocol Buffers are Google's data interchange format.",
  File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/dist.py", line 262, in __init__
    self.fetch_build_eggs(attrs['setup_requires'])
  File "/usr/local/lib/python3.4/dist-packages/setuptools/dist.py", line 287, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources.py", line 631, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources.py", line 874, in best_match
    return self.obtain(req, installer)
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources.py", line 886, in obtain
    return installer(requirement)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/dist.py", line 338, in fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/command/easy_install.py", line 613, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/command/easy_install.py", line 643, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/command/easy_install.py", line 833, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/command/easy_install.py", line 1055, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/command/easy_install.py", line 1040, in run_setup
    run_setup(setup_script, args)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/sandbox.py", line 68, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/sandbox.py", line 114, in run
    return func()
  File "/usr/local/lib/python3.4/dist-packages/setuptools/sandbox.py", line 67, in runner
    _execfile(setup_script, ns)
  File "/usr/local/lib/python3.4/dist-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-thdmg8q1/google-apputils-0.4.0/setup.py", line 18, in <module>
    sys.stderr.write(
  File "/tmp/easy_install-thdmg8q1/google-apputils-0.4.0/ez_setup.py", line 79
    except pkg_resources.VersionConflict, e:
                                        ^
SyntaxError: invalid syntax

Activity

  1. added this to the Python 3 support milestone on Sep 3, 2014
  2. gpshead commented on Sep 3, 2014

    @gpshead
    Contributor

    See my comment on #7 with details for what remains to be done for this to work out of the box under Python 3. The setup code hasn't been updated for python 3 yet; the listed files in that issue need running through 2to3 as part of the process.

  3. virtuald commented on Nov 30, 2014

    @virtuald

    I installed the current trunk on OSX with python 3.4.2, and everything works fine.

  4. virtuald commented on Dec 9, 2014

    @virtuald

    I can also confirm Fedora 21 works.

  5. virtuald commented on Dec 17, 2014

    @virtuald

    This bug should be closed, was fixed via #50

  6. bearrito commented on Jan 12, 2015

    @bearrito

    Not working for me on 3.4 in a virtualenv running on Centos 6.6

    pip3.4 install protobuf
    Collecting protobuf
    Using cached protobuf-2.6.1.tar.gz
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.2)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    PEP440Warning,
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.3.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    PEP440Warning,
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.4.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    PEP440Warning,
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.4.1)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    PEP440Warning,
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.1)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    PEP440Warning,
    Traceback (most recent call last):
    File "", line 20, in
    File "/tmp/pip-build-1_vgzphc/protobuf/setup.py", line 200, in
    "Protocol Buffers are Google's data interchange format.",
    File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 271, in init
    self.fetch_build_eggs(attrs['setup_requires'])
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 317, in fetch_build_eggs
    replace_conflicting=True,
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 747, in resolve
    dist = best[req.key] = env.best_match(req, ws, installer)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 999, in best_match
    return self.obtain(req, installer)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 1011, in obtain
    return installer(requirement)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 384, in fetch_build_egg
    return cmd.easy_install(req)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 618, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 648, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 838, in install_eggs
    return self.build_and_install(setup_script, setup_base)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1060, in build_and_install
    self.run_setup(setup_script, setup_base, args)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1045, in run_setup
    run_setup(setup_script, args)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 68, in run_setup
    DirectorySandbox(setup_dir).run(runner)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 114, in run
    return func()
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 67, in runner
    _execfile(setup_script, ns)
    File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
    File "/tmp/easy_install-fpw5bl33/google-apputils-0.4.1/setup.py", line 18, in
    sys.stderr.write
    Complete output from command python setup.py egg_info:
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.2)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.

      PEP440Warning,
    
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.3.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    
      PEP440Warning,
    
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.4.0)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    
      PEP440Warning,
    
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.4.1)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    
      PEP440Warning,
    
    /home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py:2443: PEP440Warning: 'google (apputils-0.1)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
    
      PEP440Warning,
    
    Traceback (most recent call last):
    
      File "<string>", line 20, in <module>
    
      File "/tmp/pip-build-1_vgzphc/protobuf/setup.py", line 200, in <module>
    
        "Protocol Buffers are Google's data interchange format.",
    
      File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
    
        _setup_distribution = dist = klass(attrs)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 271, in __init__
    
        self.fetch_build_eggs(attrs['setup_requires'])
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 317, in fetch_build_eggs
    
        replace_conflicting=True,
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 747, in resolve
    
        dist = best[req.key] = env.best_match(req, ws, installer)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 999, in best_match
    
        return self.obtain(req, installer)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/pkg_resources.py", line 1011, in obtain
    
        return installer(requirement)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/dist.py", line 384, in fetch_build_egg
    
        return cmd.easy_install(req)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 618, in easy_install
    
        return self.install_item(spec, dist.location, tmpdir, deps)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 648, in install_item
    
        dists = self.install_eggs(spec, download, tmpdir)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 838, in install_eggs
    
        return self.build_and_install(setup_script, setup_base)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1060, in build_and_install
    
        self.run_setup(setup_script, setup_base, args)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1045, in run_setup
    
        run_setup(setup_script, args)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 68, in run_setup
    
        DirectorySandbox(setup_dir).run(runner)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 114, in run
    
        return func()
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 67, in runner
    
        _execfile(setup_script, ns)
    
      File "/home/bearrito/.virtualenvs/sketchy/lib/python3.4/site-packages/setuptools/sandbox.py", line 43, in _execfile
    
        exec(code, globals, locals)
    
      File "/tmp/easy_install-fpw5bl33/google-apputils-0.4.1/setup.py", line 18, in <module>
    
        sys.stderr.write
    
    ----------------------------------------
    
  7. virtuald commented on Jan 12, 2015

    @virtuald

    @bearrito , 2.6.1 does not work. You need to install the 3.0.0 alpha (specify the --pre flag to pip to get it).

  8. gregsskyles commented on Aug 2, 2015

    @gregsskyles

    I downloaded 3.0.0-alpha-3 cpp and python, built protoc and python, then 'python setup.py test' dies when it gets to this line from the supplied file google/protobuf/internal/decoder.py:
    except UnicodeDecodeError, e:
    with the clearly Python 2 syntax...are we supposed to use python 2 to build the python 3 compatible version?

  9. added a commit that references this issue on Aug 9, 2018
  10. added a commit that references this issue on Jan 19, 2019
  11. added a commit that references this issue on May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions