Open wonjoonSeol-WS opened 7 months ago
My guess is that you have a custom prompt or fish plugin and Warp is unable to parse it.
You can check whether it’s something in your dotfiles by commenting on your config.fish or disable parts of your dotfiles just for Warp by using this conditional statement:
# Fish
if test "$TERM_PROGRAM" != "WarpTerminal"
# > What you want to disable here <
end
We have a list of incompatible tools here: https://docs.warp.dev/help/known-issues#list-of-incompatible-tools And more info on custom prompts here: https://docs.warp.dev/features/prompt
Hello dannyneira,
I am afraid the issue still persists even after i comment out everything in ~/.config/fish/config.fish. and removing all plugins.
After removing all plugins and commenting out config.
Please note that the issue doesn't happen when the default shell is zsh and opening subshell by typing 'fish'.
The issue only happens when I set fish as default shell. (After typing chsh -s $(which fish)
)
Oh I see, I'm having trouble reproducing this issue, even with an empty fish config and settings fish as default shell as well.
Can you please try putting the result of which fish
into your Settings > Features > Session > Startup shell for new sessions > Custom
, then open a new session and activate/deactivate again to see if that helps?
If not, please delete the logs, then post the logs for when you run the activate/deactivate a few times. This could help us see where the script is failing on your end. https://docs.warp.dev/help/sending-us-feedback#gathering-warp-logs
Hello, thank you for your message. Unfortunately, i am not seeing any error message on ~/Library/Logs/warp.log.
Warp’s logs do not contain any console input or output.
I think it is because Warp itself isn't crashing but the code that wraps fish crashes fish?
fish: Unknown command: _old_fish_prompt
fish:
_old_fish_prompt
^~~~~~~~~~~~~~~^
in command substitution
in function '_warp_prompt'
called on line 1 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpXdNHiN
in command substitution
called on line 120 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpXdNHiN
in function 'warp_precmd'
in event handler: handler for generic event 'fish_prompt'
fish: Unknown command
set -l prompt (_old_fish_prompt)
^~~~~~~~~~~~~~~~~^
in function '_warp_prompt'
called on line 1 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpXdNHiN
in command substitution
called on line 120 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpXdNHiN
in function 'warp_precmd'
in event handler: handler for generic event 'fish_prompt'
This is all i am getting right now
Update:
So this if statement in the activate.fish is problematic
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
functions -c fish_prompt _old_fish_prompt
function fish_prompt
# Run the user's prompt first; it might depend on (pipe)status.
set -l prompt (_old_fish_prompt) # <- ISSUE HERE
printf '(%s) ' $VIRTUAL_ENV_PROMPT
string join -- \n $prompt # handle multi-line prompts
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
so by setting
set -Ux VIRTUAL_ENV_DISABLE_PROMPT 1
I can avoid the issue from happening but this is still quite strange.
Also, When i use Warp prompt, I am still getting pythonvirtualenv prompt despite setting VIRTUAL_ENV_DISABLE_PROMPT = 1, so that function part in activate.fish is completely unnecessary when it comes to Warp.
Hey @wonjoonSeol-WS, what version of venv
are you using? Does the issue still repro if you upgrade venv? https://github.com/pypa/virtualenv/issues/1991 makes me think this is actually a venv
issue, not a Warp issue.
@wonjoonSeol-WS Ping on this, would you mind checking if this repros on a newer version of venv
?
Thanks for the ping alokedesai!
I am using poetry to manage my virtual environment.
Use currently activated Python version to create a new virtual environment. If set to false, Python version used during Poetry installation is used.
https://python-poetry.org/docs/configuration/#virtualenvsprefer-active-python-experimental
poetry by default uses Python version used during Poetry installation, which in my case was python3.10
I noticed that the system level virtualenv is not working as intended due to broken symlink, after installing newer python version via brew:
virtualenv --version
exec: Failed to execute process '/Users/.../.local/bin/virtualenv': The file specified the interpreter '/Users/.../.local/pipx/venvs/virtualenv/bin/python', which is not an executable command.
...
'/Users/.../.local/pipx/venvs/virtualenv/bin/python' is a broken symbolic link to 'python3.10'
pipx list
venvs are in /Users/../.local/pipx/venvs
apps are exposed on your $PATH at /Users/.../.local/bin
manual pages are exposed at /Users/.../.local/share/man
⚠️ package pdm has invalid interpreter /opt/homebrew/Cellar/pipx/1.0.0/libexec/bin/python3.10
⚠️ package virtualenv has invalid interpreter /opt/homebrew/Cellar/pipx/1.0.0/libexec/bin/python3.10
package virtualenvwrapper has invalid interpreter /opt/homebrew/Cellar/pipx/1.0.0/libexec/bin/pytho⚠️3.10
One or more packages have a missing python interpreter.
To fix, execute: pipx reinstall-all
After running command pipx reinstall-all and / or setting poetry config virtualenvs.prefer-active-python still reproduces the issue unfortunately when i set -e VIRTUAL_ENV_DISABLE_PROMPT
current working virtualenv version:
virtualenv --version
virtualenv 20.26.2 from /Users/.../.local/pipx/venvs/virtualenv/lib/python3.12/site-packages/virtualenv/__init__.py
Issue still reproduces when I recreate the whole env using the latest virtualenv:
> rm -rf .venv
...
> poetry install --sync --no-root
...
> source .venv/bin/activate.fish
> python --version
Python 3.12.3
> deactivate
fish: Unknown command: _old_fish_prompt
fish:
_old_fish_prompt
^~~~~~~~~~~~~~~^
in command substitution
in function '_warp_prompt'
called on line 1 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpditgJK
in command substitution
called on line 120 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpditgJK
in function 'warp_precmd'
in event handler: handler for generic event 'fish_prompt'
fish: Unknown command
set -l prompt (_old_fish_prompt)
^~~~~~~~~~~~~~~~~^
in function '_warp_prompt'
called on line 1 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpditgJK
in command substitution
called on line 120 of file /var/folders/56/f04gtv6x1mvc_mqn0c4n2nz4msr0jz/T/.tmpditgJK
in function 'warp_precmd'
in event handler: handler for generic event 'fish_prompt'
Could you share the entire contents of activate.fish
?
Hello, this is the entire contents of activate.fish. 😄
> cat .venv/bin/activate.fish
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
# Do not run it directly.
function _bashify_path -d "Converts a fish path to something bash can recognize"
set fishy_path $argv
set bashy_path $fishy_path[1]
for path_part in $fishy_path[2..-1]
set bashy_path "$bashy_path:$path_part"
end
echo $bashy_path
end
function _fishify_path -d "Converts a bash path to something fish can recognize"
echo $argv | tr ':' '\n'
end
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
else
set -gx PATH $_OLD_VIRTUAL_PATH
end
set -e _OLD_VIRTUAL_PATH
end
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
set -e _OLD_VIRTUAL_PYTHONHOME
end
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
and functions -q _old_fish_prompt
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
set -l fish_function_path
# Erase virtualenv's `fish_prompt` and restore the original.
functions -e fish_prompt
functions -c _old_fish_prompt fish_prompt
functions -e _old_fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
end
set -e VIRTUAL_ENV
set -e VIRTUAL_ENV_PROMPT
if test "$argv[1]" != 'nondestructive'
# Self-destruct!
functions -e pydoc
functions -e deactivate
functions -e _bashify_path
functions -e _fishify_path
end
end
# Unset irrelevant variables.
deactivate nondestructive
set -gx VIRTUAL_ENV '/Users/.../workspace/.venv'
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
else
set -gx _OLD_VIRTUAL_PATH $PATH
end
set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
# Prompt override provided?
# If not, just use the environment name.
if test -n 'venv-name-py3.12'
set -gx VIRTUAL_ENV_PROMPT 'venv-name-py3.12'
else
set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
end
# Unset `$PYTHONHOME` if set.
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
function pydoc
python -m pydoc $argv
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
functions -c fish_prompt _old_fish_prompt
function fish_prompt
# Run the user's prompt first; it might depend on (pipe)status.
set -l prompt (_old_fish_prompt)
printf '(%s) ' $VIRTUAL_ENV_PROMPT
string join -- \n $prompt # handle multi-line prompts
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
I was also experiencing this issue and setting that environment variable resolved it for me. Another resolution was to use the default Warp prompt as opposed to the Shell prompt (PS1).
Settings/Appearance Prompt -> choosing shell prompt (PS1) makes no difference in my case. (Tested on May 8th https://github.com/warpdotdev/Warp/issues/4890#issue-2284445602).
But yeah at least VIRTUAL_ENV_DISABLE_PROMPT env method works.
Dupe Check
Describe the bug
Deactivating the virtualenv shows the error. And this error will show for any commands until the current shell is closed.
Settings/Appearance Prompt -> choosing shell prompt (PS1) makes no difference. Other terminal has no issues.
Many thanks in advance!
To reproduce
Expected behavior
Should not have _old_fish_prompt errors.
Operating system
MacOS
Operating system and version
Mac 13.4.1
Shell Version
fish 3.7.1
Current Warp version
v0.2024.04.30.08.02.stable_01
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
No
Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)
Yes, this I confirmed this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e
None