Incompatible with jupyter
See original GitHub issueimport httpx
httpx.get('https://httpbin.org/get')
When run from Jupyter this snippet produces “Cannot run the event loop while another loop is running” error. Works fine in REPL. Apparently the use of asyncio conflicts with Jupters’s own event loop.
httpx version: 0.7.6 os: Fedora 29 python: Python 3.6.9 ipykernel: 5.1.2 ipython: 7.8.0 jupyter: 5.4.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
incompatibility - All jupyter contrib nbextensions are marked ...
All extensions are marked as "possibly incompatible". A solution is to uncheck the option: "disable configuration for nbextensions without ...
Read more >All extensions are shown as incompatible · Issue #103 - GitHub
I'm using latest version of Anaconda 3 (python 3.7.1), and followed setup steps for jupyter nbextensions and nbextensions_configurator.
Read more >Working on Windows - Jupyter Book
Jupyter Book is now also tested against a Windows environment on Python 3.7 ... However, there is a known incompatibility for notebook execution, ......
Read more >Can't install scala kernel for jupyter notebook (toree)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the ......
Read more >Installing IPython — IPython 8.7.0 documentation
Make sure you have the latest version of pip (the Python package manager) installed. If you do not, head to Pip documentation and...
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
@tomchristie said that he liked that we learned from each other, so I’d like to explain my point above in more detail to explain why it’s actually relevant! It’s not actually the code generation approach that’s important here, but the fact that we’re using the standard library for I/O in the sync case, and not asyncio.
You can keep the async/await annotations and just rely on the fact that all calls will be secretly sync, and wrap the sync API with
run_secretly_sync_async_fn
(stolen from https://github.com/python-trio/urllib3/issues/1#issuecomment-322028457):The reason we’re not doing this in our urllib3 work is because 1/ we want to support Python 2.7 and 2/ wrapping a large public API with
run_secretly_sync_async_fn
is actually cumbersome, and adds an unrelated function to the call stack.But it avoids both code generation and an hidden asyncio loop!
For what it’s worth, this is one advantage of the code generation approach we use in the urllib3 fork: our sync code is really sync and only uses the standard library for the actual I/O. 99% of the code is shared, only the calls to the specific I/O libraries are different.