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

source .venv/bin/activate - ends in error /bin/sh: 8: source: not found #12968

Closed
brentgracey opened this issue Jul 15, 2020 · 3 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@brentgracey
Copy link

Environment data

  • VS Code version: 1.47.1
  • Extension version (available under the Extensions sidebar): 2020.6.91350
  • OS and version: Ubuntu 19.10 - Linux x64 5.3.0-62-generic snap
  • Python version (& distribution if applicable, e.g. Anaconda): python3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Value of the python.languageServer setting: I do not see an entry for this in either User or Workspace settings.json
  • workspace setting /.vscode/settings.json "python.pythonPath": ".venv/bin/python"

Expected behaviour

Can run source .venv/bin/activate from TERMINAL within vs-code

Actual behaviour

source ends in error

$ source .venv/bin/activate
/bin/sh: 8: source: not found

Steps to reproduce:

Create a folder
Open folder in vs-code
In vs-code terminal run python3 -m venv .venv
Set interpreter path (venv/bin/python)
source .venv/bin/activate - ends in error /bin/sh: 8: source: not found

If I go to the same folder in a terminal outside of vs-code the source .venv/bin/activate command runs successfully without any error.

Logs

These logs are all produced from the python3 -m venv .venv command

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
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 - experiment'
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'

conda --version
pyenv root
conda info --json
python3.7 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3.6 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python2 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
/usr/bin/python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
/usr/bin/python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
/usr/bin/python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
/usr/bin/python ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
Starting Jedi Python language engine.
Python interpreter path: /usr/bin/python3
conda --version
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/completion.py
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/completion.py
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/repos/pythonmin/python.py
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/repos/pythonmin/python.py
cwd: ~/repos/pythonmin
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
/usr/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.

~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py pip --version
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/repos/pythonmin/python.py
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/repos/pythonmin/python.py
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
Starting Jedi Python language engine.
Python interpreter path: ./.venv/bin/python3

~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/repos/pythonmin
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/completion.py
~/repos/pythonmin/.venv/bin/python3 ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.6.91350/pythonFiles/completion.py

@brentgracey brentgracey added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jul 15, 2020
@karthiknadig karthiknadig self-assigned this Jul 15, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jul 15, 2020
@karthiknadig
Copy link
Member

@myfree Does source .venv/bin/activate run automatically when you create new terminal? this is expected if you have python.terminal.activateEnvironment set. The reason it fails is probably because you are using an unsupported shell. You can unset python.terminal.activateEnvironment, and manually activate or use bash.

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Jul 16, 2020
@brentgracey
Copy link
Author

thanks for those pointers
Yes; I did have python.terminal.activateEnvironment set. I updated it to false; opened a new Terminal in vs-code; and running python3 -m venv .venv manually does not hit the error.

-> The reason it fails is probably because you are using an unsupported shell.
Is that controlled by the setting "terminal.integrated.automationShell.linux": "" ?
Do you know what values I can set to use a supported shell on Ubuntu?

Are you aware why sourcing automatically can error; where-as it seems that doing it manually works correctly?

Thanks again; follow up questions are mostly just to help me build some understanding of whats going on here.

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Aug 17, 2020
@karthiknadig
Copy link
Member

terminal.integrated.automationShell.linux is a VSCode specific setting, to select shell to use when it needs to run things.

These are the shells that we identify and support. In your case you had selected 'sh' as the default shell for the terminal, which we don't support.

export enum TerminalShellType {
powershell = 'powershell',
powershellCore = 'powershellCore',
commandPrompt = 'commandPrompt',
gitbash = 'gitbash',
bash = 'bash',
zsh = 'zsh',
ksh = 'ksh',
fish = 'fish',
cshell = 'cshell',
tcshell = 'tshell',
wsl = 'wsl',
xonsh = 'xonsh',

You can change the default shell from the command pallet:
image

'sh' does not have source as an alias. So it fails there. select bash as the default shell for the terminal and it should work.

@ghost ghost removed the triage label Aug 25, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants