New user cannot get program to run after install

232 views
Skip to first unread message

Brian Riendeau

unread,
May 4, 2022, 3:43:35 PM5/4/22
to VPython-users
Hello, I am running on a windows machine and have followed the installation instructions,
however when I try to run a simple program, either with the box() empty or with arguments, 
I get this error.

Please assist. I am new to programming and haven't found any info on this matter.
vpy.png

Brian Riendeau

unread,
May 4, 2022, 3:44:32 PM5/4/22
to VPython-users
I should mention that I tried already running  .use_twisted() or .use_asyncio() inside the program but that didn't work.

Bruce Sherwood

unread,
May 7, 2022, 1:20:43 AM5/7/22
to VPython-users
This is very strange. What do you see if you simply enter "python" in the terminal?

If you are brand new to programming, I'll point out that you will not have any installation problems if you use Web VPython rather than working with installing Python and VPython. Take a look at webvpython.org (or equivalently glowscript.org). You may also find this tutorial useful: 

https://trinket.io/matter-interactions/courses/00_welcome_to_vpython#/welcome-to-vpython/getting-started

Ali Sheikholeslam

unread,
May 10, 2022, 6:02:31 PM5/10/22
to VPython-users
I have faced to such error:


Traceback (most recent call last):
  File "C:/Users/Ali/Desktop/disperse - Copy - Copy.py", line 198, in <module>
    vp.button(text="Pause", pos=scene.title_anchor, bind=Run)
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\vpython\vpython.py", line 3535, in __init__
    super(button, self).setup(args)
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\vpython\vpython.py", line 3443, in setup
    super(controls, self).__init__()  ## get idx, attrsupdt from baseObj
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\vpython\vpython.py", line 241, in __init__
    from .no_notebook import _
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\vpython\no_notebook.py", line 12, in <module>
    from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\asyncio\__init__.py", line 32, in <module>
    from autobahn.asyncio.websocket import \
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\asyncio\websocket.py", line 36, in <module>
    from autobahn.wamp import websocket
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\wamp\websocket.py", line 32, in <module>
    from autobahn.websocket import protocol
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\websocket\protocol.py", line 2533, in <module>
    class WebSocketServerProtocol(WebSocketProtocol):
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\websocket\protocol.py", line 2538, in WebSocketServerProtocol
    log = txaio.make_logger()
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\txaio\_unframework.py", line 41, in _throw_usage_error
    raise RuntimeError(
RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()
Exception ignored in: <function baseObj.__del__ at 0x000001F72B7B2CA0>
Traceback (most recent call last):
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\vpython\vpython.py", line 322, in __del__
    cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'button' object has no attribute 'idx'



So, I do:

import txaio
txaio.use_twisted()


that get the following error:

ModuleNotFoundError: No module named 'twisted.python'


Then I installed twisted  library, and by importing txaio and txaio.use_twisted() it ran and connected to the chrome browser and shows the created items but didn't play animation with sucking again by the following error:


Exception in callback WebSocketAdapterProtocol.connection_made(<_ProactorSoc...sport fd=2932>)
handle: <Handle WebSocketAdapterProtocol.connection_made(<_ProactorSoc...sport fd=2932>)>
Traceback (most recent call last):
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\asyncio\websocket.py", line 86, in connection_made
    self._connectionMade()
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\websocket\protocol.py", line 2578, in _connectionMade
    WebSocketProtocol._connectionMade(self)
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\autobahn\websocket\protocol.py", line 1110, in _connectionMade
    self.openHandshakeTimeoutCall = self.factory._batched_timer.call_later(
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\txaio\_common.py", line 83, in call_later
    now = self._get_seconds()
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\txaio\tx.py", line 390, in get_seconds
    return self._get_loop().seconds()
AttributeError: 'ProactorEventLoop' object has no attribute 'seconds'


I have updated the conda, but no success. I think this problem happened after updating SciPy --> some dependencies updated by that.

Ali Sheikholeslam

unread,
May 10, 2022, 6:12:45 PM5/10/22
to VPython-users
It must mentioned that I guess it is related to SciPy updating, not sure (I saw somewhere it may be related to autobahn version).

I tried to uninstall VPython to reinstall it hoping solve the issue. During uninstalling anaconda prompt shows something as follows that I don't know if it completely uninstall it:


The following packages will be REMOVED:

  aiohttp-3.8.1-py38h294d835_1
  aiosignal-1.2.0-pyhd8ed1ab_0
  anyio-3.5.0-py38haa244fe_0
  argon2-cffi-21.3.0-pyhd8ed1ab_0
  argon2-cffi-bindings-21.2.0-py38h294d835_2
  async-timeout-4.0.2-pyhd8ed1ab_0
  autobahn-22.4.1-pyhd8ed1ab_0
  beautifulsoup4-4.11.1-pyha770c72_0
  bleach-5.0.0-pyhd8ed1ab_0
  debugpy-1.6.0-py38h885f38d_0
  defusedxml-0.7.1-pyhd8ed1ab_0
  entrypoints-0.4-pyhd8ed1ab_0
  flit-core-3.7.1-pyhd8ed1ab_0
  frozenlist-1.3.0-py38h294d835_1
  ipykernel-6.13.0-py38h4317176_0
  ipython_genutils-0.2.0-py_1
  ipywidgets-7.7.0-pyhd8ed1ab_0
  jinja2-3.1.2-pyhd8ed1ab_0
  jsonschema-4.5.1-pyhd8ed1ab_0
  jupyter-1.0.0-py38haa244fe_7
  jupyter-server-proxy-3.2.1-pyhd8ed1ab_0
  jupyter_client-7.3.1-pyhd8ed1ab_0
  jupyter_console-6.4.3-pyhd8ed1ab_0
  jupyter_core-4.9.2-py38haa244fe_0
  jupyter_server-1.17.0-pyhd8ed1ab_0
  jupyterlab_pygments-0.2.2-pyhd8ed1ab_0
  jupyterlab_widgets-1.1.0-pyhd8ed1ab_0
  libsodium-1.0.18-h8d14728_1
  markupsafe-2.1.1-py38h294d835_1
  mistune-0.8.4-py38h294d835_1005
  multidict-6.0.2-py38h294d835_1
  nbclient-0.6.3-pyhd8ed1ab_0
  nbconvert-6.5.0-pyhd8ed1ab_0
  nbconvert-core-6.5.0-pyhd8ed1ab_0
  nbconvert-pandoc-6.5.0-pyhd8ed1ab_0
  nbformat-5.4.0-pyhd8ed1ab_0
  nest-asyncio-1.5.5-pyhd8ed1ab_0
  notebook-6.4.11-pyha770c72_0
  packaging-21.3-pyhd8ed1ab_0
  pandoc-2.18-h57928b3_0
  pandocfilters-1.5.0-pyhd8ed1ab_0
  prometheus_client-0.14.1-pyhd8ed1ab_0
  prompt_toolkit-3.0.29-hd8ed1ab_0
  pyrsistent-0.18.1-py38h294d835_1
  python-fastjsonschema-2.15.3-pyhd8ed1ab_0
  pywinpty-2.0.5-py38hd3f51b4_1
  pyzmq-22.3.0-py38h09162b1_2
  qtconsole-5.3.0-pyhd8ed1ab_0
  qtconsole-base-5.3.0-pyhd8ed1ab_0
  qtpy-2.1.0-pyhd8ed1ab_0
  send2trash-1.8.0-pyhd8ed1ab_0
  simpervisor-0.4-pyhd8ed1ab_0
  sniffio-1.2.0-py38haa244fe_3
  soupsieve-2.3.1-pyhd8ed1ab_0
  terminado-0.13.3-py38haa244fe_1
  tinycss2-1.1.1-pyhd8ed1ab_0
  txaio-21.2.1-pyhd8ed1ab_0
  vpython-7.6.3-py38h294d835_1
  webencodings-0.5.1-py_1
  websocket-client-1.3.2-pyhd8ed1ab_0
  widgetsnbextension-3.6.0-py38haa244fe_0
  winpty-0.4.3-4
  yarl-1.7.2-py38h294d835_2
  zeromq-4.3.4-h0e60522_1


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: \ Uninstalling jupyter-js-widgets jupyter-js-widgets/extension
Removing: C:\Users\Ali\anaconda3\envs\PFC_FiPy\share\jupyter\nbextensions\jupyter-js-widgets
Exception ignored in: <function Application.__del__ at 0x0000023830D81DC0>

Traceback (most recent call last):
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 955, in __del__
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 945, in close_handlers
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 683, in __get__
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 657, in get
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 1428, in _notify_observers
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 273, in _observe_logging_default
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 278, in _configure_logging
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\logging\config.py", line 808, in dictConfig
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\logging\config.py", line 545, in configure
ValueError: Unable to configure formatter 'console'

done



and reinstalling shows:


Executing transaction: | Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: ok
Exception ignored in: <function Application.__del__ at 0x0000019D556E28B0>

Traceback (most recent call last):
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 955, in __del__
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 945, in close_handlers
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 683, in __get__
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 657, in get
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\traitlets.py", line 1428, in _notify_observers
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 273, in _observe_logging_default
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\site-packages\traitlets\config\application.py", line 278, in _configure_logging
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\logging\config.py", line 808, in dictConfig
  File "C:\Users\Ali\anaconda3\envs\PFC_FiPy\lib\logging\config.py", line 545, in configure
ValueError: Unable to configure formatter 'console'

done



Now, it is importing the vpython (I doubt it is uninstalled and reinstalled correctly based on the aforementioned results), but stuck by that I showed in the previous post AttributeError: 'ProactorEventLoop' object has no attribute 'seconds'

Ali Sheikholeslam

unread,
May 10, 2022, 6:15:19 PM5/10/22
to VPython-users

John

unread,
May 11, 2022, 1:08:32 PM5/11/22
to VPython-users
Since you mentioned that you are using Anaconda you could try creating a separate environment and try installing and running vpython in that environment. You can create a new environment in Anaconda from the Anaconda prompt or a terminal window . If you are on windows then launch the Anaconda Prompt program otherwise on Linux or Mac you can run from a terminal and create a custom sandboxed environment with the command.

    conda create -n myenv python=3.8 pip

This creates an environment called myenv and uses python version 3.8. Then once the environment is created you activate it.

    conda activate myenv

Then install vpython in this environment.

    conda install -c conda-forge vpython

After vpython is installed you can try running your vpython program in this environment,

    python myvpythonprogram.py

Or you can try running a vpython program in a jupyter notebook. First launch jupyter notebook. Then open up a jupyter notebook containing a vpython program.

    jupyter notebook

You can also list the python packages in this environment with the command

    conda list

And you can also install any other python package in this environment. e.g. 

    conda install -c conda-forge scipy

You can list the different Anaconda environments on your computer with the command

   conda info -e

and you can exit the environment you are in with the command

    conda deactivate

Try running vpython in its own separate environment to see if you can get it to work in its own sandboxed environment.

John

Ali Sheikholeslam

unread,
May 11, 2022, 2:12:13 PM5/11/22
to VPython-users
Thanks John for your suggestion. I am familiar with creating new env and so on. I aimed to report the problem and point to probable causes. However, if new version of SciPy and its dependencies be incompatible with VPython dependencies, I will have problem again in new envs because my main code use SciPy and other libraries beside VPython. It was working for a long time and stop working some days ago, which again I mention that it will be related to some incompatibilities.

Ali Sheikholeslam

unread,
May 12, 2022, 2:04:29 PM5/12/22
to VPython-users
I have tested it on another env by older SciPy version, but it stuck again. So, I guess it may be related to something changed in the latest version of VPython (which I updated) or to my chrome (which is updated in this week). Is there any other probable cause to check?

John

unread,
May 12, 2022, 4:05:52 PM5/12/22
to VPython-users
This problem was reported in another thread.  Here is my response to that thread.

The fix is to install an older version of autobahn package and txaio. The steps to fix are to uninstall autobahn and txaio

    conda uninstall autobahn
    conda uninstall txaio

or 

    pip uninstall autobahn
    pip uninstall txaio

Then install autobahn version 21.11.1

    pip install autobahn==21.11.1

and this will install txaio version 22.2.1

These were the versions of autobahn and txaio that existed when vpython 7.6.3 came out.

Vpython should probably create a new release to fix this problem or to use older versions of autobahn and txaio as dependencies.

John
Reply all
Reply to author
Forward


Ali Sheikholeslam

unread,
May 12, 2022, 8:03:56 PM5/12/22
to VPython-users
Thanks dear John, It was related to  autobahn version, I would be appreciated if VPython be updated to be compatible by new versions. It seems there are many people facing to this problem. I am forced to use a new environment when I want to test by VPython.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages