spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.25k stars 1.6k forks source link

Interrupting Kernel button not working #20084

Open uelmann opened 1 year ago

uelmann commented 1 year ago

Description

What steps will reproduce the problem?

Hello, with the update i am not able to interrupt the kernel anylonger, neither wiht red button not with menu dropdown selection. WHY? I am not using jupyter but direct installation of spyder in a pipenv

many thanks

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0                 :  1.4.1 (OK)
chardet >=2.0.0                      :  5.0.0 (OK)
cloudpickle >=0.5.0                  :  2.2.0 (OK)
cookiecutter >=1.6.0                 :  2.1.1 (OK)
diff_match_patch >=20181111          :  20200713 (OK)
intervaltree >=3.0.2                 :  3.1.0 (OK)
IPython >=7.31.1;<8.0.0              :  7.34.0 (OK)
jedi >=0.17.2;<0.19.0                :  0.18.1 (OK)
jellyfish >=0.7                      :  0.9.0 (OK)
jsonschema >=3.2.0                   :  4.17.0 (OK)
keyring >=17.0.0                     :  23.9.3 (OK)
nbconvert >=4.0                      :  7.2.3 (OK)
numpydoc >=0.6.0                     :  1.5.0 (OK)
parso >=0.7.0;<0.9.0                 :  0.8.3 (OK)
pexpect >=4.4.0                      :  4.8.0 (OK)
pickleshare >=0.4                    :  0.7.5 (OK)
psutil >=5.3                         :  5.9.3 (OK)
pygments >=2.0                       :  2.13.0 (OK)
pylint >=2.5.0;<3.0                  :  2.15.5 (OK)
pylint_venv >=2.1.1                  :  None (OK)
pyls_spyder >=0.4.0                  :  0.4.0 (OK)
pylsp >=1.6.0;<1.7.0                 :  1.6.0 (OK)
pylsp_black >=1.2.0                  :  1.2.1 (OK)
qdarkstyle >=3.0.2;<3.1.0            :  3.0.3 (OK)
qstylizer >=0.2.2                    :  0.2.2 (OK)
qtawesome >=1.2.1                    :  1.2.1 (OK)
qtconsole >=5.4.0;<5.5.0             :  5.4.0 (OK)
qtpy >=2.1.0                         :  2.2.1 (OK)
rtree >=0.9.7                        :  1.0.1 (OK)
setuptools >=49.6.0                  :  65.5.1 (OK)
sphinx >=0.6.6                       :  5.1.1 (OK)
spyder_kernels >=2.4.0;<2.5.0        :  2.4.0 (OK)
textdistance >=4.2.0                 :  4.5.0 (OK)
three_merge >=0.1.1                  :  0.1.1 (OK)
watchdog >=0.10.3                    :  2.1.9 (OK)
zmq >=22.1.0                         :  24.0.1 (OK)

# Optional:
cython >=0.21                        :  0.29.32 (OK)
matplotlib >=3.0.0                   :  3.6.2 (OK)
numpy >=1.7                          :  1.22.4 (OK)
pandas >=1.1.1                       :  1.5.1 (OK)
scipy >=0.17.0                       :  1.9.3 (OK)
sympy >=0.7.3                        :  1.11.1 (OK)

# Spyder plugins:
spyder_terminal.terminalplugin 1.2.2 :  1.2.2 (OK)
ccordoba12 commented 1 year ago

Hey @uelmann, thanks for reporting. Could you post an animated gif video of what you're observing in Spyder? That will help us to better understand your problem.

You can easily create animated gifs with the Licecap program.

uelmann commented 1 year ago

Attachment available until 20 Dec 2022 Hello

Thank you for the reply !

I am attaching a screen recording here. Since I posted the issue, I noticed this happens only once I set up a ray remote instance. In the video you can see that if I ran a loop and press the red button, the loop will stop. But once I active a ray instance, I can no longer stop a loop, even though I tun ray.shutdown()

Any reason why this happens?

Many thanks !

On 19 Nov 2022, at 17:56, Carlos Cordoba @. @.>> wrote:

Hey @uelmann https://github.com/uelmann, thanks for reporting. Could you post an animated gif video of what you're observing in Spyder? That will help us to better understand your problem.

You can easily create animated gifs with the Licecap https://www.cockos.com/licecap/ program.

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/20084#issuecomment-1320924138, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33GDRNHXSEGTHXZNETAVADWJEBEFANCNFSM6AAAAAASEOEYLA. You are receiving this because you were mentioned.

Click to Download https://www.icloud.com/attachment/?u=https%3A%2F%2Fcvws.icloud-content.com%2FB%2FAZVtjXmD4WMopYhSeuRpFhvCbmewAU6HCxcToCP_P30hDWLmOTwIAjBO%2F%24%7Bf%7D%3Fo%3DAmgXhzWFy7bbcjD3NLmGTkY1Aoem99N3oYFQrBAULp1n%26v%3D1%26x%3D3%26a%3DCAogqpjaV5hh9yOZy4VM6_j9W-M16Xs9zX2Q_siWZznCZ_8SeBDB2Lu0yTAYwei2iNMwIgEAKgkC6AMA_0ioZPZSBMJuZ7BaBAgCME5qJqN_zIqUSkfvhRBCaWaITKFKsINHaM0c6Y5gy4m8P9U00JxQE975ciaoW_CD6DxW4PNE-_kkwx-tukpaUxnd28dcmMpLZq6E4TtV1GBLNw%26e%3D1671565259%26fl%3D%26r%3D109119B0-B58C-4584-98D3-C7DC3482C25D-1%26k%3D%24%7Buk%7D%26ckc%3Dcom.apple.largeattachment%26ckz%3D28DBCCFF-A052-4C58-AD41-E2A1FB2A4F24%26p%3D113%26s%3Dzvco9RC2ZH6rHwIeHiNm3JjU3qM&uk=R3MQtUUqy9c84qDTAGX6vw&f=Screen%20Recording%202022-11-20%20at%2020.37.20.mov&sz=26764943Screen Recording 2022-11-20 at 20.37.20.mov 26.8 MB

ccordoba12 commented 1 year ago

You can't attach videos nor images via email. Instead, you need to drag and drop the file directly here.

uelmann commented 1 year ago

https://user-images.githubusercontent.com/116810181/203003744-e26acb20-f2b5-4412-945d-fc3e70fd3941.mov

ccordoba12 commented 1 year ago

Thanks @uelmann! According to your video, this seems to be caused by the Ray code you're running between the first evaluation of the for loop and the second one.

Could you upload now a simple code that uses Ray and generates the same problem?

uelmann commented 1 year ago

Thanks Carlos.

Yes indeed it’s the ray script that bugs the Spyder kernel.

I run the following code:

ray.init() @ray.remote def f(r): return minimise_fun(df[:,r])

def parmap(f, list):
    return [f.remote(x) for x in list]

result_ids = parmap(f, np.arange(0,df.shape[0]))
scores = ray.get(result_ids)
ray.shutdown()

What the code does, is simply applying a function iteratively on each column of a df, as if it was a parallelised version of map.

Any idea why ray bugs the Kernel in Spyder?

Many thanks

On 21 Nov 2022, at 18:06, Carlos Cordoba @.***> wrote:

Thanks @uelmann https://github.com/uelmann! According to your vide, this seems to be caused by the Ray code you're running between the first evaluation of the for loop and the second one.

Could you upload now a simple code that uses Ray and generates the same error?

— Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/20084#issuecomment-1322380943, or unsubscribe https://github.com/notifications/unsubscribe-auth/A33GDRMNKQ36HO3NZVZLN5DWJOTXTANCNFSM6AAAAAASEOEYLA. You are receiving this because you were mentioned.

ccordoba12 commented 1 year ago

Any idea why ray bugs the Kernel in Spyder?

I really don't know, but could you execute the same code in a Jupyter notebook to check what happens there?

The thing is we use the same architecture to run code as Jupyter, so I'm curious to know what happens there.