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

Help: Note about asyncio errors and workaround for Jupyter #646

Merged
merged 3 commits into from
Feb 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/basics/101-135-help.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,41 @@ If one does not have an SSH key configured for the required service (e.g., GitHu

If you encounter these errors, make sure to create and/or upload an SSH key (see section :ref:`Gin` for an example) as necessary, or reconfigure/edit the URL into a HTTPS URL.


asyncio errors at DataLad import
""""""""""""""""""""""""""""""""

DataLad's internal command runner uses `asyncio
<https://docs.python.org/3/library/asyncio.html>`_. This can lead to
an error when DataLad is used within a script or application that
itself uses asyncio. To summarize the problem with a `quote from
Python's bug tracker <https://bugs.python.org/issue33523#msg349561>`_:
"you can't call async code from sync code that's being called from
async code".

Jupyter Notebooks are probably the most likely place that you'll run
into this error (`ipykernel issue 548
<https://github.com/ipython/ipykernel/issues/548>`_). When importing
``datalad``, you'll see this:

.. code-block:: bash

RuntimeError: Cannot run the event loop while another loop is running

The `nest-asyncio <https://pypi.org/project/nest-asyncio/>`_ package
provides a workaround:

.. code-block:: bash

>>> import nest_asyncio
>>> nest_asyncio.apply()

>>> import datalad





.. todo::

paste some "please make these remotes available output"
Expand All @@ -424,4 +459,4 @@ If you encounter these errors, make sure to create and/or upload an SSH key (see
"Wow, that's fantastic!", "What's this for?", "What to fix", "What the FAQ",
"Where's the fire?", "Wipe the floor", "Welcome to fun",
"Waste Treatment Facility", "What's this foolishness", "What the fruitcake", ...
Pick a translation of your choice and make running this command more joyful.
Pick a translation of your choice and make running this command more joyful.