Closed prateek-zh closed 2 years ago
can you share the output of python3 -m pip list
?
❯ python3 -m pip list
Package Version
----------------- -------
awscli-local 0.20
boto3 1.24.20
botocore 1.27.20
jmespath 1.0.1
libtmux 0.11.0
localstack-client 1.35
pip 22.1.2
python-dateutil 2.8.2
s3transfer 0.6.0
setuptools 58.1.0
six 1.16.0
urllib3 1.26.9
can you run this bash code and share the output
pip_list=$(python3 -m pip list 2> /dev/null)
echo "pip_list"
echo "$pip_list"
if ! echo "$pip_list" | grep libtmux -q; then
echo "error"
exit 0
fi
echo "ok"
❯ ./debug.sh
pip_list
Package Version
----------------- -------
awscli-local 0.20
boto3 1.24.20
botocore 1.27.20
jmespath 1.0.1
libtmux 0.11.0
localstack-client 1.35
pip 22.1.2
python-dateutil 2.8.2
setuptools 58.1.0
six 1.16.0
urllib3 1.26.9
ok
Just a heads up, I uninstalled s3transfer
just now so it would be a package that is missing from my last message.
It's very weird, the output is ok
, its the same code from tmux_window_name.tmux which tpm
runs, you can manually edit your tmux_window_name.tmux
to add debug prints, add echo "$pip_list"
and reload your plugins <prefix> + r
It is super weird indeed. I added the echo "$pip_list"
before the if-block but it does not get printed on the screen, the error is displayed though. How do I see the output?
I've tried <prefix> + r
and also running tmux source-file ~/.tmux.conf
with the same results.
it's usually "stops" the current screen on the tmux session and shows the output, make sure you edited `"~/.tmux/plugins/tmux-window-name/tmux_window_name.tmux", if it still doesn't show output you can send the output to file.
echo "$pip_list" > /tmp/tmux_out
I confirmed that the "~/.tmux/plugins/tmux-window-name/tmux_window_name.tmux"
was indeed updated but the output is not being printed. Updated to send output to file:
Package Version
---------- -------
pip 22.0.4
setuptools 60.10.0
six 1.16.0
wheel 0.37.1
I am on zsh
could that be a problem?
zsh
isn't a problem.
It seems that your tpm
runs the bash/python with different user/python version.
Please add:
echo $USER
which python3
python3 -V
python3 -m site
python3 -m site --user-site
I think I found the issue. tmux_window_name
uses a different version of python: /usr/local/bin/python
.
In my shell, I use the python provided with pyenv. Let me try initializing pyenv in the "~/.tmux/plugins/tmux-window-name/tmux_window_name.tmux"
.
Added the following:
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init --path)";
fi
and the pip_list is now as expected. Will try to see if the names are showing up as expected.
No errors anymore but switching between screens in a session gives the following error:
'~/.tmux/plugins/tmux-window-name/scripts/rename_session_windows.py' returned 1
I strongly suggest to installed libtmux in the user python, I designed the plugin to use the user python env.
You can manually run ~/.tmux/plugins/tmux-window-name/scripts/rename_session_windows.py'
from your terminal to see the traceback.
Thanks for your suggestion. I installed libtmux to the default python3, removed the pyenv initialization and now it works as expected.
Appreciate your prompt responses and maintaining this super useful tool. Kudos!
Thanks! Have fun with the tool :)
I added note in the README to use the user
plugin instead of virtualenv
I strongly suggest to installed libtmux in the user python, I designed the plugin to use the user python env.
It seems that in 'tmux_window_name.tmux', pip_list=$(python3 -m pip list 2> /dev/null)
doesn't retreive user packages but rather root's packages. I added tmux display "$(pip -V)"
in the script, and it prints message: pip 24.2 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)
, which is not in user mode.
EDIT: And now I'm encountering the same problem (libtmux not found).
The problem has now disappeared.
For those who encounter the same problem in the future, we need to use the system python3
, not Homebrew's:
$ which python3
/opt/homebrew/opt/python@3.10/libexec/bin/python3
If your environment returns something like this, you should do the following instead:
$ /usr/bin/python3 -m pip install --user libtmux
Hi,
I have setup
tmux-window-name
using the tpm but when I source.tmux.conf
, I see an error at the bottom of the window saying:I am running tmux on iTerm2 and on a Mac. Any idea what the issue might be?