> On Aug. 5, 2015, 9:57 a.m., Sebastien Pahl wrote: > > src/python/interface/setup.py.in, line 27 > > <https://reviews.apache.org/r/37081/diff/6/?file=1032437#file1032437line27> > > > > This seems weird to me. Why do you need to add the bindings for the > > google search engine? > > > > https://pypi.python.org/pypi/google > > haosdent huang wrote: > Yes, I think it is also a bit dirty here. > > Because I try to fix this, could you see @marco comment above. I don't > have other ideas to let it contains `__init__.py` under google, so I add this > dependency. > > ``` > ok - this almost worked :) > Are we missing an __init__.py in google? > > > $ ../configure --prefix=/Users/marco/mesos-inst/lib > > then the usual make && make install - then: > > $ find . |grep __init__ > ./lib/python/site-packages/google/protobuf/__init__.py > ./lib/python/site-packages/google/protobuf/__init__.pyc > ./lib/python/site-packages/google/protobuf/compiler/__init__.py > ./lib/python/site-packages/google/protobuf/compiler/__init__.pyc > ./lib/python/site-packages/google/protobuf/internal/__init__.py > ./lib/python/site-packages/google/protobuf/internal/__init__.pyc > ./lib/python/site-packages/google/protobuf/pyext/__init__.py > ./lib/python/site-packages/google/protobuf/pyext/__init__.pyc > ./lib/python/site-packages/mesos/__init__.py > ./lib/python/site-packages/mesos/__init__.pyc > ./lib/python/site-packages/mesos/interface/__init__.py > ./lib/python/site-packages/mesos/interface/__init__.pyc > ./lib/python/site-packages/mesos/native/__init__.py > ./lib/python/site-packages/mesos/native/__init__.pyc > ./libexec/mesos/python/mesos/__init__.py > > as you can see, there are now the __init__.py files in the right places > under mesos (if you do the same from master there's nothing in there - so, > yay! :) but there is none under the google/ package: > > [~/mesos-inst/lib] $ export PYTHONPATH=./lib/python/site-packages/ > > [~/mesos-inst/lib] $ python > Python 2.7.6 (default, Sep 9 2014, 15:04:36) > [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import mesos > >>> from mesos import native > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/Users/marco/mesos-inst/lib/lib/python/site-packages/mesos/native/__init__.py", > line 17, in <module> > from ._mesos import MesosExecutorDriverImpl > File > "/Users/marco/mesos-inst/lib/lib/python/site-packages/mesos/interface/mesos_pb2.py", > line 4, in <module> > from google.protobuf.internal import enum_type_wrapper > ImportError: No module named google.protobuf.internal > >>> import google.protobuf.internal > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named google.protobuf.internal > > This was on a Mac OSX 10.10 (Yosemite) - about to test the same on an > Ubuntu 14.04 VM, brand new. > ``` > > haosdent huang wrote: > For openstack, we could find `python-openstack-common` which contains > `__init__.py` under [root > namespace](http://packages.ubuntu.com/precise/i386/python-openstack-common/filelist), > althrough openstack have multi submodules. But seems google don't provide > package like this. > > haosdent huang wrote: > I upload a `__init__.py` to https://pypi.python.org/pypi/google-common, > and change dependcy to this. But I think it is also tricky here. > > Sebastien Pahl wrote: > I can't seem to reproduce your problem. > > Here is what I get: > ``` > ? ~ mkvirtualenv -p python2.7 mesos > Running virtualenv with interpreter /usr/bin/python2.7 > New python executable in mesos/bin/python2.7 > Also creating executable in mesos/bin/python > Installing setuptools, pip, wheel...done. > ? ~ pip install protobuf > Collecting protobuf > Requirement already satisfied (use --upgrade to upgrade): setuptools in > ./.virtualenvs/mesos/lib/python2.7/site-packages (from protobuf) > Installing collected packages: protobuf > Successfully installed protobuf-2.6.1 > ? ~ python > Python 2.7.10 (default, May 26 2015, 04:16:29) > [GCC 5.1.0] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import google.protobuf > >>> > ? ~ pip freeze > protobuf==2.6.1 > wheel==0.24.0 > ? ~ ls -l ./.virtualenvs/mesos/lib/python2.7/site-packages/google > total 4 > drwxr-xr-x 5 seb seb 4096 Aug 5 04:18 protobuf > ``` > > No need for the google-common package > > haosdent huang wrote: > If you already install protobuf, you could install this success. But if > you don't install protobuf before, You would get error. Because we > mesos.interface depends on protobuf. When install mesos.interface, it find > protobuf is not installed and it would try to install protobuf to > $PREFIX/lib/pythonX.Y/site-packages. But on install protobuf to > $PREFIX/lib/pythonX.Y/site-packages would cause a problem: Protobuf use pth > to import. If $PREFIX/lib/pythonX.Y/site-packages not in default sys.path, we > could not import it although we set $PREFIX/lib/pythonX.Y/site-packages to > PYTHONPATH.
You are right. Weird. I looked a bit and can't seem to find a better way to fix that. I'm worried that this one-off fix with your google-common package might create problems in the future (maintainability wise)... - Sebastien ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/37081/#review94215 ----------------------------------------------------------- On Aug. 5, 2015, 10:29 a.m., haosdent huang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/37081/ > ----------------------------------------------------------- > > (Updated Aug. 5, 2015, 10:29 a.m.) > > > Review request for mesos, Bernd Mathiske, Kapil Arya, Marco Massenzio, and > Sebastien Pahl. > > > Bugs: MESOS-2337 > https://issues.apache.org/jira/browse/MESOS-2337 > > > Repository: mesos > > > Description > ------- > > Let __init__.py getting installed to > $PREFIX/lib/pythonX.Y/site-packages/mesos. > > > Diffs > ----- > > src/Makefile.am 54eaf205eecb6bf1a9a5c4b5ddad55f46ad635ec > src/python/interface/setup.py.in afcaf7ad6851eb36304a3be92c062cb6b21dbb03 > src/python/setup.py.in 304c4bf87870fbaff2de0615cfd2263bb8a7ad3a > > Diff: https://reviews.apache.org/r/37081/diff/ > > > Testing > ------- > > ## Test steps > ### In CentOS 6.6 > ``` > ./bootstrap > mkdir build > cd build > make -j4 > sudo make install > ``` > > And then execute > > ``` > export PYTHONPATH=/usr/local/lib/python2.6/site-packages > python -c "import mesos; from mesos import native; from mesos import > interface" > ``` > > Check it could success or not. > > Also check the `__init__.py` file > ``` > cat /usr/local/lib/python2.6/site-packages/mesos/__init__.py > ``` > > > Thanks, > > haosdent huang > >