cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Python Debugger won't stop

carl24k
New Contributor II

I'm trying to use the debugger on python scripts that I'm running in my databricks workspace. The first few times i used it, it worked and stopped at my breakpoints. Since then, it just won't stop. I'm sure they are valid lines for breakpoints, but it just won't stop. Is there any trick to getting the debugger to work?

Thanks!

Carl

5 REPLIES 5

TheOC
Contributor

Are you able to share any of the detail of the code you are running (and where you are applying breakpoints)?

Cheers,
TheOC

nayan_wylde
Honored Contributor

Here are the list of things you can try.

1. Restart your Python kernel.

2. Re-enable the Debugger Feature

Go to your username (upper-right) โ†’ Settings โ†’ Developer โ†’ Toggle "Python Notebook Interactive Debugger" off and back on

3. Restart cluster.

4. Confirm that your notebook is attached to a compatible cluster. The debugger requires a cluster with:

โ€ข  Databricks Runtime 13.3 LTS or above.

โ€ข  Access mode set to Dedicated (Single User) or No Isolation Shared. Shared access mode clusters are not supported for debugging.

5. You can also try alternate debugger like pdb.

import pdb

def my_function():
    x = 10
    pdb.set_trace()  # This will always stop
    y = x * 2
    return y

my_function()

 

carl24k
New Contributor II

Thanks for the tips! This is a new cluster with DB rutime 16.4 LTS, access mode is "Dedicated". I have stopped and restarted the cluster several times and the same behavior persists. Does restarting the cluster not restart the Python kernel? If not then I need to figure out restarting the kernel. I also tried turning off and back on the debugger feature. It still won't stop at a breakpoint.

Does this really work for other people??? Or is the script debugger in the workspace a beta feature?

I appreciate the pdb suggestion, but I'm more likely to start doing my development locally in an full IDE with a real debugger that works (even though that would enatil setting up Spark locally which will take some effort) 

nayan_wylde
Honored Contributor

Agree local development is always good. I have been using databricks connect lately. I like this a lot.

https://docs.databricks.com/aws/en/dev-tools/databricks-connect/python/

szymon_dybczak
Esteemed Contributor III

Hi @carl24k ,

Do you try to debug code from external files or modules? Is it possible to share with us a code that you try to debug?

 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now