I'm using a virtual machine to run Ubuntu 15.10 and got powerline to work with Vim. Trying to get it to work with tmux has been a challenge.
After getting it to work with Vim I spent 2 days trying to get it to work in tmux with no avail.
So one day Ubuntu had updates so I installed them and rebooted and it started working!
Today I had Ubuntu updates again so I installed and rebooted and powerline for tmux(vim still works) stopped working and I'm not sure why?
This is what my ~/.tmux.conf looks like:
source ~/.local/lib/python3.4/site-packages/powerline/bindings/tmux/powerline.conf
set-option -g default-terminal "screen-256color"
Thanks for anyone's help!
What is your tmux version? Could you add some screenshots too?
In the powerline/bindings directory, there are other conf files. Check if your supplied version matches with the tmux version. Some bindings are different. Likely, you updated from a tmux version 1.8 or lower. The latest tmux version is 2.1, Ubuntu repos have it at 1.8 (checked an hour ago).
Can't get screenshot right now but I will try in a bit. My version of tmux is 2.0 and powerline.conf gives me just the tmux status bar without powerline. I just tried powerline_tmux_1.9_plus.conf and it gives me status bar without powerline without the green bar. All the other conf are lower than 1.9.
Could post the output for these commands:
powerline tmux left
powerline tmux right
Do you have a log file configured? Could you post the logs?
Edited.
@BlitzKraft powerline-daemon is not supposed to accept tmux … arguments, these are for daemon clients (i.e. powerline which uses daemon if possible and powerline-render if it is not launched) or powerline-render.
Thanks for the correction.
Edited the comment.
@mastrauckas You are not supposed to use powerline_tmux_….conf directly at all, these files are to be sourced by powerline-config tmux setup which is called by powerline.conf.
BTW, some of the tmux problems are fixed by running powerline-daemon (if not already done) and powerline-config tmux setup: even though it is called by powerline.conf it looks like there are some async problems: I cannot get it work completely reliably, though after introducing a hack that “sources” *.conf files manually in place of telling tmux source ….conf it mostly works.
Here is the output:
ubuntu@2016:04:07- 1:06:34PM@~/.local/bin $./powerline tmux left
write() failed: Bad file descriptor
ubuntu@2016:04:07- 1:07:08PM@~/.local/bin $./powerline tmux right
write() failed: Bad file descriptor
When running powerline-daemon everthing worked fine.
When running powerline-config tmux setup here is what I got:
ubuntu@2016:04:07- 1:12:57PM@~/.local/bin $./powerline-config tmux setup
failed to connect to server: Connection refused
Traceback (most recent call last):
File "./powerline-config", line 22, in
args.function(pl, args)
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/commands/config.py", line 15, in call
self.function(_args, _kwargs)
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/bindings/config.py", line 212, in tmux_setup
source_tmux_files(pl, args, tmux_version=tmux_version, source_tmux_file=stf)
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/bindings/config.py", line 74, in source_tmux_files
source_tmux_file(os.path.join(TMUX_CONFIG_DIRECTORY, 'powerline-base.conf'))
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/bindings/config.py", line 199, in source_tmux_file_nosource
run_tmux_command(args)
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/bindings/tmux/init.py", line 32, in run_tmux_command
_run_tmux(subprocess.check_call, args)
File "/home/mastrauckas/.local/lib/python3.4/site-packages/powerline/bindings/tmux/__init__.py", line 27, in _run_tmux
return runner([get_tmux_executable_name()] + list(args))
File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['tmux', 'set', '-g', 'status', 'on']' returned non-zero exit status 1
failed to connect to server: Connection refused
I do not know why trying to access tmux yields this, but you must fix it. You should see exactly the same problem when simply using e.g. tmux source /dev/null. I would suggest to check it (tmux source /dev/null) and ask guys on #tmux (freenode IRC).
Yes, doing tmux source /dev/null gives me the same error.
Ask on #tmux then, this is not a powerline issue: this command should do nothing, not complain about failing to connect to server. I do not remember seeing such error, so cannot help you.
I noticed this is now closed. My issue is still happening and i'm not sue if this a tmux or powerline issue.
So it appears I only get "failed to connect to server: Connection refused" from tmux when there is no active session. So if I create a session and then run:
powerline-config tmux setup
I get the below result on my status bar
So for starts, why am I not getting the full status bar and how can I make this come up without having to do powerline-config tmux setup?
Getting same error
$ ~/Library/Python/2.7/bin/powerline tmux right
write() failed: Bad file descriptor
Is it the same if you kill daemon? I am also wondering whether reverting #1561 will fix it.
@ZyX-I I don't seem to have a daemon running. The following returns nothing:
$ ps aux | grep powerline
And if you start daemon? It looks like client is connecting to daemon socket, but write fails afterwards.
I may have more ideas if you use client/powerline.py in place of powerline. Do not try to find where powerline.py is installed, pip will install only one of the alternatives and in your case it looks like it installed C version.
@ZyX-I running the daemon did the trick.
$ powerline-daemon
Thank you!
@miguelmota It is actually not a fix, client should not show write() failed without daemon, it should run powerline-render instead.
@ZyX-I To understand this better, when does the daemon start? Is there a script I need to add to .tmux.conf or .bashrc?
@miguelmota Daemon starts when somebody runs powerline-daemon from your user: e.g. like suggested somewhere in documentation powerline-daemon --quiet placed in the bashrc (--quiet is needed to omit error messages if daemon was already started). This is not automatic because it was assumed that users may have reasons to not start daemon.
@ZyX-I gotcha, thanks for the clarification.
@mastrauckas Was your problem solved? I am facing a similar problem.
@nafizh @mastrauckas @miguelmota sorry for being late but I think you need to remove lines 'set -g status-utf8 on' and 'set -g status on' in powerline/bindings/tmux/powerline-base.conf since they deprecated in tmux 2.2. I faced same issue today and doing that fixed this issue for me
Just in case anyone was having the same issue as me. I had a local install (in ~/.local) like @mastrauckas and I noticed that the local bin directory needed to be included in my path:
export PATH=$PATH:~/.local/bin
In case anyone is having a similar issue and is running tmux compiled from git master, the issue for me was /usr/local/lib/python3.4/dist-packages/powerline/bindings/tmux/__init__.py where it tries to get the version number by splitting the output of tmux -V which contains "master" instead of "2.4". I just made a dirty hack and put this code in place, then ran powerline-config tmux setup and it worked.
def get_tmux_version(pl):
version_string = get_tmux_output(pl, '-V')
_, version_string = version_string.split(' ')
version_string = version_string.strip()
version_string = "2.4" # because we are actually running tmux from git
major, minor = version_string.split('.')
suffix = DIGITS.subn('', minor)[0] or None
minor = NON_DIGITS.subn('', minor)[0]
return TmuxVersionInfo(int(major), int(minor), suffix)
@thehoss You must update powerline, not use such hacks.
I don't know that it makes any sense to update powerline. There's no meaningful version information in the word "master" -- if someone is running a custom tmux built from source, we can't really guess too much at what capabilities it does or doesn't have. I know that my particular version is roughly equivalent to a tmux 2.4 installation, so that's what I'm hardcoding in for my particular powerline installation but I don't immediately see how that can be made generic enough to commit to the powerline repo.
@thehoss Latest powerline version assumes that major tmux version is infinity if tmux reports master. I did not mean you need to run any pull requests, update is update.
Though if I am not mistaking that is not in any release yet, just in develop.
Has there been any progress on this? Still seeing this exact same problem on powerline 2.6 and tmux 2.6. Tried all the recommended fixes with no result other than showing the broken powerline tmux bar after running powerline-config tmux setup
OSX running iTerm2.
powerline tmux left returns nothing.
powerline tmux right returns
#[fg=colour233,bg=default,nobold,noitalics,nounderscore] #[fg=colour2,bg=colour233,nobold,noitalics,nounderscore] 2.2 #[fg=colour2,bg=colour233,nobold,noitalics,nounderscore]2.5 #[fg=colour2,bg=colour233,nobold,noitalics,nounderscore]2.7#[fg=colour236,bg=colour233,nobold,noitalics,nounderscore] #[fg=colour247,bg=colour236,nobold,noitalics,nounderscore] 2018-03-24#[fg=colour241,bg=colour236,nobold,noitalics,nounderscore] #[fg=colour252,bg=colour236,bold,noitalics,nounderscore] 22:39#[fg=colour252,bg=colour236,nobold,noitalics,nounderscore] #[fg=colour16,bg=colour252,bold,noitalics,nounderscore] Alexs-MacBook-Pro.local
tmux show -g | grep status shows
status on
status-interval 2
status-justify left
status-keys vi
status-left "#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold]#[noitalics]#[nounderscore],#[fg=colour16]#[bg=colour254]#[bold]#[noitalics]#[nounderscore]} #S #{?client_prefix,#[fg=colour31],#[fg=colour254]}#[bg=colour233]#[nobold] #(env $POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS tmux left --width=`tmux display -p '#''{client_width}'` -R width_adjust=`tmux show-options -g status-right-length | cut -d' ' -f2` -R pane_id=\"`tmux display -p '#''D'`\")"
status-left-length 20
status-left-style default
status-position bottom
status-right "#(env \"$POWERLINE_COMMAND\" $POWERLINE_COMMAND_ARGS tmux right -R pane_id=\"`tmux display -p \"#\"\"D\"`\" --width=`tmux display -p \"#\"\"{client_width}\"` -R width_adjust=`tmux show-options -g status-left-length | cut -d\" \" -f 2`)"
status-right-length 150
status-right-style default
status-style fg=colour231,bg=colour233
I also faced the similar issue. Not sure how but adding power-config command directly in tmux.conf worked for me.
run-shell 'powerline-config tmux setup'
Tracking back to @mastrauckas last message, anyone get a fix for the only getting half the status bar? I followed his steps exactly and ended up with the exact same result.
Nevermind, Initial issue (the 'powerline-config tmux set up' returned 127) was the .local/bin not being on the PATH.
The half-status bar issue above (I believe anyways) was caused by me having a stray tmux session running. All is working well now.
Looks like there can be different problems, but in my case it was python upgrade on MAC, noticed by running the following inside tmux:
powerline-config tmux setup
/usr/local/bin/powerline-config: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
Fixed manually by changing first line in /usr/local/bin/powerline-config and /usr/local/bin/powerline-daemon to use new interpreter, which in my case appears to be #!/usr/local/opt/python@2/bin/python2.7.
I guess re-installing might help too, perhaps there is more broken executables on my system, but at least I'm aware of the problem now :)
The problem has come up again: At the moment powerline doesn't work with the current
development version of tmux since it reports its version number in a more
creative way:
>tmux -V
tmux next-2.9
powerline-config therefore crashes:
Traceback (most recent call last):
File "/usr/local/bin/powerline-config", line 22, in <module>
args.function(pl, args)
File "/usr/local/lib/python3.6/dist-packages/powerline/commands/config.py", line 15, in __call__
self.function(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/powerline/bindings/config.py", line 184, in tmux_setup
tmux_version = get_tmux_version(pl)
File "/usr/local/lib/python3.6/dist-packages/powerline/bindings/tmux/__init__.py", line 84, in get_tmux_version
return TmuxVersionInfo(int(major), int(minor), suffix)
ValueError: invalid literal for int() with base 10: 'next-2'
The fix is rather easy - convert the major version number to a real
number by stripping the "next-" part. Adding the line
major = major[-1]
as line 82 in file powerline/bindings/tmux/__init__.py
should fix the problem till tmux reaches version 10.0.
I just created a pull request (#1991) for this patch.
Most helpful comment
I noticed this is now closed. My issue is still happening and i'm not sue if this a tmux or powerline issue.
So it appears I only get "failed to connect to server: Connection refused" from tmux when there is no active session. So if I create a session and then run:

powerline-config tmux setup
I get the below result on my status bar
So for starts, why am I not getting the full status bar and how can I make this come up without having to do powerline-config tmux setup?