question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'conda activate base' error with default, exclusive Anaconda install

See original GitHub issue

Environment data

  • VS Code version: 1.48.0
  • Extension version (available under the Extensions sidebar): 2020.8.101144
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.3 64-bit (‘base’: conda)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/a
  • Value of the python.languageServer setting: Jedi

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behavior

When you execute your first command in a .py file using shift-enter, and that is a valid command, there are no errors in the terminal.

If there is additional setup needed beyond a default install of Visual Studio Code, Anaconda, and the Python extension, then either of these should happen:

  1. (preferred) Fix things so that additional intervention is not needed after a default install.
  2. If it is not feasible to make it “just work”, then provide a meaningful message that informs the user what needs to happen.

IMPORTANT: This is not a support request! Visual Studio Code should just work with a default installation. If it doesn’t work, then either the code needs to be improved or a useful notice needs to be given to the user.

Actual behavior

The first command that you execute causes the Python environment to start up. It starts with conda activate base, which causes an error: image

Steps to reproduce:

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

  1. Start with a clean environment that hasn’t had Python, Visual Studio Code, or the Python VSCode extension installed.
  2. Install Visual Studio Code.
  3. Install the current release of Anaconda for Windows off of https://www.anaconda.com/products/individual and accept all defaults (you can also change to install for all users–will still get the same error)
  4. Load any .py file in Visual Studio. The .py file needs just one valid, trivial line of code.
  5. Allow Visual Studio Code to install the Python extension. (It will prompt you after you load the first .py file.)
  6. Run a line of Python code using shift-enter.

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 - 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 ‘AA_testing - 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 pyenv root python3.7 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” python3.6 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” python3 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” python2 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” python “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” py -3.7 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” py -3.6 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” py -3 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” py -2 “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” Starting Jedi Python language engine. Error 2020-08-16 22:03:38: Detection of Python Interpreter for Command python and args failed as file does not exist Error 2020-08-16 22:03:38: Detection of Python Interpreter for Command python3 and args failed as file does not exist C:\ProgramData\Anaconda3\Scripts\conda.exe info --json C:\ProgramData\Anaconda3\Scripts\conda.exe info --json C:\ProgramData\Anaconda3\Scripts\conda.exe info --json C:\ProgramData\Anaconda3\Scripts\conda.exe info --json C:\ProgramData\Anaconda3\Scripts\conda.exe info --json Python interpreter path: C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.prefix)” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.prefix)” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import sys;print(sys.executable)” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “from distutils.sysconfig import get_python_lib; print(get_python_lib())” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “from distutils.sysconfig import get_python_lib; print(get_python_lib())” cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” site --user-site cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” site --user-site cwd: c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\out\client Error 2020-08-16 22:03:39: Failed to get interpreter information for ‘C:\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python.exe’ [Error: Command failed: “C:\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python.exe” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\interpreterInfo.py” Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640 at ChildProcess.exithandler (child_process.js:308:12) at ChildProcess.emit (events.js:203:13) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] { killed: false, code: 9009, signal: null, cmd: ‘“C:\\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python.exe” “c:\Users\Aren Cambre\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\interpreterInfo.py”’ } Error 2020-08-16 22:03:39: Failed to get interpreter information for ‘C:\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python3.exe’ [Error: Command failed: “C:\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python3.exe” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\interpreterInfo.py” Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640 at ChildProcess.exithandler (child_process.js:308:12) at ChildProcess.emit (events.js:203:13) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] { killed: false, code: 9009, signal: null, cmd: ‘“C:\\Users\Aren Cambre\AppData\Local\Microsoft\WindowsApps\python3.exe” “c:\Users\Aren Cambre\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\interpreterInfo.py”’ } C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\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 “e:\Google Drive\research\Campsite checker\check_sites.py” cwd: e:\Google Drive\research\Campsite checker C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\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 “e:\Google Drive\research\Campsite checker\check_sites.py” cwd: e:\Google Drive\research\Campsite checker C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py” C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py” Error 2020-08-16 22:03:41: stderr jediProxy Error (stderr) c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py:586: DeprecationWarning: Deprecated since version 0.16.0. Use Script(…).get_names instead. jedi.api.names(

C:\ProgramData\Anaconda3\Scripts\conda.exe env list C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import jupyter” C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” -c “import notebook” C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” jupyter kernelspec --version C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v C:\ProgramData\Anaconda3\python.exe (daemon) -m jupyter notebook --no-browser --notebook-dir=C:\Users\ARENCA~1\AppData\Local\Temp\2647a097-96d4-43af-bbdf-a98bd775cb2a --config=C:\Users\ARENCA~1\AppData\Local\Temp\2647a097-96d4-43af-bbdf-a98bd775cb2a\jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0 C:\ProgramData\Anaconda3\python.exe (daemon) -m jupyter kernelspec list --json C:\ProgramData\Anaconda3\python.exe (daemon) -m jupyter kernelspec list --json ##########Linting Output - pylint########## ************* Module check_sites 46,30,error,used-before-assignment:Using variable ‘email_body’ before assignment


Your code has been rated at 8.48/10 (previous run: 8.48/10, +0.00)

C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getJupyterKernels.py” C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getJupyterKernels.py” C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getServerInfo.py” C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getServerInfo.py” C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getServerInfo.py” C:\ProgramData\Anaconda3\python.exe (daemon) “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\vscode_datascience_helpers\getServerInfo.py” Error 2020-08-16 22:04:01: stderr jediProxy Error (stderr) c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py:594: DeprecationWarning: Providing the line is now done in the functions themselves like Script(...).complete(line, column) script = jedi.Script( c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py:594: DeprecationWarning: Providing the column is now done in the functions themselves like Script(...).complete(line, column) script = jedi.Script(

Error 2020-08-16 22:04:01: stderr jediProxy Error (stderr) c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py:594: DeprecationWarning: Deprecated since version 0.17.0. Use the project API instead, which means Script(project=Project(dir, sys_path=sys_path)) instead. script = jedi.Script(

Error 2020-08-16 22:04:01: stderr jediProxy Error (stderr) c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\completion.py:628: DeprecationWarning: Deprecated since version 0.16.0. Use Script(…).infer instead. script.goto_definitions(), request[“id”]

C:\ProgramData\Anaconda3\python.exe “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\pyvsc-run-isolated.py” “c:\Users\Aren Cambre.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\normalizeForInterpreter.py” “import urllib.request, json, smtplib, ssl, keyring”

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
arencambrecommented, Jan 11, 2022

Coming back to this. It appears that to make Anaconda-installed Python work VSCode, one must first run these two commands in an Anaconda PowerShell window:

  • conda init powershell <-- this is just needed to make Anaconda work right with VSCode per @karthiknadig 's above comment
  • Set-ExecutionPolicy -ExecutionPolicy Unrestricted <-- (Must be run with administrative privileges.) The prior command causes C:\Users\[username]\Documents\WindowsPowerShell\profile.ps1 to be run every time PowerShell is started. With the default execution policy, this script cannot run, so you’ll get an error. This is what is needed to get profile.ps1 to run. This seems like a not-ideal solution as it eliminates a security mechanism, but I am not aware of anything else feasible.
1reaction
karthiknadigcommented, May 10, 2021

@joe733 Yes it will be addressed by #5344. Our plan is to not activate by sending source command to the terminal or even sending any command to the terminal at all. Instead we plan on having the terminal activated as it is created so we don’t accidentally have command overlap (with activation commands and some other command) when sending text commands to the terminal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conda activate base error - The term "conda" is not recongised
The reason is that VS Code uses the powershell terminal by default, but powershell does not activate the conda environment by default.
Read more >
Working with Environments – Introduction to Conda for (Data ...
By default the conda install command will install packages into the current, active environment. The following would activate the basic-scipy-env we created ...
Read more >
Manage your Python Virtual Environment with Conda
As you can see, you have successfully create your new Python environment. Now we have to activate and use it. (base) username %...
Read more >
Troubleshooting — Anaconda documentation
You need to run conda activate [env] . Env is optional, the default if not provided is base. You haven't started a new...
Read more >
Python and R with Anaconda
This is likely due to your ~/.bashrc configuration file auto-activating a conda environment with a problematic dbus package. You can resolve this issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found