Closed baumga34 closed 6 years ago
I am not using conda or anaconda.
I really don't know what happens in this case, sorry. We'll try to take a look at it in the future, but I can't make promises.
In the meantime, you can update IPython, tornado, jupyter_client and pyzmq to see if that solves this problem.
I'm having this same issue. Simply opening Spyder (latest version) spawns multiple Python 3.6 processes for me. Was not an issue until today, when I updated conda and it's packages (--all). Code itself works fine if executed from Mac Terminal command line.
I think this happens because IPython and/or ipykernel doesn't have support for the asyncio event loop:
https://github.com/ipython/ipykernel/pull/323
So I think it's not something we can fix in Spyder.
Hmm. It worked with IPython 5.3.0 just fine.
Disregard the comment about spawning python processes. It appears this is a feature of code-completion features in the Editor (as per your own answer on StackOverflow I just came across).
Neverthless, why would it work with a previous version?
This worked for me "Can't invoke asyncio event_loop after tornado 5.0 update". Idk why, maybe just lucky.
I am trying to learn how to use asyncio for asynchronous data acquisition. I found some example code from a tutorial:
I found that loop.close() did not ever run. A print command after loop.run_until_complete did not print. Lastly loop.stop() results in "Kernel died, restarting"
Hi Lucas,
If you're using asynchronous functionality, I would suggest using another IDE. I have switched to Pycharm and have had no issues since. You will not currently be able to use Spyder with asynchronous functions.
Ryan
On Tue, Aug 28, 2018, 5:56 PM lucasgriff88 notifications@github.com wrote:
I am trying to learn how to use asyncio for asynchronous data acquisition. I found some example code from a tutorial: [image: 180828_spyder_error] https://user-images.githubusercontent.com/17008269/44734788-59103300-aab0-11e8-8239-985ef31a0780.PNG
I found that loop.close() did not ever run. A print command after loop.run_until_complete did not print. Lastly loop.stop() results in "Kernel died, restarting"
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/7096#issuecomment-416639765, or mute the thread https://github.com/notifications/unsubscribe-auth/AIopJUw28cmIo_5jyvW6Ga5cmohEMHalks5uVWgYgaJpZM4T5Eo- .
This should be fixed now with the latest IPython and ipykernel versions.
I got the issue resolved by using the nest_async
pip install nest_asyncio
and adding below lines in my file.
import nest_asyncio
nest_asyncio.apply()
Any updates? This simple script is still giving an error using Spyder:
import asyncio
async def main():
print(1)
asyncio.run(main())
Use nest_asyncio
, as mentioned above by @RajshekarReddy.
Is that considered a permanent solution or a quick fix?
The solution is to not use spyder. The code works in pycharm, which is what I've switched to.
On Thu, Aug 1, 2019, 4:59 AM EEflow notifications@github.com wrote:
Is that considered a permanent solution or a quick fix?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder/issues/7096?email_source=notifications&email_token=ACFCSJLQISX2DP4WJXX7ROLQCKXYJA5CNFSM4E7EJI7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3KBSGQ#issuecomment-517216538, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFCSJONXWHBHNMZT36Z7SLQCKXYJANCNFSM4E7EJI7A .
@EEflow, you're welcome to submit a PR to spyder-kernels to add support for nest_asyncio
, which would be similar to what we did for wurlitzer
in https://github.com/spyder-ide/spyder-kernels/pull/54. For now, the workaround is to activate net_asyncio
manually.
@baumga34, your comments are simply not constructive (you already did it once, so I don't understand why you're repeating it again). If you don't have anything substantial to add about Spyder, please refrain from doing the same kind of comments in the future.
***Edit: I'm sorry, I got here from a google search and assumed it was for the asyncio package. I now realize it is for spyder so I'm definitely in the wrong place. Please ignore the rest of my message. I'll leave it below the line for completeness of records.
import nest_asyncio
nest_asyncio.apply()
The above code seems to solve most problems but it still crashes the python kernel when I call
loop.stop()
from within Jupyter Notebooks. Presumably because of the same underlying reason as it does for Spyder.
Does anyone have any thoughts, solutions or workarounds?
Thanks in advance.
p.s. please let me know if this isn't the right place for this comment, I'm relatively new here.
This is still not fixed (aiohttp 3.7.4 + python 3.8.8)
Any fix for this problem??
Problem Description
https://stackoverflow.com/questions/50243393/runtimeerror-this-event-loop-is-already-running-debugging-aiohttp-asyncio-a From the above link I'm struggling to understand why I am getting the "RuntimeError: This event loop is already running" runtime error. I have tried to run snippets of code from "https://aiohttp.readthedocs.io/en/stable/" however, I keep getting the same issue.
What steps reproduce the problem?
1. Run the following code in Spyder IDE
Results: RuntimeError: This event loop is already running {"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"} Expected Results: {"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"} ['{"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"}']
2. Run the code from above with cmd.exe
Results: {"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"} ['{"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"}']
3. The above results match what I expect.
What is the expected output? What do you see instead?
Expected Results: {"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"} ['{"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"}'] Results: RuntimeError: This event loop is already running {"ask_price":"14.9000","ask_size":100,"bid_price":"14.0100","bid_size":100,"last_trade_price":"14.7900","last_extended_hours_trade_price":"14.7900","previous_close":"14.3600","adjusted_previous_close":"14.3600","previous_close_date":"2018-05-07","symbol":"SURF","trading_halted":false,"has_traded":true,"last_trade_price_source":"consolidated","updated_at":"2018-05-08T20:01:21Z","instrument":"https://api.robinhood.com/instruments/43d56335-f2f6-4711-b650-55be2396f814/"}
Paste Traceback/Error Below (if applicable)
Versions
#
Dependencies