PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

An error was reported in the output window when creating the env.

Open ttSpace opened this issue 2 years ago • 3 comments

Describe the bug

image

Steps to Reproduce

  1. Create a Python Application.
  2. Create a virtual environment.

Expected behavior

The output window shows that the virtual environment was created successfully.

Additional context and screenshots

An error was reported in the output window when creating the env.

image

output_info.txt

ttSpace avatar Jun 17 '22 05:06 ttSpace

@ttspace I think this is an issue with the VS installer not cleaning up registry keys properly. We've seen things like this in the past.

Can you verify that the following folder exists on your machine? C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64 This is where VS installs python.

If python isn't there, there might be stale registry keys that VS uses to check for existing installations. To fix the registry, do the following:

  1. Run Start -> regedit
  2. Delete Computer\HKEY_CURRENT_USER\Software\Python (this will mess up any other python installs you have)
  3. Delete Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Python (this will mess up any other python installs you have)
  4. Run VS again and modify your installation. Python 3.9 should now be unchecked. Check it and click on Modify and it will be installed.
  5. Now verify that the following registry entry exists: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.9
  6. Verify that the installed python is actually on disk at C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64

I did these steps and I was able to run python applications using the python that comes with VS.

AdamYoblick avatar Jun 20 '22 15:06 AdamYoblick

@AdamYoblick I didn't do anything else, python is here.

image

  1. Computer\HKEY_CURRENT_USER\Software\Python does not exist.
  2. Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.9 It exists.

image

ttSpace avatar Jun 21 '22 02:06 ttSpace

I don't see the exact same error message from pylance, but I AM able to repro the Python was not found messages, even though the environment is able to be created successfully. Let me investigate.

AdamYoblick avatar Jun 22 '22 22:06 AdamYoblick

In today's latest build:17.6.0 Preview 2.0 [33407.118.main],Python Package:17.0.23033.1 output_info image

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
AssignProcessToJobObject: (87) The parameter is incorrect.


Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Virtual environment is being created at 'C:\Users\wangjun\source\repos\PythonApplication4\PythonApplication4\env'
Error: Unknown change event received
    at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23)
    at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22)
    at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49)
    at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35)
    at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23)
    at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41)
    at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Error: Unknown change event received
    at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23)
    at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22)
    at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49)
    at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35)
    at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23)
    at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41)
    at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Error: Unknown change event received
    at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23)
    at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22)
    at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49)
    at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35)
    at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23)
    at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41)
    at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processImmediate (node:internal/timers:437:9)

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Error: Unknown change event received
    at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23)
    at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22)
    at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49)
    at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35)
    at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23)
    at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41)
    at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Error: Unknown change event received
    at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23)
    at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22)
    at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49)
    at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35)
    at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23)
    at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41)
    at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)

Virtual environment was successfully created at 'C:\Users\wangjun\source\repos\PythonApplication4\PythonApplication4\env'
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

linette-zyy avatar Feb 08 '23 06:02 linette-zyy

@StellaHuang95 can you try to repro this whenever you have some time? I just want to make sure this isn't an urgent blocker now. Thanks :)

AdamYoblick avatar Feb 08 '23 19:02 AdamYoblick

@AdamYoblick I saw a bunch of Error: Unknown change event received, but I wasn't able to repro the Python was not foundmessages

StellaHuang95 avatar Feb 08 '23 19:02 StellaHuang95

Does the environment still get created? Unknown event received seems like a pylance issue, we probably need to present this to the team then.

AdamYoblick avatar Feb 08 '23 19:02 AdamYoblick

@AdamYoblick yes image

StellaHuang95 avatar Feb 08 '23 19:02 StellaHuang95

Ok great, doesn't seem too urgent then. The error messages are annoying and we need to fix them. But the callstack concerns me, that's a pylance problem. Either there's a bug in pylance, or PTVS is sending something it shouldn't be. Needs more investigation.

AdamYoblick avatar Feb 08 '23 21:02 AdamYoblick

image In today's latest build, the output window shows this error: AssignProcessToJobObject: (87) The parameter is incorrect.

linette-zyy avatar Mar 02 '23 02:03 linette-zyy

In today's build:17.6.0 Preview 3.0 [33606.364.d17.6], Python Package:17.0.23087.1 After create an env, File -> New Project; output window shows this error:

Python was not found but can be installed from the Microsoft Store: ms-windows-store://pdp/?productid=9NJ46SX7X90PSending log message failed
Sending log message failed
Sending log message failed
Sending log message failed
Sending log message failed
Error: Connection is closed.
    at throwIfClosedOrDisposed (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:829:19)
    at Object.sendNotification (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:910:13)
    at p.send (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver\lib\common\server.js:99:33)
    at p.log (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver\lib\common\server.js:95:14)
    at c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver\lib\common\server.js:374:37
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

linette-zyy avatar Apr 07 '23 06:04 linette-zyy

image On today's latest build, there is an error after creating a conda-environment image

----- Creating 'conda01' -----
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
==> WARNING: A newer version of conda exists. <==
  current version: 23.7.2
  latest version: 23.7.3
Please update conda by running
    $ conda update -n base -c defaults conda
Or to minimize the number of packages updated during conda update use
     conda install conda=23.7.3
Downloading and Extracting Packages
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
#     $ conda activate conda01
#
# To deactivate an active environment, use
#
#     $ conda deactivate
----- Successfully created 'conda01' -----

AssignProcessToJobObject: (87) The parameter is incorrect.

linette-zyy avatar Sep 01 '23 02:09 linette-zyy

pylance crash related to textDocument.text missing was here. https://github.com/microsoft/PTVS/pull/7401

bschnurr avatar Jan 26 '24 21:01 bschnurr