user3761555
user3761555

Reputation: 1275

Debug python Visual Studio Startup very slow - load module

When start debug from Visual Studio, it takes like 2 minutes to hit the first line of python code. Apparently Visual Studio is busy loading python modules.

python.exe' (Win32): Loaded 'C:\ProgramData\Anaconda3\python.exe'. Symbols loaded.

'python.exe' (Win32): Loaded 'xxxxx'. Cannot find or open the PDB file. ... many more ...

I tried below, no joy:

  1. Tools \ Options \ Debugging

    a) Enable Just My Code checked

    b) Just-In-Time Debugging - only selected Managed and Script

    c) Symbols

    • unchecked "Microsoft Symbol Servers"
    • "Load all modules, unless excluded" or "Load only specified modules" (tried both)

https://devblogs.microsoft.com/devops/make-debugging-faster-with-visual-studio/

  1. Reinstall Visual Studio (I tried both Community Edition, Standard Edition)
  2. Reboot my machine three times
  3. Delete all breakpoints
  4. Disable Resharper

Two more observations:

  1. I never had this issue prior to today

  2. Python Interactive Debugger stopped working today - it refuse to print anything!

    myDataFrame.head()

    print("hello")

Upvotes: 5

Views: 1780

Answers (3)

Joma
Joma

Reputation: 2409

To disable "Enable native code debugging" in the solution properties helped for me.

Upvotes: 0

bathMarm0t
bathMarm0t

Reputation: 423

Just in case anyone else is looking around,

I also had horrendous debug times (2+ minutes to get to the first line of code).

I was using an Anaconda deployment for numpy/scipy along with pybind11 to interface/debug C code.

I fixed my debug times by using a vanilla deployment of python (3.9.1) and installing the minimal requirements using pip. I believe it was taking so long because visual studio is searching for debug symbols that do not exist. Anaconda does not provide symbol libraries (nor will they according to their forums)

Debug times are now as fast as normal run times (<1s) and I'm no longer dreading hitting the little bug button.

Upvotes: 0

user3761555
user3761555

Reputation: 1275

Fixed!! I deleted my Visual Studio solution and project file. Create the python project brand new, all fixed!

Upvotes: 2

Related Questions