microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.53k stars 675 forks source link

Python project not getting loaded in visual studio 2019 #6053

Closed webtrainingroom closed 3 years ago

webtrainingroom commented 4 years ago

Describe the bug I am using "Microsoft Visual Studio Community 2019, Version 16.5.1"

i was building a sample python console application using visual studio 2019, it was working fine till yesterday, but today morning when i was try to reopen the project i am getting error "project load failed", even after trying different ways like reload project, restart visual studio etc. it did not work. then i checked " View->Other Windows->Python" , realized that python profiling package not loading properly.

image

It says :

Microsoft Visual Studio

The 'PythonProfilingPackage' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\Arindam\AppData\Roaming\Microsoft\VisualStudio\16.0_fef3e741\ActivityLog.xml'.

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?

Yes No

but after restarting visual studio many times, event restarting machine after clearing all cache data... still getting the same issue.

huguesv commented 4 years ago

Hi @webtrainingroom

It sounds like an install problem, maybe something got corrupted. It would be worth trying to do a repair or reinstall.

There's a chance that the ActivityLog.xml file mentioned in the error message may help in solving the issue, so if you could attach it to the issue, we'll take a look.

webtrainingroom commented 4 years ago

Hi @huguesv

In log file it looks like, Microsoft.PythonTools.Profiling and Microsoft.PythonTools.Common assembly are missing, is there any package to be installed?

Wondering how did it happen! it was working perfectly,

I have re-installed python development workload as described in link below https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio?view=vs-2019 but still getting same error.

please take a look at the log file attached ActivityLog.log

ghpqans commented 4 years ago

Got exactly the same problem using VS 2019 community, 16.6.2, Windows 10 env. I cannot even create a python console project from scratch! grafik grafik

huguesv commented 4 years ago

@ghpqans you seem to be missing the core PTVS package, where most things are implemented like the project system, etc which would explain the error. It's just called "Python". This sure looks like an install problem. image

Can you click the copy button and paste the results here? Also, I would then uninstall the Python workload and reinstall, if you haven't tried already.

huguesv commented 4 years ago

@ghpqans I see you have other Python related extension (PyMap), I would try uninstalling them before reinstalling the Python workload.

Is this a problem that appeared after an update? Did it work and suddenly stopped working?

webtrainingroom commented 4 years ago

@huguesv , Yes, in my case, it was working perfectly earlier, and stopped working after an update.

huguesv commented 4 years ago

This Python/Core folder is where the "Python" files are installed (each other sibling folder maps to a different VS package listed in the about box).

image

and the Python project templates are here: image

Are either of those missing?

ghpqans commented 4 years ago

Here is the VS diag output. However i don't really understand how i could NOT have Python Core package installed. When i first set-up VS Community 2019 i already selected the Python workload and since i did not uninstall something related to Python. I installed some extensions to try them out and dependent on the result then kept or uninstalled them again, only. The other thing is that i have also an Idle installation in parallel. May that interfere?

Microsoft Visual Studio Community 2019 Version 16.6.2 VisualStudio.16.Release/16.6.2+30204.135 Microsoft .NET Framework Version 4.8.03752

Installierte Version: Community

Visual C++ 2019 00435-60000-00000-AA730 Microsoft Visual C++ 2019

Allgemeine Azure-Tools 1.10 Bietet allgemeine Dienste für die Verwendung durch Azure Mobile Services und Microsoft Azure-Tools.

ASP.NET and Web Tools 2019 16.6.948.25768 ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2020603+b3ac44798c16fff5b95dbcfe62dea84aa9a1bd72 Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019 16.6.948.25768 Weitere Informationen finden Sie unter https://www.asp.net/.

Azure App Service-Tools v3.0.0 16.6.948.25768 Azure App Service-Tools v3.0.0

Azure Functions and Web Jobs Tools 16.6.948.25768 Azure Functions and Web Jobs Tools

C#-Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66 C#-Komponenten, die in der IDE verwendet werden. Abhängig von Ihrem Projekttyp und den zugehörigen Einstellungen kann eine andere Version des Compilers verwendet werden.

Cookiecutter 16.6.20100.1 Stellt Tools zum Suchen, Instanziieren und Anpassen von Vorlagen im Cookiecutter-Format bereit.

Erweiterungen der Visual Studio-Containertools (Vorschau) 1.0 Hiermit werden Container in Visual Studio angezeigt, verwaltet und diagnostiziert.

Fabric.DiagnosticEvents 1.0 Fabric-Diagnoseereignisse

GitHub.VisualStudio 2.11.104.25275 A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Microsoft Azure-Tools 2.9 Microsoft Azure-Tools für Microsoft Visual Studio 2019 – v2.9.30212.1

Microsoft Azure Service Fabric-Tools für Visual Studio 16.0 Microsoft Azure Service Fabric-Tools für Visual Studio

Microsoft Continuous Delivery Tools für Visual Studio 0.4 Die Konfiguration von Azure DevOps-Pipelines von der Visual Studio-IDE aus wird vereinfacht.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++-Assistenten 1.0 Microsoft Visual C++-Assistenten

Microsoft Visual Studio-Tools für Container 1.1 Jetzt können Sie Ihre ASP.NET Core-Anwendung in der Zielumgebung entwickeln, ausführen und überprüfen. Drücken Sie F5, um die Anwendung direkt in einem Container mit Debugfunktionen auszuführen, oder STRG+F5 zum Bearbeiten und Aktualisieren Ihrer Anwendung, ohne den Container erneut erstellen zu müssen.

NuGet-Paket-Manager 5.6.0 NuGet-Paket-Manager in Visual Studio. Weitere Informationen zu NuGet finden Sie unter https://docs.nuget.org/.

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

PyMap Extension 1.0 PyMap Visual Studio Extension Detailed Info

Python – Conda-Unterstützung 16.6.20100.1 Conda-Unterstützung für Python-Projekte.

Python – Django-Unterstützung 16.6.20100.1 Stellt Vorlagen und Integration für das Django-Webframework bereit.

Python – IronPython-Unterstützung 16.6.20100.1 Stellt Vorlagen und Integration für IronPython-basierte Projekte bereit.

Python – Unterstützung für die Profilerstellung 16.6.20100.1 Profilerstellungsunterstützung für Python-Projekte.

SQL Server Data Tools 16.0.62006.03190 Microsoft SQL Server Data Tools

Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Testadapter für Google Test 1.0 Ermöglicht die Verwendung von Visual Studio-Testtools mit Komponententests, die für Google Test geschrieben wurden. Die Nutzungsbedingungen und Drittanbieterhinweise stehen im Installationsverzeichnis der Erweiterung zur Verfügung.

TSVN 1.9 Control TortoiseSVN from within Visual Studio

TypeScript-Tools 16.0.20417.2002 TypeScript-Tools für Microsoft Visual Studio

VC-Paket für Microsoft Visual Studio 1.0 VC-Paket für Microsoft Visual Studio

Visual Basic-Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66 Visual Basic-Komponenten, die in der IDE verwendet werden. Abhängig von Ihrem Projekttyp und den zugehörigen Einstellungen kann eine andere Version des Compilers verwendet werden.

Visual C++ für Linux-Entwicklung 1.0.9.30020 Visual C++ für Linux-Entwicklung

Visual F# Tools 10.9.1.0 für F# 4.7 16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59 Microsoft Visual F# Tools 10.9.1.0 für F# 4.7

Visual Studio-Tools für CMake 1.0 Visual Studio-Tools für CMake

Visual Studio-Tools für Container 1.0 Visual Studio-Tools für Container

Visual Studio-Tools für Kubernetes 1.0 Visual Studio-Tools für Kubernetes

Visual Studio Code-Debugadapter-Hostpaket 1.0 Interopebene zum Hosten der Visual Studio Code-Adapter in Visual Studio

huguesv commented 4 years ago

I don't know either how it is possible to be missing the core 'Python' VS package. Can you check the contents of that ...Extensions\Microsoft\Python\Core folder and see if it has a similar set of files to my screenshot above?

IDLE should have no effect on VS.

Maybe it is related to installing and uninstalling other VS extensions related to Python that define dependency on the core VS Python package.

Note that if you want to start from a clean state, the best thing is to uninstall VS completely and reinstall. Uninstalling and reinstalling a workload, or doing a repair doesn't fix issues as well as a clean uninstall and reinstall.

ghpqans commented 4 years ago

cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Python\Core dir /og /d

[.]                                              Microsoft.PythonTools.TestAdapter.dll
[..]                                             Microsoft.PythonTools.TestAdapter.Executor.dll
[Typeshed]                                       Microsoft.PythonTools.theme.pkgdef
[Snippets]                                       Microsoft.PythonTools.VSCommon.dll
[de]                                             Microsoft.PythonTools.VSInterpreters.dll
[debugpy]                                        Microsoft.PythonTools.WebRole.dll
[PythonFiles]                                    Microsoft.PythonTools.WebRole.dll.config
[ptvsd]                                          Microsoft.PythonTools.Workspace.dll
[NewFileItems]                                   Microsoft.PythonTools.XamlDesignerSupport.dll
[Visualizers]                                    missing_req_packages.py
IronPythonScraper.py                             ExtensionScraper.py
License_en-US.rtf                                Newtonsoft.Json.dll
Microsoft.Python.Analysis.Engine.dll             NoInterpreters.html
Microsoft.Python.LanguageServer.Core.dll         pip_downloader.py
Microsoft.PythonTools.Analyzer.exe               extension.vsixmanifest
Microsoft.PythonTools.Analyzer.exe.config        ptvsd_launcher.py
Microsoft.PythonTools.Attacher.exe               ptvsd_loader.py
Microsoft.PythonTools.AttacherX86.exe            ptvsd_repl_launcher.py
Microsoft.PythonTools.BuildTasks.dll             ptvs_virtualenv_proxy.py
Microsoft.PythonTools.Common.dll                 PyDebugAttach.dll
Microsoft.PythonTools.Core.pkgdef                PyDebugAttachX86.dll
Microsoft.PythonTools.Debugger.Concord.dll       PythonFile.ico
Microsoft.PythonTools.Debugger.dll               DkmDebugger.vsdconfig
Microsoft.PythonTools.Debugger.Helper.x64.dll    PythonProject.ico
Microsoft.PythonTools.Debugger.Helper.x64.pdb    PythonProjectBig.ico
Microsoft.PythonTools.Debugger.Helper.x86.dll    PythonScraper.py
Microsoft.PythonTools.Debugger.Helper.x86.pdb    scrape_module.py
Microsoft.PythonTools.dll                        createTemplateManifests.cache
Microsoft.PythonTools.EnvironmentsList.dll       testlauncher.py
Microsoft.PythonTools.Ipc.Json.dll               BuiltinScraper.py
Microsoft.PythonTools.pkgdef                     typing-stub.pyi
Microsoft.PythonTools.ProjectWizards.dll         Microsoft.PythonTools.RunElevated.exe
Microsoft.PythonTools.Repl.theme.pkgdef          visualstudio_py_testlauncher.py
get_search_paths.py
Microsoft.PythonTools.SuppressDpl.pkgdef
ghpqans commented 4 years ago

Here is an additional error message i get on an attempt to load a working Python project (VS 2017 Community) with VS 2019 Community in the context of this thread: grafik Don't know if this may be another hint or if it just has another cause and leads in the wrong direction. However.

MihaiHoriaPopescu commented 4 years ago

Got exactly the same problem using VS 2019 community, 16.6.2, Windows 10 env. I cannot even create a python console project from scratch! grafik grafik

I have the same error from one of the last updates. Did you figure out a solution? Reinstall python for VS seems to not solve the problem

judej commented 3 years ago

@MihaiHoriaPopescu, there was a fix in this area that should have fixed this problem. Are you still seeing this?

MihaiHoriaPopescu commented 3 years ago

@MihaiHoriaPopescu, there was a fix in this area that should have fixed this problem. Are you still seeing this?

I dont remember how, but I was able to solve the problem, thanks.

ghpqans commented 3 years ago

I still have the problem using Community Edition. However, from my company i got pro license so i was able to workaround the problem this way. Still, the problem exist.