Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set close_fds=False when starting kernels on Windows #408

Merged
merged 1 commit into from
Dec 1, 2018

Conversation

minrk
Copy link
Member

@minrk minrk commented Nov 30, 2018

Python 3.7 sets close_fds=True by default, closing the interrupt/parent handles we are trying to pass to the kernel.

We can be more explicit and use the new STARTUPINFO.lpAttributeList (the reason for the change in default behavior) in the future to explicitly inherit only these handles, but this preserves the pre-3.7 behavior on 3.7, getting kernels back to working on py37.

closes ipython/ipykernel#374

cf spyder-ide/spyder#8013

Python 3.7 sets close_fds=True by default,
closing the interrupt/parent handles we are trying to pass to the kernel.
@minrk minrk added this to the 5.3 milestone Nov 30, 2018
@CAM-Gerlach
Copy link

Per @ccordoba12 's request, I tried to test this on Windows but I got a huge chain of exceptions trying to install it locally, starting with AttributeError: _DistInfoDistribution__dep_map and ending with pip._vendor.pkg_resources.RequirementParseError: Parse error at "'; extra '": Expected stringEnd, which occured even after I uninstalled the jupyter_client version in the conda env I was using for testing and updated pip and setuptools to the latest versions.

@minrk
Copy link
Member Author

minrk commented Nov 30, 2018

@CAM-Gerlach that sounds like conda-forge/testpath-feedstock#7 which I believe is fixed in the latest conda package of testpath, so I think conda update testpath should fix it.

@CAM-Gerlach
Copy link

@minrk Thanks! That did indeed resolve the problem (I'd assumed it was just some machine or OS-specific issue with pip), and testing the fix this does indeed resolve the stated problem. Ctrl-C still doesn't properly interrupt execution on Windows under QtConsole (the interrupt only gets handled at the end, after the 10 seconds have elapsed) but it does register properly at least like on Python 3.6.

@minrk
Copy link
Member Author

minrk commented Dec 1, 2018

Yes, not being able to interrupt time.sleep promptly on Windows is a function of how interrupt_main works on Windows, and time.sleep is specifically not interruptible from other threads until control returns to the Python interpreter on that thread. Most realistic code returns to the Python interpreter with a reasonable frequency, so this is less often an issue in reality than when using time.sleep to test.

Thanks for confirming! We should do a release shortly.

@minrk minrk merged commit 1d807c2 into jupyter:master Dec 1, 2018
@minrk minrk deleted the close-fds-windows branch December 1, 2018 20:56
meeseeksmachine pushed a commit to meeseeksmachine/jupyter_client that referenced this pull request Dec 1, 2018
@CAM-Gerlach
Copy link

Thanks @minrk ! I seem to recall reading something to that effect previously and I just chalked it up (like most conda commands taking 10x longer on native Windows than on my Fedora VM running inside of it) to Windows' many limitations.

minrk added a commit that referenced this pull request Dec 4, 2018
…on-5.x

Backport PR #408 on branch 5.x (set close_fds=False when starting kernels on Windows)
@papagala
Copy link

Sorry, I have a basic question. Which file do I have to edit in order to set close_fds=False when starting kernels on Windows?

@CAM-Gerlach
Copy link

@papagala conda install jupyter_client=5.2.4 in your Spyder environment.

alex-dewar added a commit to newaetech/chipwhisperer that referenced this pull request Dec 13, 2018
Jupyter client < 5.2.4 was unable to interrupt on Windows
with Python 3.7+. See jupyter/jupyter_client#408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execution cannot be stopped or interrupted under Python 3.7 on Windows
3 participants