Python Forum
RuntimeError: This event loop is already running
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RuntimeError: This event loop is already running
#1
Hello everyone,

I have just installed Anaconda 5.3.1 on Windows 10 selecting Python 3.7 version, I use Spyder (python 3.6) and I want to run the module VPython:

http://vpython.org/

This is the code I want to execute:

import vpython as visual
from visual.graph import *                                    # Import Visual

graph1 = gdisplay(width=500,height=300)
Plot1 =  gcurve(color=color.white)                            # gcurve method
graph2 = gdisplay(x=500,width=600,height=450, title="Visual plot", xtitle='x',
        ytitle='f(x)', foreground=color.black, background=color.white)
Plot2 = gdots(color=color.green)

for x in arange(0,8.1,0.1):     Plot1.plot(pos=(x,5*cos(2*x)*exp(-0.4*x)))         

Plot2 = gdots(color=color.green)

for x in arange(-5,5.0,0.1):    Plot2.plot(pos=(x,cos(x)))
And this is what happens:

-A navigator (Chrome or Explorer) is opened and tries to enter the url http://localhost:58627/ but the navigator is empty I cannot see anything.

-On the kernel of Spyder I get these messages:

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.4.0 -- An enhanced Interactive Python.

Reiniciando el nĂșcleo...




In [1]: runfile('C:/Users/Santi/.spyder-py3/temp.py', wdir='C:/Users/Santi/.spyder-py3')
Traceback (most recent call last):

File "<ipython-input-1-236c810b3032>", line 1, in <module>
runfile('C:/Users/Santi/.spyder-py3/temp.py', wdir='C:/Users/Santi/.spyder-py3')

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Santi/.spyder-py3/temp.py", line 3, in <module>
import vpython as visual

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\vpython\__init__.py", line 40, in <module>
from .no_notebook import *

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\vpython\no_notebook.py", line 186, in <module>
__interact_loop.run_until_complete(__coro)

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\asyncio\base_events.py", line 455, in run_until_complete
self.run_forever()

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\asyncio\base_events.py", line 409, in run_forever
raise RuntimeError('This event loop is already running')

RuntimeError: This event loop is already running


In [2]:

In [2]:




---------------------------------------
I think VPython is properly installed and imported because I don't get "no visual package found" but Why do I get this loop error?

Thanks for your time!
Reply
#2
any ideas?
Reply
#3
Hello

I have the same issue. Did you fix it?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  help RuntimeError: no running event loop marpaslight 5 3,729 Oct-18-2022, 10:04 PM
Last Post: marpaslight
  A question about 'Event loop is closed' fc5igm 2 2,206 Oct-05-2021, 02:00 AM
Last Post: fc5igm
  bleak library RuntimeError: This event loop is already running alice93 3 4,093 Sep-30-2021, 08:06 AM
Last Post: alice93
  loop running indefinitely shantanu97 6 2,576 Sep-29-2021, 08:03 PM
Last Post: deanhystad
  Running A Loop Until You See A Particular Result knight2000 6 31,693 Sep-04-2021, 08:55 AM
Last Post: knight2000
  Running loop at specific frequency mdsousa 3 5,929 Apr-21-2021, 11:22 AM
Last Post: jefsummers
  RuntimeError: generator raised StopIteration quest 1 5,808 Mar-28-2021, 08:11 PM
Last Post: quest
  RuntimeError: Optimal parameters not found: Number of calls to function has reached m bntayfur 0 6,149 Aug-05-2020, 04:41 PM
Last Post: bntayfur
  Running function from parent module which has a loop in it. ta2909i 1 2,687 Nov-18-2019, 07:04 PM
Last Post: Gribouillis
  RuntimeError: can't open file Hadad 2 5,349 Aug-27-2019, 04:23 PM
Last Post: Hadad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020