Vscode-jupyter: Conda/Jupyter issue error: "StdErr from ShellExec, 'Analysis'..."

Created on 28 Jun 2020  路  14Comments  路  Source: microsoft/vscode-jupyter

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Installed VSCode and Miniconda3 on Windows 10, making sure to add Miniconda3 to the PATH env variable
  2. installed python extension for vscode
  3. Created new conda env:
conda create -n itp_2020 python=3.6 jupyter scikit-learn seaborn pandas xlrd
  1. selected itp_2020 python interpreter
  2. opened existing/ created new ipynb and executed any cell

Actual behavior

Get the following error:

StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command, operable program or batch file. for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc\.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py

Expected behavior

Successfully start jupyter server and execute cell.

Your Jupyter and/or Python environment

_Please provide as much info as you readily know_

  • Jupyter server running: Local
  • Extension version: v2020.6.90262
  • VS Code version: 1.46.1
  • Setting python.jediEnabled: false
  • Setting python.languageServer: Jedi
  • Python and/or Anaconda version: miniconda3: 4.8.3 (python: 3.7.7.final.0)
  • OS: Windows | Mac | Linux (distro): Windows 10
  • Virtual environment: conda

Developer Tools Console Output


[Extension Host] Info Python Extension: 2020-06-28 00:15:28: Activating Environment to capture Environment variables, C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py
console.ts:137 [Extension Host] Error Python Extension: 2020-06-28 00:15:30: getActivatedEnvironmentVariables [Error: StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py at E.getActivatedEnvironmentVariablesImpl (c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\out\client\extension.js:48:706808) at processTicksAndRejections (internal/process/task_queues.js:85:5)]
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Error Python Extension: 2020-06-28 00:15:30: getActivatedEnvironmentVariables, Class name = E, completed in 2269ms, has a falsy return value, Arg 1: undefined, Arg 2: {"architecture":3,"path":"C:\Users\bianc\miniconda3\envs\itp_2020\python.exe","version":{"options":{"loose":false,"includePrerelease":false},"loose":false,"raw":"3.6.10-final","major":3,"minor":6,"patch":10,"prerelease":["final"],"build":[],"version":"3.6.10-final"},"sysPrefix":"C:\Users\bianc\miniconda3\envs\itp_2020","fileHash":"ac2778943090fefbc43561e8fa5926bb61829a26bef4a1965cbb0bbf88f3a15cad4aa3fa32130b3cfb14cb8e4417c782f57f99ec5227803d50baf31c764eb310","companyDisplayName":"Anaconda, Inc.","type":"Conda","envPath":"C:\Users\bianc\miniconda3\envs\itp_2020","envName":"itp_2020","displayName":"Python 3.6.10 64-bit ('itp_2020': conda)"}, Arg 3: true [Error: StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py at E.getActivatedEnvironmentVariablesImpl (c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\out\client\extension.js:48:706808) at processTicksAndRejections (internal/process/task_queues.js:85:5)]
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Info Python Extension: 2020-06-28 00:15:30: Finished executing cell c12deb14-7a4e-4cec-a4bc-85ca689034c0
notificationsAlerts.ts:40 StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command, operable program or batch file. for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py
onDidChangeNotification @ notificationsAlerts.ts:40
(anonymous) @ notificationsAlerts.ts:26
fire @ event.ts:587
addNotification @ notifications.ts:207
notify @ notificationService.ts:106
(anonymous) @ mainThreadMessageService.ts:83
_showMessage @ mainThreadMessageService.ts:44
$showMessage @ mainThreadMessageService.ts:38
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Error Python Extension: 2020-06-28 00:15:30: DataScience Error [Error: StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py at E.getActivatedEnvironmentVariablesImpl (c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\out\client\extension.js:48:706808) at processTicksAndRejections (internal/process/task_queues.js:85:5)]
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Error Python Extension: 2020-06-28 00:15:30: getActivatedEnvironmentVariables [Error: StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py at E.getActivatedEnvironmentVariablesImpl (c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\out\client\extension.js:48:706808) at processTicksAndRejections (internal/process/task_queues.js:85:5)]
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Error Python Extension: 2020-06-28 00:15:30: getActivatedEnvironmentVariables, Class name = E, completed in 2274ms, has a falsy return value, Arg 1: undefined, Arg 2: {"architecture":3,"path":"C:\Users\bianc\miniconda3\envs\itp_2020\python.exe","version":{"options":{"loose":false,"includePrerelease":false},"loose":false,"raw":"3.6.10-final","major":3,"minor":6,"patch":10,"prerelease":["final"],"build":[],"version":"3.6.10-final"},"sysPrefix":"C:\Users\bianc\miniconda3\envs\itp_2020","fileHash":"ac2778943090fefbc43561e8fa5926bb61829a26bef4a1965cbb0bbf88f3a15cad4aa3fa32130b3cfb14cb8e4417c782f57f99ec5227803d50baf31c764eb310","companyDisplayName":"Anaconda, Inc.","type":"Conda","envPath":"C:\Users\bianc\miniconda3\envs\itp_2020","envName":"itp_2020","displayName":"Python 3.6.10 64-bit ('itp_2020': conda)"}, Arg 3: true [Error: StdErr from ShellExec, 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
for C:/Users/bianc/miniconda3/Scripts/activate && conda activate itp_2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\pythonFiles\pyvsc-run-isolated.py c:/Users/bianc/.vscode/extensions/ms-python.python-2020.6.90262/pythonFiles/printEnvVariables.py at E.getActivatedEnvironmentVariablesImpl (c:\Users\bianc.vscode\extensions\ms-python.python-2020.6.90262\out\client\extension.js:48:706808) at processTicksAndRejections (internal/process/task_queues.js:85:5)]

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

bug

Most helpful comment

I see, in the image you shared, your server has not started. Conda sometimes has issues activating outside of its prompt.
Please try this:

  • close VS Code
  • open the Anaconda Prompt (not cmd.exe nor PowerShell)
  • in the Anaconda Prompt, go to your project folder C:\Users\bianc\Desktop\itp\itp_spring_2020
  • activate your environment: conda activate itp_2020
  • run VS Code: code .
  • try to run a cell

Please let me know if that works for you.

All 14 comments

Thanks for letting us know @BiancaAU1. Could you try to activate your environment from an Anaconda Prompt, and then run vscode from that same prompt?

I can activate my environment using (conda activate itp_2020), but it does not seem to work with running my vscode. I tried doing print('hello') in the powershell and conda terminal, and I received the error (Unable to initialize device PRN).

troubleshoot_1.pdf
File contains what I see in my vscode.

I see, in the image you shared, your server has not started. Conda sometimes has issues activating outside of its prompt.
Please try this:

  • close VS Code
  • open the Anaconda Prompt (not cmd.exe nor PowerShell)
  • in the Anaconda Prompt, go to your project folder C:\Users\bianc\Desktop\itp\itp_spring_2020
  • activate your environment: conda activate itp_2020
  • run VS Code: code .
  • try to run a cell

Please let me know if that works for you.

I was able to activate the environment, but opening the folder and running code . also gave me errors. I am attaching again the file of what occurred with Anaconda Prompt.

Even when opening the Anaconda Prompt it already gave me: 'Analysis' is not recognized as an internal or external command,
operable program or batch file.
Error: 'C:\Users\bianc\Desktop\itp\itp_spring_2020' is not recognized as an internal or external command,
operable program or batch file.
Error: 'code' is not recognized as an internal or external command,
operable program or batch file.

troubleshoot_2.pdf

I was able to run cd C:\Users\bianc\Desktop\itp\itp_spring_2020 to open project folder, but again I could not run code .

Edit: I repeated the steps and also ran code . in VS Code this time and I received same error message in VS Code as I had started.

troubleshoot_2b.pdf

troubleshoot_2c.pdf

You need to add VS Code to your path for code . to work. To do that you can follow these instructions:

  • Press the Windows logo on the task bar.
  • Type 'path'
  • Click on 'Edit the system environment variables'
  • On the bottom right, click Environment Variables
  • On the top section, where it says 'User variables for _Your User_' look for 'Path' and highlight it.
  • Press Edit
  • Add the path to the VS Code executable (it should be in C:\Program Files\Microsoft VS Code\bin or C:\Program Files (x86)\Microsoft VS Code\bin if you downloaded it to the default folder)
  • Click 'OK' to finish

Now close your current Anaconda Prompt and open a new one, code . should work.

I have VS Code in my environmental variables. I still get the same error as before:
'code' is not recognized as an internal or external command,
operable program or batch file.

troubleshoot_3.pdf
file contains all my environmental variables

I see, that's very strange that it doesn't work. Is code recognized on PowerShell or cmd.exe?
Also, can you show me the content of C:\Users\bianc\AppData\Local\Programs\Microsoft VS Code\bin?

code works to start VS Code in Windows Powershell, cmd.exe, and Anaconda Powershell Prompt(miniconda3), but not in Anaconda Prompt(miniconda3).

The folder contains a file called code and another called code.cmd

troubleshoot_4.pdf

In C:\Users\bianc\miniconda3\Scripts\activate.bat the file contains the same error message when it's launched from the folder: 'Analysis' is not recognized as an internal or external command,
operable program or batch file. (not sure if that's supposed to be the default message)

Also, I've already tried removing and reinstalling VSCode and miniconda3 several times, and I keep getting the same problem and error message.

@BiancaAU1, sorry you're having so much trouble. Looks like you and David have tried a couple things that seemed reasonable. I have a couple other suggestions.

  1. Be sure to install VS Code if it's still uninstalled.
  2. Start the Anaconda prompt you've been having trouble with.
  3. type 'set path' and send the results. This will show you the path that your command prompt is actually using. Seems like it's not what we think it is.

You can verify if code can be found in the path from that same command prompt by running: 'where code'

Assuming that indeed code is not on the Anaconda prompt path, this likely means the error you get about "'Analysis' not being recognized..." is key. I'm not sure what 'Analysis' its talking about but because it can't be found, the path for that command prompt isn't getting set correctly.

What build of miniconda are you installing? If you're willing, it would be interesting to try installing the full version of Anaconda to see if it's command prompt works correctly.

set path
Path=C:\Users\bianc\miniconda3;C:\Users\bianc\miniconda3\Library\mingw-w64\bin;C:\Users\bianc\miniconda3\Library\usr\bin;C:\Users\bianc\miniconda3\Library\bin;C:\Users\bianc\miniconda3\Scripts;C:\Users\bianc\miniconda3\bin;C:\Users\bianc\miniconda3\condabin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\WINDOWS\System32\OpenSSH;c:\WINDOWS\System32\WBem;C:\Program Files\Git\cmd;C:\Users\bianc\miniconda3;C:\Users\bianc\miniconda3\Library\mingw-w64\bin;C:\Users\bianc\miniconda3\Library\usr\bin;C:\Users\bianc\miniconda3\Library\bin;C:\Users\bianc\miniconda3\Scripts;C:\Program Files (x86)Applied Biosystems\QuantStudio Design
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

where code
INFO: Could not find files for the given pattern(s).

set path where code
Environment variable path where code not defined

When going to User Variables, VS Code is in the list but it's not in my system variables. Not sure why it's not showing up in set path.

miniconda build: Miniconda3-latest-Windows-x86_64 for python version 3.7

@BiancaAU1, please try to add VS Code to the System Variables

It works now. I put C:\Users\bianc\AppData\Local\Programs\Microsoft VS Code\bin into System Variables and then ran code . in the Anacondaa Prompt. It took a while for Jupyter Server to report local but it seems to be working now. Thank you for your help!

Was this page helpful?
0 / 5 - 0 ratings