Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fish by sourcing activate.fish #13854

Closed
otisdog8 opened this issue Sep 9, 2020 · 5 comments
Closed

Support fish by sourcing activate.fish #13854

otisdog8 opened this issue Sep 9, 2020 · 5 comments
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@otisdog8
Copy link

otisdog8 commented Sep 9, 2020

Environment data

  • VS Code version: 1.48.2
  • Extension version (available under the Extensions sidebar): Version: 1.48.2
  • OS and version: Arch Linux, 5.8.7-arch1-1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): poetry (virtualenv maybe)
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: ms-python.python
  • Value of the python.languageServer setting: Mircrosoft

Expected behaviour

Opening a terminal automatically activates the selected virtual environment, by running
source <python.venvpath>/bin/activate.fish

Actual behaviour

Fish errors because it runs:
source <python.venvpath>/bin/activate
This is for bash shells

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Setup Fish by adding this to the end of ~/.bashrc
    if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]]
    then
    exec fish
    fi
  2. Create and select a virtual enviornment
  3. Open a terminal
  4. first command that is run is source <python.venvpath>/bin/activate, which fails for fish.
    (Setting the terminal.integrated.automationShell.linux variable does not change the result, but changing "terminal.integrated.shell.linux" fixes the issue). However, this breaks other parts of my setup.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - control'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - control'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaacf'

conda --version
conda info --json
pyenv root
python3.7 ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3.6 ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python2 ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3 ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
~/.cache/pypoetry/virtualenvs/icons-egDUSKH7-py3.8/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Error 2020-09-09 13:32:10: Failed to check if file needs to be fixed EntryNotFound (FileSystemError): Unable to read file '/home/otis/.config/Code/User/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/otis/.config/Code/User/settings.json')
at _handleError (/usr/lib/code/out/vs/workbench/services/extensions/node/extensionHostProcess.js:672:249)
at v.readText (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:1:495817)
at p.doesFileNeedToBeFixed (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:56:953520)
at /home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:56:952647
at async Promise.all (index 0)
at p.getFilesToBeFixed (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:56:952593)
at p.updateTestSettings (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:56:952220) {
code: 'FileNotFound',
name: 'EntryNotFound (FileSystemError)'
}
~/.cache/pypoetry/virtualenvs/icons-egDUSKH7-py3.8/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
~/.cache/pypoetry/virtualenvs/icons-egDUSKH7-py3.8/bin/python ~/.vscode-oss/extensions/ms-python.python-2020.8.106424/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
Starting Microsoft Python language server.
Python interpreter path: ~/.cache/pypoetry/virtualenvs/icons-egDUSKH7-py3.8/bin/python
Error 2020-09-09 13:32:10: Failed to download and store experiments, Class name = b, completed in 2634ms, has a falsy return value, , Return Value: undefined Error: Failed with status 404, Not Found, Uri https://raw.githubusercontent.com/microsoft/vscode-python/master/experiments.json
at H._callback (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:54:713175)
at H.a._callback.a.callback.a.callback [as callback] (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:5442)
at H.emit (events.js:203:13)
at H. (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:18302)
at H.emit (events.js:203:13)
at IncomingMessage. (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:17134)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Error 2020-09-09 13:32:10: Failed to initialize experiments, Class name = b, completed in 2640ms, has a falsy return value, , Return Value: undefined Error: Failed with status 404, Not Found, Uri https://raw.githubusercontent.com/microsoft/vscode-python/master/experiments.json
at H._callback (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/extension.js:54:713175)
at H.a._callback.a.callback.a.callback [as callback] (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:5442)
at H.emit (events.js:203:13)
at H. (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:18302)
at H.emit (events.js:203:13)
at IncomingMessage. (/home/otis/.vscode-oss/extensions/ms-python.python-2020.8.106424/out/client/node_modules/request.js:189:17134)
at Object.onceWrapper (events.js:291:20)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
vslsStack: [
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {}
]
}
conda --version

@otisdog8 otisdog8 added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 9, 2020
@otisdog8 otisdog8 changed the title Support fish or chang Support fish or changing of virtual enviornment activation script Sep 9, 2020
@karthiknadig karthiknadig changed the title Support fish or changing of virtual enviornment activation script Support fish by sourcing activate.fish Sep 10, 2020
@brettcannon brettcannon added area-terminal needs PR and removed triage-needed Needs assignment to the proper sub-team labels Sep 10, 2020
@brettcannon
Copy link
Member

I can verify that fish is choosing activate.sh when the .fish file extension is left off.

@karrtikr
Copy link

You can set custom activation commands with #8870. Please upvote the feature request.

@brettcannon brettcannon added the info-needed Issue requires more information from poster label Sep 10, 2020
@brettcannon
Copy link
Member

@otisdog8 I actually can't reproduce this under Ubuntu or macOS:

image

What version of the extension are you using?

@otisdog8
Copy link
Author

I was using 2020.8.106424. (must have made a mistake on the issue that I posted) How did you setup fish on those other operating systems? I have mine setup so that the default OS shell is bash, as well as the actual shell configured in vscode, but then I have bashrc open fish with
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]]
then
exec fish
fi

@brettcannon
Copy link
Member

@otisdog8 ah, that would explain it then as fish is my login shell on my OSs (set by using chsh).

So this is occurring because we can't detect what your shell is after you launch the terminal. At that point we have no clue what you have typed, and so to us this is the same as launching bash and then typing fish at the terminal.

If you want to have fish be your shell in VS Code then you can set "terminal.integrated.shell.linux" to the path of your fish shell and then VS Code will use and launch that in the terminal.

@ghost ghost removed the needs PR label Sep 11, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants