4020: RBTools on OS X El Capitan (10.11) uses python 2.6 directly

danehammer

What version are you running?

0.7.5

What steps will reproduce the problem?

  1. Be on OS X 10.11 (which ships with python 2.7.x, I believe 2.7.10)
  2. Be on mercurial 3.5.2 or 3.6.1 (reproduced with both)
  3. Install RBTools (reproduced with both direct download, and homebrew cask)
  4. Run 'rbt status'
  5. See this:

Failed to execute command: [u'hg', u'showconfig']
['Traceback (most recent call last):\n', '  File "/usr/local/bin/hg", line 41, in <module>\n', '    mercurial.util.setbinary(fp)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__\n', '    self._load()\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load\n', '    mod = _hgextimport(_import, head, globals, locals, None, level)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport\n', '    return importfunc(name, globals, *args, **kwargs)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 2426, in <module>\n', "    if safehasattr(parsers, 'dirs'):\n", '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 92, in safehasattr\n', '    return getattr(thing, attr, _notset) is not _notset\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__\n', '    self._load()\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load\n', '    mod = _hgextimport(_import, head, globals, locals, None, level)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport\n', '    return importfunc(name, globals, *args, **kwargs)\n', 'ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.10, but Mercurial is currently using Python with sys.hexversion=33950192: Python 2.6.9 (unknown, Aug 22 2015, 20:33:41) \n', '[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]\n', ' at: /usr/bin/python\n']

What is the expected output? What do you see instead?

I expect it to either run the status command, or tell me that the current directory is not a repo

What operating system are you using?

OS X 10.11.1

Attach the debug out from the command.

$ rbt <command> --debug <args>
>>> RBTools 0.7.5
>>> Python 2.6.9 (unknown, Aug 22 2015, 20:33:41)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]
>>> Running on Darwin-15.0.0-x86_64-i386-64bit
>>> Home = /Users/martellus
>>> Current directory = /Users/martellus/hgs
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Command exited with rc 1: ['svn', '--non-interactive', u'info']
svn: E155007: '/Users/martellus/hgs' is not a working copy
---
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Command exited with rc 128: ['git', 'rev-parse', '--git-dir']
fatal: Not a git repository (or any of the parent directories): .git
---
>>> Checking for a Mercurial repository...
>>> Running: hg root
>>> Command exited with rc 1: [u'hg', u'root']
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 41, in <module>
    mercurial.util.setbinary(fp)
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__
    self._load()
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport
    return importfunc(name, globals, *args, **kwargs)
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 2426, in <module>
    if safehasattr(parsers, 'dirs'):
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 92, in safehasattr
    return getattr(thing, attr, _notset) is not _notset
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__
    self._load()
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport
    return importfunc(name, globals, *args, **kwargs)
ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.10, but Mercurial is currently using Python with sys.hexversion=33950192: Python 2.6.9 (unknown, Aug 22 2015, 20:33:41)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]
 at: /usr/bin/python
---
>>> Running: hg showconfig
Failed to execute command: [u'hg', u'showconfig']
['Traceback (most recent call last):\n', '  File "/usr/local/bin/hg", line 41, in <module>\n', '    mercurial.util.setbinary(fp)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__\n', '    self._load()\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load\n', '    mod = _hgextimport(_import, head, globals, locals, None, level)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport\n', '    return importfunc(name, globals, *args, **kwargs)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 2426, in <module>\n', "    if safehasattr(parsers, 'dirs'):\n", '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/util.py", line 92, in safehasattr\n', '    return getattr(thing, attr, _notset) is not _notset\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 130, in __getattribute__\n', '    self._load()\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 96, in _load\n', '    mod = _hgextimport(_import, head, globals, locals, None, level)\n', '  File "/usr/local/Cellar/mercurial/3.6.1/lib/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport\n', '    return importfunc(name, globals, *args, **kwargs)\n', 'ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.10, but Mercurial is currently using Python with sys.hexversion=33950192: Python 2.6.9 (unknown, Aug 22 2015, 20:33:41) \n', '[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]\n', ' at: /usr/bin/python\n']

Please provide any additional information below.

I went in to /usr/local/bin/rbt and edited the shebang, from

1
#!/usr/bin/python2.6

to

1
#!/usr/bin/python

And everything worked.

#1 danehammer

Also note that at first I assumed it was an extension I had installed, so I verified this occurs with and without any extensions enabled.

david
#2 david

Can you give the exact commands you use in step 3: "Install RBTools (reproduced with both direct download, and homebrew cask)"?

I don't know what homebrew does, but often if there are multiple python installations, easy-install or pip is bound to whichever one runs when you run 'python'. This can sometimes get confused depending on how python is installed. You may have to use 'pip2.7 RBTools' or such.

We do not hardcode any python versions in the source.

  • -New
    +NeedInfo
#3 danehammer

Initially I had the problem after only using homebrew. So the command was just "brew cask install rbtools". With homebrew casks, it's simple scripting around using the .pkg install. See here. I reproduced it by uninstalling everything and running "brew cask install rbtools" again so I could capture the output. There doesn't appear to be anything special about how homebrew is installing it. Can you tell me more about what "pip2.7 RBTools" means so we could get homebrew updated, if that's necessary?

Output:

$ brew cask install rbtools
==> Downloading https://downloads.reviewboard.org/releases/RBTools/0.7/RBTools-0.7.5.pkg
Already downloaded: /Library/Caches/Homebrew/rbtools-0.7.5.pkg
==> Running installer for rbtools; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> installer: Package name is RBTools
==> installer: Installing at base path /
==> installer: The install was successful.
🍺  rbtools staged at '/opt/homebrew-cask/Caskroom/rbtools/0.7.5' (792K)
brennie
#4 brennie

We don't support installation of RBTools via homebrew. Use pip:

pip install rbtools

Make sure to use the pip associated with the correct version of Python (e.g., if you're using homebrew's Python make sure pip is being executed by that version of Python).

david
#5 david
  • -NeedInfo
    +ThirdParty