foursquare / fsqio

A monorepo that holds all of Foursquare's opensource projects
Apache License 2.0
252 stars 54 forks source link

Build failure #52

Closed piranha32 closed 6 years ago

piranha32 commented 6 years ago

Build of freshly cloned fsqio crashes with the following messages:

$ ./pants compile test src:: test::
Traceback (most recent call last):
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/extension_loader.py", line 123, in load_backend
    module = importlib.import_module(backend_module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/contrib/go/register.py", line 15, in <module> 
    from pants.contrib.go.tasks.go_binary_create import GoBinaryCreate
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/contrib/go/tasks/go_binary_create.py", line 15, in <module> 
    from pants.contrib.go.tasks.go_task import GoTask
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/contrib/go/tasks/go_task.py", line 15, in <module> 
    from pants.util.process_handler import subprocess
ImportError: cannot import name subprocess
Exception caught: (<class 'pants.base.exceptions.BackendConfigurationError'>)
  File "/Users/user/.cache/fsqio/setup/bootstrap/1.3.1rc1/bin/pants", line 11, in <module> 
    sys.exit(main())
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/bin/pants_exe.py", line 44, in main 
    PantsRunner(exiter).run()
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/bin/pants_runner.py", line 57, in run
    options_bootstrapper=options_bootstrapper)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/bin/pants_runner.py", line 46, in _run 
    return LocalPantsRunner(exiter, args, env, options_bootstrapper=options_bootstrapper).run()
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 37, in run
    self._run()
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 43, in _run 
    options, build_config = OptionsInitializer(options_bootstrapper, exiter=self._exiter).setup()
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/options_initializer.py", line 155, in setup
    global_bootstrap_options.backend_packages)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/options_initializer.py", line 82, in _load_plugins
    return load_backends_and_plugins(plugins, working_set, backend_packages)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/extension_loader.py", line 36, in load_backends_and_plugins
    load_build_configuration_from_source(build_configuration, backends)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/extension_loader.py", line 109, in load_build_configuration_from_source
    load_backend(build_configuration, backend_package)
  File "/Users/user/.cache/fsqio/setup/bootstrap/pants.nhTMrG/install/lib/python2.7/site-packages/pants/init/extension_loader.py", line 127, in load_backend
    .format(backend=backend_module, error=e))

Exception message: Failed to load the pants.contrib.go.register backend: cannot import name subprocess

OSX and Fedora 27 are affected by the issue, I don't have access to other systems to test.

mateor commented 6 years ago

Hi - I can take a look this weekend and update Fsq.io when I find the issue, which I expect won't be too hard.

mateor commented 6 years ago

I have the fix internally and will roll out in the next day or two (we land in our internal repo and then deploy to the foursquare/fsqio repo).

But the problem is from a hack I used to publish 1.2.0 buildgen modules to pypi. Landing that hack was always a risk but worth it since we have buildgen customers at 1.2.1. But those modules have been successfully published, so we can go ahead and restore the original state.

You can verify if this works for you by running:

rm -rf ~/.cache/fsqio

Applying the following patch:

diff --git a/3rdparty/python/requirements.txt b/3rdparty/python/requirements.txt
index 69ea9c91..a2456b6d 100644
--- a/3rdparty/python/requirements.txt
+++ b/3rdparty/python/requirements.txt
@@ -5,10 +5,10 @@ opentracing==1.2.2

 # The pantsbuild libs can stay as a loose constraint - the version invoked at build time is set in
 # the pants.ini, so this range is only used for the Fsq.io contrib modules published to PyPi.
-pantsbuild.pants.contrib.go>=1.2.0
-pantsbuild.pants.contrib.node>=1.2.0
-pantsbuild.pants>=1.2.0
-pantsbuild.pants.testinfra>=1.2.0
+pantsbuild.pants.contrib.go==1.3.1rc1
+pantsbuild.pants.contrib.node==1.3.1rc1
+pantsbuild.pants==1.3.1rc1
+pantsbuild.pants.testinfra==1.3.1rc1
 psycopg2==2.7
 pymongo==2.8
 py_zipkin==0.9.0

And running

./pants compile test src:: test::

Unless you tell me this doesn't solve your issue, I will close this when I update the Fsq.io repo with those fixes

mateor commented 6 years ago

This fix has been merged at HEAD, tagged as fsqio-2018-03-20-0242

piranha32 commented 6 years ago

Sorry for late response, I've just got to test it. The patch fixed the problem on linux, haven't had a chance to test on Mac yet. Thanks for fixing it.