Repository navigation
Closed
Labels
area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster
Description
Environment data
- VS Code version: 1.39.2
- Extension version (available under the Extensions sidebar): 2019.10.44104
- OS and version: Manjaro Linux
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.4 /dependent
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
- Relevant/affected Python packages and their versions: N/A
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"set to; more info How to update the language server to the latest stable version #3977): whatever the default is
Expected behaviour
When fish is the integrated automation shell, the following should be run to activate an environment:
source <python.venvpath>/bin/activate.fish
Actual behaviour
When opening up a new terminal, or when trying to debug, the following gets run:
source <python.venvpath>/bin/activate
which is for bash shells. This doesn't activate the environment.
Steps to reproduce:
- have this in your user settings json:
"terminal.integrated.automationShell.linux": "fish", - activate a virtualenv environment
- open up a terminal, or try to debug a script
- first command that's run is
source <python.venvpath>/bin/activate, which is for bash/zsh/dash, and will fail for fish and zsh
Logs
Not sure what logs would be useful, but here's an example when I try to debug a script
~/D/studproject source /home/massiveatoms/virtualenvs/studieproject-ML/bin/activate wo 13 nov 2019 21:28:05 -03
~/virtualenvs/studieproject-ML/bin/activate (line 82): Missing end to balance this if statement
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
^
from sourcing file ~/virtualenvs/studieproject-ML/bin/activate
called on standard input
source: Error while reading file “/home/massiveatoms/virtualenvs/studieproject-ML/bin/activate”
^ that's just fish complaining because fish scripts have different syntax compared to bash, I think.
Reacted by Morteza T, Jacob Root, Cornelius Roemer and Peter Sobolewski
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster
Activity
brettcannon commentedon Nov 14, 2019
Duplicate of #8341 (which has a workaround for this problem).
TinyAtoms commentedon Nov 16, 2019
Hey, could you perhaps point out the workaround?
Because I'm just not seeing it.
Also, I don't think our problems are duplicates.
In your "Actual behaviour" section, you can see that the first thing that's run is
source /Users/brettcannon/Repositories/brettcannon/caniusepython3/.venv/bin/activate.fishThe problem I'm having is that vscode is running
source ~/ENV/bin/activateinstead ofsource ~/ENV/bin/activate.fish.Furthermore, I can manually run
source ~/ENV/bin/activate.fishand everything will work fine, while you said that's another way to reproduce the issue for you?Also, (take this with a grain of salt, I'm new to fish) it kind of appears that you have a misconfigured fish problem? I had a similar issue when I tried to get virtualfish (a virtualenv wrapper for fish) to work, and I ended up removing my fish configs and reinstalling it to get normal virtualenv to work.
[-]when using virtualenv and fish as the default shell, the environment doesn't get activated correctly[/-]brettcannon commentedon Nov 18, 2019
TinyAtoms Sorry! You're right, I misread your issue and didn't pick up on the "automationShell" part. I have reopened this as a feature request to support "editor.integrated.automationShell" for environment activation.
As for the config issue, if I you can find something wrong in https://github.com/brettcannon/dotconfig/tree/master/fish then please let me know, otherwise the I have had has bit enough people that I think it might be a subtle problem (it's even been reported to virtualenv with no solution yet).
TinyAtoms commentedon Nov 18, 2019
Hmmm, I see nothing wrong (with my untrained eye) with your fish configs.
What version of fish and virtualenv are you using, btw? Maybe an update from one of them fixed the issue? I'm using fish 3.0.2-2 and virtualenv 16.7.7 and my activate.fish activates without errors.
brettcannon commentedon Nov 19, 2019
Latest fish and I'm using venv, not virtualenv (mainly because it's better integrated and I can fish things in the stdlib 😁 ).
TinyAtoms commentedon Nov 19, 2019
Hmm, I just tried it (never hear of venv before), but it works fine for me
https://i.imgur.com/gsoxznP.png in plain terminal
https://i.imgur.com/cYPf8gJ.png in vscode
karrtikr commentedon Oct 20, 2021
Is this issue still happening with the latest version of the extension? We use VSCode API to detect the currently opened shell, which potentially could take care of this setting automatically.
brettcannon commentedon Dec 14, 2021
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.