[ 
https://issues.apache.org/jira/browse/BEAM-9130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17017633#comment-17017633
 ] 

Chad Dombrova edited comment on BEAM-9130 at 1/17/20 1:37 AM:
--------------------------------------------------------------

IIRC, the reason it only happens for python2 is that the `google` package in 
python2 uses .pth files to find sub-packages, and .pth files must be in a 
"site" directory, so if it's installed in a non-standard way (into a directory 
that isn't one of the python interpreter's official site-packages directories), 
it won't be able to find the sub-packages.   It is possible to mark a directory 
as a "site" directory using site.addsitedir().  For more info see 
[https://docs.python.org/2/library/site.html]

In python3 namespace packages were redesigned in order to avoid this brittle 
workflow:  [https://www.python.org/dev/peps/pep-0420/]

If this test went through tox, I'm pretty sure this error would not occur.

What are the chances that we can work on getting all tests running through tox 
in the near term?

 

 

 

 

 


was (Author: chadrik):
IIRC, the reason it only happens for python2 is that the `google` package in 
python2 uses .pth files to find sub-packages, and .pth files must be in a 
"site" directory, so if it's installed in a non-standard way (one that doesn't 
end up in the python interpreter's official site-packages directory), it won't 
be able to find the sub-packages.   It is possible to mark a directory as a 
"site" directory using site.addsitedir().  For more info see 
[https://docs.python.org/2/library/site.html]

In python3 namespace packages were redesigned in order to avoid this brittle 
workflow:  [https://www.python.org/dev/peps/pep-0420/]

If this test went through tox, I'm pretty sure this error would not occur.

What are the chances that we can work on getting all tests running through tox 
in the near term?

 

 

 

 

 

> sdks:python:test-suites:direct:py2:hdfsIntegrationTest is failing with 
> ImportError: No module named google.protobuf.message
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-9130
>                 URL: https://issues.apache.org/jira/browse/BEAM-9130
>             Project: Beam
>          Issue Type: Improvement
>          Components: test-failures
>            Reporter: Valentyn Tymofieiev
>            Priority: Major
>              Labels: currently-failing
>
> From logs:
> {noformat}
> 16:33:50    File "/usr/local/lib/python2.7/multiprocessing/process.py", line 
> 267, in _bootstrap
> 16:33:50      self.run()
> 16:33:50    File "/usr/local/lib/python2.7/multiprocessing/process.py", line 
> 114, in run
> 16:33:50      self._target(*self._args, **self._kwargs)
> 16:33:50    File "/app/sdks/python/gen_protos.py", line 357, in 
> _install_grpcio_tools_and_generate_proto_files
> 16:33:50      generate_proto_files(force=force)
> 16:33:50    File "/app/sdks/python/gen_protos.py", line 324, in 
> generate_proto_files
> 16:33:50      generate_urn_files(log, out_dir)
> 16:33:50    File "/app/sdks/python/gen_protos.py", line 65, in 
> generate_urn_files
> 16:33:50      import google.protobuf.message as message
> 16:33:50  ImportError: No module named google.protobuf.message
> 16:33:50  Traceback (most recent call last):
> 16:33:50    File "setup.py", line 305, in <module>
> 16:33:50      'mypy': generate_protos_first(mypy),
> 16:33:50    File 
> "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in 
> setup
> 16:33:50      return distutils.core.setup(**attrs)
> 16:33:50    File "/usr/local/lib/python2.7/distutils/core.py", line 151, in 
> setup
> 16:33:50      dist.run_commands()
> 16:33:50    File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in 
> run_commands
> 16:33:50      self.run_command(cmd)
> 16:33:50    File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in 
> run_command
> 16:33:50      cmd_obj.run()
> 16:33:50    File 
> "/usr/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 
> 44, in run
> 16:33:50      self.run_command('egg_info')
> 16:33:50    File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in 
> run_command
> 16:33:50      self.distribution.run_command(command)
> 16:33:50    File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in 
> run_command
> 16:33:50      cmd_obj.run()
> 16:33:50    File "setup.py", line 229, in run
> 16:33:50      gen_protos.generate_proto_files(log=log)
> 16:33:50    File "/app/sdks/python/gen_protos.py", line 291, in 
> generate_proto_files
> 16:33:50      raise ValueError("Proto generation failed (see log for 
> details).")
> 16:33:50  ValueError: Proto generation failed (see log for 
> details
> {noformat}
> {noformat}
> import google.protobuf.message as message
> ImportError: No module named google.protobuf.message
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to