Issues with notebook execution on OSX (too many open files)
See original GitHub issueEdit: this is the upstream issue jupyter/nbclient#58 The current quick fix is to downgrade to nbclient v0.2
Describe the bug
A book I’ve successfully built many times started failing to build in the past few days without my changing the source files.
To Reproduce
Steps to reproduce the behavior:
- Clone the book from this repo.
- Install the latest jupyter-book from
pip install jupyter-book
. - Run
jupyter-book build .
- See error below.
File "/anaconda3/lib/python3.7/selectors.py", line 511, in __init__
OSError: [Errno 24] Too many open files
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/site-packages/jupyter_book/sphinx.py", line 224, in build_sphinx
File "/anaconda3/lib/python3.7/site-packages/sphinx/application.py", line 349, in build
File "/anaconda3/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 299, in build_update
File "/anaconda3/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 311, in build
File "/anaconda3/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 418, in read
File "/anaconda3/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 439, in _read_serial
File "/anaconda3/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 479, in read_doc
File "/anaconda3/lib/python3.7/site-packages/sphinx/io.py", line 316, in read_doc
File "/anaconda3/lib/python3.7/site-packages/docutils/core.py", line 217, in publish
File "/anaconda3/lib/python3.7/site-packages/sphinx/io.py", line 130, in read
File "/anaconda3/lib/python3.7/site-packages/docutils/readers/__init__.py", line 77, in parse
File "/anaconda3/lib/python3.7/site-packages/myst_nb/parser.py", line 65, in parse
File "/anaconda3/lib/python3.7/site-packages/myst_nb/cache.py", line 147, in add_notebook_outputs
File "/anaconda3/lib/python3.7/site-packages/nbclient/client.py", line 878, in execute
File "/anaconda3/lib/python3.7/site-packages/nbclient/util.py", line 37, in wrapped
File "/anaconda3/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
File "/anaconda3/lib/python3.7/site-packages/nbclient/client.py", line 474, in async_execute
File "/anaconda3/lib/python3.7/site-packages/async_generator/_util.py", line 34, in __aenter__
File "/anaconda3/lib/python3.7/site-packages/nbclient/client.py", line 443, in async_setup_kernel
File "/anaconda3/lib/python3.7/site-packages/nbclient/client.py", line 396, in async_start_new_kernel_client
File "/anaconda3/lib/python3.7/site-packages/jupyter_client/client.py", line 116, in start_channels
File "/anaconda3/lib/python3.7/site-packages/jupyter_client/asynchronous/client.py", line 97, in hb_channel
File "/anaconda3/lib/python3.7/asyncio/events.py", line 762, in new_event_loop
File "/anaconda3/lib/python3.7/asyncio/events.py", line 660, in new_event_loop
File "/anaconda3/lib/python3.7/asyncio/unix_events.py", line 51, in __init__
File "/anaconda3/lib/python3.7/asyncio/selector_events.py", line 52, in __init__
File "/anaconda3/lib/python3.7/selectors.py", line 511, in __init__
OSError: [Errno 24] Too many open files
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/bin/jupyter-book", line 8, in <module>
File "/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in __call__
File "/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
File "/anaconda3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
File "/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
File "/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
File "/anaconda3/lib/python3.7/site-packages/jupyter_book/commands/__init__.py", line 123, in build
File "/anaconda3/lib/python3.7/site-packages/jupyter_book/sphinx.py", line 256, in build_sphinx
File "/anaconda3/lib/python3.7/site-packages/sphinx/cmd/build.py", line 69, in handle_exception
File "/anaconda3/lib/python3.7/site-packages/sphinx/util/__init__.py", line 255, in save_traceback
File "/anaconda3/lib/python3.7/tempfile.py", line 340, in mkstemp
File "/anaconda3/lib/python3.7/tempfile.py", line 258, in _mkstemp_inner
OSError: [Errno 24] Too many open files: '/var/folders/v3/8cncpb5d6wq_lmm7rg479mhc0000gq/T/sphinx-err-qng1i2ob.log'
Exception ignored in: <function BaseEventLoop.__del__ at 0x1063f48c8>
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/asyncio/base_events.py", line 625, in __del__
File "/anaconda3/lib/python3.7/asyncio/unix_events.py", line 55, in close
File "/anaconda3/lib/python3.7/asyncio/selector_events.py", line 86, in close
File "/anaconda3/lib/python3.7/asyncio/selector_events.py", line 93, in _close_self_pipe
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_ssock'
Expected behavior
Same successful building I’d had up until this point.
I’m very confused about why this began, because:
- I can verify with git that none of my book’s source files has changed since the last successful build.
- I uninstalled jupyter-book and reinstalled this morning, trying to test if #783 had been fixed, but then this happened.
- I ran
pip uninstall jupyter-book
andpip install jupyer-book==0.7.3
to see if reverting could fix it, but alas, no. - I tried
pip uninstall
forjupyter-book
,sphinx-book-theme
,myst-nb
,myst-parser
, andjupyter-cache
, then reinstalljupyter-book
and still the same problem.
Environment
- Python Version 3.7.3
- Package versions or output of
jupyter-book --version
:
Jupyter Book: 0.7.4 (problem also occurs with 0.7.3, as mentioned above)
MyST-NB: 0.8.1
Sphinx Book Theme: 0.0.35
MyST-Parser: 0.8.1
Jupyter-Cache: 0.2.1
- Operating System: OS X 10.14.6
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Too many open files error on Mac OS: ulim… - Apple Community
A simple fix for the "too many files open" limitation of Mac OS is to use the "ulimit - n" command. Curiously, the...
Read more >Gotcha: Emacs on Mac OS: Too Many Files Open - Ben's Journal
I'd attempt to close buffers or shut down projectile projects, but there was nothing I could reliably do to recover from this error....
Read more >Too many open files error on macOS - Tech Notes
We're going to increase an ulimit setting on macOS, but first let's obtain the current limit of file descriptors via ulimit -n.
Read more >How to Solve the “Too Many Open Files” Error on Linux
If you've ever seen the “Too many files open” error message in a terminal window or found it in your system logs, it...
Read more >IOError: [Errno 24] Too many open files - python - Stack Overflow
"Too many open files" errors are always tricky – you not only have to twiddle with ulimit , but you also have to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wow, fast reply, thanks! I did
pip install -I nbclient==0.2.0
and got a successful build again. Awesome!no worries