0

When using tmux on the local machine (mac) and doing plt.show(), the window does not show up. But the code can be run and a figure can be saved. Meanwhile, a x-window can be open on the same session.

I have test it on iterm2 and the native terminal on mac. It gives me the same behavior. Do we need some extra configurations to display the plots on tmux?

5
  • Does invoking this magical incantation before running the python script solve the issue? export DISPLAY="`tmux show-env | sed -n 's/^DISPLAY=//p'`" Jun 17, 2020 at 12:05
  • Thanks a lot, Paul. No, it did not help. BTW, DISPLAY becomes /private/tmp/com.apple.launchd.k7zDOlgpLB/org.macosforge.xquartz:0 after export.
    – Qi Tang
    Jun 17, 2020 at 14:02
  • Sorry to hear; updating the display variable usually does the trick for me, albeit on a linux server, not MacOS. What backend are you using (matplotlib.get_backend())? Are there no error messages or warnings whatsoever? Also, you might have more luck asking on superuser.com. Jun 17, 2020 at 14:22
  • There is also apple.stackexchange.com, which I didn't even know existed until just now. Jun 17, 2020 at 14:29
  • I think I figure out why. It was due to PATH issue. It pick up an old system python (2.7). Thanks again, Paul.
    – Qi Tang
    Jun 17, 2020 at 14:54

1 Answer 1

0

This is because my PATH got messed up due to the reason given in https://superuser.com/questions/544989/does-tmux-sort-the-path-variable

It picked up the old python2.7 in /usr/bin/python because tmux called /etc/profile and add system bins in the front of my shell PATH.

To fix it, this trick works for me

if [ -f /etc/profile ]; then
    PATH=""
    source /etc/profile
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.