brew install on OSX has python issues

Bug #1792508 reported by Damon Permezel
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
byobu
New
Undecided
Unassigned

Bug Description

Running OSX 10.13.6.
Just did a brew update; followed by brew install byobu;

Within one Terminal.app screen, byobu starts.
Within an other Terminal.app, I get:

/opt/local/bin/byobu-select-session: /usr/local/lib/byobu/include/select-session.py: /usr/bin/python3: bad interpreter: No such file or directory
/opt/local/bin/byobu-select-session: line 24: /usr/local/lib/byobu/include/select-session.py: Undefined error: 0

I tried to fix by placing a symlink in /usr/bin, but I guess OSX locks down /usr/bin as I was unable to do so.

There is a python3 in /opt/local/bin/

In the select-session.py file:

#!/usr/bin/python3
#

Revision history for this message
Daniel Mladek (delphym) wrote :

I have exactly same issue, but I use MacPort to install Byobu.

I've just discovered it this week, previously was using GNU Screen and start experimenting with tmux and hit Byobu. I use it on WSL, Ubuntu and my MacOS 10.13.6

It work the 1st time on my Mac, but since then I've also performed:
sudo port selfupdate
sudo port upgrade outdated

Then it still started, but once detached, I'm unable to invoke byobu again is it outputs the same error as above:
# delphym @ KiwiBook in /usr/bin [22:06:55]
$ byobu
/opt/local/bin/byobu-select-session: /opt/local/lib/byobu/include/select-session.py: /usr/bin/python3: bad interpreter: No such file or directory
/opt/local/bin/byobu-select-session: line 24: /opt/local/lib/byobu/include/select-session.py: Undefined error: 0

I also use ohmyz.sh as a shell.

Also as above, I've tried to fix it by creating a symlink, but I couldn't because of Apple's System Integrity Protection. (More info here: https://superuser.com/questions/933019/sudo-cant-create-file-in-usr-bin-in-el-capitan)

Location of python(s) in my system is:
$ ll /usr/bin/python*
-rwxr-xr-x 1 root wheel 65K 29 May 17:03 /usr/bin/python
-rwxr-xr-x 4 root wheel 925B 16 Jul 2017 /usr/bin/python-config
lrwxr-xr-x 1 root wheel 75B 21 Oct 2017 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82B 21 Oct 2017 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 1 root wheel 65K 29 May 17:03 /usr/bin/pythonw
lrwxr-xr-x 1 root wheel 76B 21 Oct 2017 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

$ ll `which python3`
lrwxr-xr-x 1 root admin 24B 11 Sep 23:28 /opt/local/bin/python3 -> /opt/local/bin/python3.4

Looking into the src: https://github.com/dustinkirkland/byobu/blob/master/usr/lib/byobu/include/select-session.py
it's not much obvious to me (I'm very much Python beginner) where it's getting the /usr/bin PATH set.

Many thanks for looking into this issue soon.

tags: added: macport
tags: added: homebrew
Revision history for this message
Daniel Mladek (delphym) wrote :

Alright, it is not that black and white, so here're the reproduction steps:
Assumption: no byobu, tmux, nor screen processes are running
$ ps -ef |grep byobu
And if they do, kill them.

STEPS:
1. List all sessions:
$ byobu ls
no server running on /private/tmp/tmux-501/default

2. Start byobu. It surprisingly starts
$ byobu

3. List sessions again within the byobu session
$ byobu ls
1: 2 windows (created Sat Sep 29 23:00:15 2018) [153x20] (attached)

4. Detach from byobu (F6)
[detached (from session 1)]

5. List again its sessions
$ byobu ls
1: 2 windows (created Sat Sep 29 23:00:15 2018) [153x20]

6. Try to launch byobu again
$ byobu
/opt/local/bin/byobu-select-session: /opt/local/lib/byobu/include/select-session.py: /usr/bin/python3: bad interpreter: No such file or directory
/opt/local/bin/byobu-select-session: line 24: /opt/local/lib/byobu/include/select-session.py: Undefined error: 0

7. Check for its running processes
$ ps -ef | grep byobu
  501 49530 1 0 11:00pm ?? 0:02.41 tmux -u -2 -f /opt/local/share/byobu/profiles/tmuxrc new-session -n - /opt/local/bin/byobu-shell
  501 59119 44965 0 11:07pm ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn byobu

8. Kill the byobu process
$ kill -9 49530

# delphym @ KiwiBook in /usr/bin [23:07:55]
$ echo $?
0

9. Check the processes again:
$ ps -ef | grep byobu
  501 59173 44965 0 11:08pm ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn byobu

10. Repeat from step #1

Revision history for this message
Ben Gerber (bengerber) wrote :

To fix this, change the shebang line in
/usr/local/lib/byobu/include/select-session.py
(or /usr/local/Cellar/byobu/5.127/lib/byobu/include/select-session.py)

from:
#!/usr/bin/python3

to:
#!/usr/bin/env python3

This makes the code more portable -- and fixes this bug

Here is patched copy:
https://github.com/gerber/byobu/blob/gerber-patch-1/usr/lib/byobu/include/select-session.py

Revision history for this message
Daniel Mladek (delphym) wrote :

Hi @Ben, your fix works great! Thanks for it

Very sorry for late response, but being a dad of twins takes incredible amount of time and resources.

I've just tested on my:
 - Mac OS 10.13.6 with MacPort 2.5.4 and its Byobu port 5.127 (fixed problem)
 - Win 10 1803, with WSL Ubuntu 16.04.5 LTS, Byobu 5.106 (no regression, and here it doesn't matter if I refer to python 3 or just python).

Thanks again,
-d

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.