Skip to content

PyPI installation lacks __init__.py in top-level google directory #713

Closed

Description

@msaniscalchi

This is a weird one, but I couldn't import google.protobuf for a while because the PyPI installation didn't include an init.py file in the top-level google directory. Doing a reinstall produced the same results; the top-level google directory still lacked an init.py file.

By looking at this repo, I would expect to see it there. Perhaps you're doing something in the setup.py that is stripping it out unintentionally?

Activity

  1. dano commented on Aug 20, 2015

    @dano
    Contributor

    setup.py installs the "google" package as a setuptools namespace package, which means it gets installed without an __init__.py.

  2. destijl commented on Oct 26, 2015

    @destijl

    +1 on getting this fixed. It's a common enough problem that there is a stack overflow answer:
    http://stackoverflow.com/questions/13862562/google-protocol-buffers-not-found-when-trying-to-freeze-python-app

    And I've had to work around this in three different build scripts, e.g:
    https://github.com/google/grr/blob/master/vagrant/install_linux.sh#L166

  3. haberman commented on Oct 26, 2015

    @haberman
    Member

    A PR would be most welcome! None of us are Python packaging experts, so fixing this ourselves often requires a fair amount of background research first. If anyone has a simple fix, I'm all ears.

  4. xfxyjwf commented on Jan 21, 2016

    @xfxyjwf
    Contributor

    Seems related to: #1153

  5. craigcitro commented on Jan 26, 2016

    @craigcitro
    Contributor

    So adding the bits I know:

    • The namespace packages PEP suggests using the variant form via pkgutil.
    • I suspect that we should also make a related change to switch from a namespace package to regular package, i.e. switch from namespace_packages to an explicit packages list or just use setuptools.find_packages().

    Now, the real question is this: what happens as we switch? If someone has one of the current versions installed, and we switch over, will everything just work? (Does that ever happen?)

  6. haberman commented on Mar 5, 2016

    @haberman
    Member

    Closing in favor of #1296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions