commons icon indicating copy to clipboard operation
commons copied to clipboard

Having problems getting pants to work

Open eric opened this issue 12 years ago • 3 comments
trafficstars

I've tried to use pants on OS X and ran into some strange issues.

Do I need to pre-install anything (other than developer tools) to use pants?

 > env PANTS_VERBOSE=1 PEX_VERBOSE=1 PYTHON_VERBOSE=1 ./pants
Installing virtualenv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2087k  100 2087k    0     0   866k      0  0:00:02  0:00:02 --:--:--  908k
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in ./build-support/python/../../.python/bootstrap/bin/python
install_name_tool: for architecture i386 object: ./build-support/python/../../.python/bootstrap/bin/python malformed object (unknown load command 10)
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
  File "./build-support/python/../../.pants.d/.pip.cache/virtualenv-1.7.1.2/virtualenv.py", line 2270, in <module>
    main()
  File "./build-support/python/../../.pants.d/.pip.cache/virtualenv-1.7.1.2/virtualenv.py", line 928, in main
    never_download=options.never_download)
  File "./build-support/python/../../.pants.d/.pip.cache/virtualenv-1.7.1.2/virtualenv.py", line 1029, in create_environment
    site_packages=site_packages, clear=clear))
  File "./build-support/python/../../.pants.d/.pip.cache/virtualenv-1.7.1.2/virtualenv.py", line 1347, in install_python
    py_executable])
  File "./build-support/python/../../.pants.d/.pip.cache/virtualenv-1.7.1.2/virtualenv.py", line 1006, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command install_name_tool -change /System/Library/Fram.../Versions/2.7/Python @executable_path/../.Python ./build-support/pyth...bootstrap/bin/python failed with error code 1
./pants: line 47: ./.python/bootstrap/bin/activate: No such file or directory
./pants: line 48: deactivate: command not found
./pants: line 31: ./.python/bootstrap/bin/activate: No such file or directory
Build operating on targets: OrderedSet([PythonBinary(src/python/twitter/pants/BUILD:pants)])
Building PythonBinary PythonBinary(src/python/twitter/pants/BUILD:pants):
Building PythonBinary PythonBinary(src/python/twitter/pants/BUILD:pants):
  Dumping library: PythonLibrary(src/python/twitter/pants/BUILD:pants-lib) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/BUILD:common) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/collections/BUILD:collections) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/lang/BUILD:lang) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/config/BUILD:config) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/contextutil/BUILD:contextutil) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/dirutil/BUILD:dirutil) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/decorators/BUILD:decorators) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/exceptions/BUILD:exceptions) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/log/BUILD:log) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/options/BUILD:options) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/metrics/BUILD:metrics) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/quantity/BUILD:quantity) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/string/BUILD:string) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/util/BUILD:util) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/app/BUILD:app) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/process/BUILD:process) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/app/modules/BUILD:modules) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/confluence/BUILD:confluence) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/java/BUILD:java) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/python/BUILD:python) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/rwbuf/BUILD:rwbuf) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/thrift/text/BUILD:text) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/common/threading/BUILD:threading) [relative module: ]
  Dumping library: PythonLibrary(src/python/twitter/pants/BUILD:pants-deps) [relative module: ]
  Dumping requirement: distribute
  Dumping requirement: ansicolors
  Dumping requirement: elementtree
  Dumping requirement: Markdown
  Dumping requirement: pygments
  Dumping requirement: pylint
  Dumping requirement: pystache
  Dumping requirement: pytest
  Dumping requirement: pytest-cov
  Dumping requirement: python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
Failed to find distribute in sys.path!n-daemon :: Distilling python-daemon
twitter.common.python: Obtaining python-daemon: 14821.4ms                 
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.2ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.2ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.2ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.3ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.5ms
twitter.common.python:   Distilling python-daemon: 7.4ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.5ms
twitter.common.python:   Distilling python-daemon: 7.4ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
twitter.common.python:   Installing python-daemon: 0.4ms
twitter.common.python:   Distilling python-daemon: 7.0ms
twitter.common.python:   Installing python-daemon: 0.3ms
twitter.common.python:   Distilling python-daemon: 7.1ms
Problem executing PythonBuilder for targets OrderedSet([PythonBinary(src/python/twitter/pants/BUILD:pants)]): Traceback (most recent call last):
  File "/Users/eric/src/commons/src/python/twitter/pants/commands/build.py", line 96, in _python_build
    return executor.build(targets, self.build_args, conn_timeout=self.options.conn_timeout)
  File "/Users/eric/src/commons/src/python/twitter/pants/python/python_builder.py", line 59, in build
    rv = PythonBinaryBuilder(binary_target, args, self.root_dir, conn_timeout=conn_timeout).run()
  File "/Users/eric/src/commons/src/python/twitter/pants/python/binary_builder.py", line 57, in run
    env = self.chroot.dump()
  File "/Users/eric/src/commons/src/python/twitter/pants/python/python_chroot.py", line 230, in dump
    req._requirement for req in targets['reqs'] if req.should_build()):
  File "/Users/eric/src/commons/src/python/twitter/pants/python/python_chroot.py", line 93, in resolve
    self._resolver.resolve(requirements, platform=platform)
  File "/Users/eric/src/commons/src/python/twitter/common/python/resolver.py", line 49, in resolve
    installer=self.make_installer(python, platform)):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
DistributionNotFound: python-daemon


Usage: 
  pants_exe.py build (options) [spec] (build args)
  pants_exe.py build (options) [spec]... -- (build args)

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --no-pantsrc          Specifies that pantsrc files should be ignored.
  --log-exit            Log an exit message on success or failure.
  -t CONN_TIMEOUT, --timeout=CONN_TIMEOUT
                        Number of seconds to wait for http connections.

Builds the specified Python target(s). Use ./pants goal for JVM and other
targets.
./pants: line 35: deactivate: command not found
Unable to build pants!  Cannot continue!
 > which install_name_tool
/usr/bin/install_name_tool
 > install_name_tool
Usage: install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input

eric avatar Aug 02 '13 03:08 eric

I found that making /Library/Python/2.7/site-packages/ writable by my user made it work.

eric avatar Aug 02 '13 04:08 eric

Interesting. The key line from your log was:

Could not call install_name_tool -- you must have Apple's development tools installed

This generally means updating XCode and then going through its preferences menu system to download a command line tools package.

On Thu, Aug 1, 2013 at 10:04 PM, Eric Lindvall [email protected]:

I found that making /Library/Python/2.7/site-packages/ writable by my user made it work.

— Reply to this email directly or view it on GitHubhttps://github.com/twitter/commons/issues/167#issuecomment-21985333 .

jsirois avatar Aug 02 '13 19:08 jsirois

One thing I found was that the version of virtualenv that is used has problems with OS X. I updated the line in the pants stuff to use a newer virtualenv and it made that error go away.

eric avatar Aug 02 '13 19:08 eric