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

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

Closed
arencambre opened this issue Aug 17, 2020 · 12 comments
Closed

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

arencambre opened this issue Aug 17, 2020 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@arencambre
Copy link

arencambre commented Aug 17, 2020

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\ARENCA1\AppData\Local\Temp\2647a097-96d4-43af-bbdf-a98bd775cb2a --config=C:\Users\ARENCA1\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"

@arencambre arencambre added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 17, 2020
@arencambre arencambre changed the title 'conda activate base' error with default install 'conda activate base' error with default, exclusive Anaconda install Aug 17, 2020
@karthiknadig karthiknadig self-assigned this Aug 17, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 17, 2020
@karthiknadig
Copy link
Member

@arencambre Are you able to call conda activate <env> from powershell outside of VS Code? See conda/conda#8428.

We are working on improving conda experience. But conda itself requires additional setup to work in Powershell correctly. Also, conda has to be added to path for it to work correctly, or try setting python.condaPath.

@arencambre
Copy link
Author

arencambre commented Aug 18, 2020

When I run conda activate base using a plain PowerShell prompt, I get the same error. However, when I run it using the Anaconda PowerShell Prompt, it works.

I compared the path on both (output of $Env:Path). The Anaconda version's path is the same except:

  • It's prefixed with C:\Users\[username]\Anaconda3;C:\Users\[username]\Anaconda3\Library\mingw-w64\bin;C:\Users\[username]\Anaconda3\Library\usr\bin;C:\Users\[username]\Anaconda3\Library\bin;C:\Users\[username]\Anaconda3\Scripts;C:\Users\[username]\Anaconda3\bin;C:\Users\[username]\Anaconda3\condabin;
  • (I doubt this is relevant) trailing backslashes are removed from path items.

But conda itself requires additional setup to work in Powershell correctly.

Yes, that's what I expected, and that's what I anticipated when opening this issue. I hope this extension can be improved to either do those steps for the user or provide instructions on what needs to be done.

conda/conda#8428 doesn't seem to relate. In that case, conda runs. Here, conda can't run because it's not in the path.

@karthiknadig
Copy link
Member

@arencambre The reason Anaconda Powershell Prompt works is because it starts powershell like this:

%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Miniconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Miniconda3' "

The way you do it from a regular powershell is using conda init powershell. This is very invasive, and every time you launch powershell, from then on, for any purpose, will cause conda to activate (at least the base environment). From the extension, we did not want to do this as a part of activation.

For now, use conda init powershell, you may have to navigate to where the conda binary is to run that. Using conda init also means that all powershell terminal from then on will have conda activated.

Note: we do have plans on improving this experience. But that is big change and we are working with conda to figure out a non invasive way to work with activated environments in powershell.

Created a doc bug for this: microsoft/vscode-docs#3951

@karthiknadig karthiknadig added investigating We are looking into the cause of the issue and removed triage labels Sep 15, 2020
@arencambre
Copy link
Author

@karthiknadig small nitpick: no conda command will work from a regular PowerShell prompt since the program is not in the path.

Don't mean to get lost on this detail. The more important thing is VSCode + Anaconda either should work out of the box, or instructions should be provided to users to help them configure correctly.

Running into this again as I am trying to get it working on a clean environment.

@arencambre
Copy link
Author

arencambre commented Oct 13, 2020

I also observe that conda init powershell itself will cause an error on every start of PowerShell. This is because default policy prohibits all script-running, which means C:\Users[username]\Documents\WindowsPowerShell\profile.ps1 will not run. I think that is created when you run conda init powershell, which has to be run using an Anaconda PowerShell prompt.

I think workarounds may be to disable the policy that blocks script-running or to sign profile.ps1.

@arencambre
Copy link
Author

arencambre commented Dec 21, 2020

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.

@yozachar
Copy link

image

Even though I have path set to conda binary and enabled auto activation, it activates base first with source and only then activates the current environment.

image

Can someone please confirm that this behavior will be resolved by #5344 (comment), #8864 and that auto activating current environment will be as simple as:

➜ conda activate env_name

@karthiknadig
Copy link
Member

@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.

@arencambre
Copy link
Author

Running into this again on a fresh install. This Github issue saves the day each time!

@arencambre
Copy link
Author

#2559 reflects the problem with the script execution policy, where in #13464 (comment) I had to change it.

@arencambre
Copy link
Author

arencambre commented Jan 11, 2022

(bad finding deleted)

@karrtikr karrtikr added needs PR Ready to be worked on and removed needs PR Ready to be worked on labels Aug 9, 2022
@karthiknadig karthiknadig added triage-needed Needs assignment to the proper sub-team and removed investigating We are looking into the cause of the issue labels Mar 3, 2023
@karrtikr
Copy link

Should be fixed with #2559 (comment).

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2023
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 triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

4 participants