A problem in Spyder in Winpython

155 views
Skip to first unread message

陳韋安

unread,
Aug 20, 2019, 10:58:20 PM8/20/19
to VPython-users
I am using Spyder, which is from WinPython 3.7.4.0-64bit.
When I run the following code:

  from vpython import*
  box()

there is an error showed in console:

  KeyError: 'default/interpreter/dedicated'

but it is fine when I use Jupyter Notebook to run it.

How can I fix this?

The console message:

runfile('D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py', wdir='D:/user/Desktop/WPy64-3740/settings/.spyder-py3')
Traceback (most recent call last):

  File "<ipython-input-1-e68d4507caad>", line 1, in <module>
    runfile('D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py', wdir='D:/user/Desktop/WPy64-3740/settings/.spyder-py3')

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py", line 8, in <module>
    from vpython import*

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\site-packages\vpython\__init__.py", line 57, in <module>
    _warn_if_spyder_settings_wrong()

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\site-packages\vpython\_notebook_helpers.py", line 15, in _warn_if_spyder_settings_wrong
    if not _spyder_run_setting_is_correct():

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\site-packages\vpython\_notebook_helpers.py", line 11, in _spyder_run_setting_is_correct
    return CONF['run']['default/interpreter/dedicated']

  File "D:\user\Desktop\WPy64-3740\python-3.7.4.amd64\lib\configparser.py", line 1251, in __getitem__
    raise KeyError(key)

KeyError: 'default/interpreter/dedicated'

Bruce Sherwood

unread,
Aug 20, 2019, 11:08:50 PM8/20/19
to VPython-users
Please run the following test and report what is printed:

from vpython import *
print(version)

If it is ['7.5.1', 'jupyter'], note that there's something wrong with the not-really-released vpython 7.5.1. Here are updated installation instructions at vpython.org:

We recommend installing the Anaconda Python distribution with Python version 3.5.3 or later.
The 3D animations use WebGL in a browser, which is not supported by Internet Explorer.
All current browsers do support WebGL. See webglreport.com to check this.

The vpython module ("VPython 7") is available using
     "conda install -c vpython vpython" or "pip install vpython". 
TEMPORARY ISSUE: At the moment, these instructions unfortunately install a defective VPython 7.5.1.
If you already have vpython installed, uninstall it (conda uninstall vpython or pip uninstall vpython),
then execute "conda install -c vpython vpython=7.5.0" or "pip install vpython==7.5.0".

To update to later versions of vpython use
     "conda update -c vpython vpython" or "pip install vpython --upgrade".

Using the vpython module outside a Jupyter notebook (Python 3.5.3

Bruce Sherwood

unread,
Aug 20, 2019, 11:09:48 PM8/20/19
to VPython-users
Oops. Delete that last line about "outside a Jupyter notebook", which pertains to other instructions at vpython.org.

Bruce

Message has been deleted

陳韋安

unread,
Aug 20, 2019, 11:52:46 PM8/20/19
to VPython-users
The error message is still the same:
  KeyError: 'default/interpreter/dedicated'

So can not I use Spyder installed in winpython to run vpython?
or can I only use Jupyter notebook(also in winpython) to run?

Bruce Sherwood於 2019年8月21日星期三 UTC+8上午11時08分50秒寫道:

Bruce Sherwood

unread,
Aug 21, 2019, 3:32:33 PM8/21/19
to VPython-users
Could you please run this version check in Jupyter, where you were able to make a display?

from vpython import *
print(version)

Bruce

陳韋安

unread,
Aug 23, 2019, 2:20:43 AM8/23/19
to VPython-users
It displayed the following message:

['7.5.0', 'jupyter']

Bruce Sherwood於 2019年8月22日星期四 UTC+8上午3時32分33秒寫道:

Bruce Sherwood

unread,
Aug 23, 2019, 8:37:23 AM8/23/19
to VPython-users
The reason I asked about the version number is that there were recent problems with installing the vpython module, in that a defective version 7.5.1 was installed. But you have 7.5.0, so that's not the problem.

The only other thing i can think of is to ask how you installed Python and VPython. The method that seems to avoid most problems is to install the Anaconda distribution for Python and to use conda rather than pip to install vpython. How did you install Python? How did you install VPython?

Here are the up to date installation instructions from vpython.org:

陳韋安

unread,
Aug 23, 2019, 9:32:45 AM8/23/19
to VPython-users
For some purposes, the Python I am using now is from WinPython. As for VPython, I install it by the code pip install vpython==7.5.0 in WinPython Command Prompt

Bruce Sherwood於 2019年8月23日星期五 UTC+8下午8時37分23秒寫道:
Message has been deleted

陳韋安

unread,
Aug 23, 2019, 9:59:40 AM8/23/19
to VPython-users
I have downloaded Anaconda distribution, but the same error still happened.
However, everything is nice if I use PyCharm to run VPython, the result successfully showed up.

Bruce Sherwood於 2019年8月23日星期五 UTC+8下午8時37分23秒寫道:

陳韋安

unread,
Aug 26, 2019, 9:54:03 AM8/26/19
to VPython-users
So...is there any solution?

Bruce Sherwood於 2019年8月23日星期五 UTC+8下午8時37分23秒寫道:

Bruce Sherwood

unread,
Aug 26, 2019, 10:23:34 AM8/26/19
to VPython-users
I have no idea. Many users of VPython experience no difficulty using Spyder after following the same installation procedures you followed. I suppose you could try reinstalling or upgrading Spyder. Otherwise, maybe you would have to use PyCharm or (possibly) IDLE.

Bruce

陳韋安

unread,
Aug 27, 2019, 2:57:28 AM8/27/19
to VPython-users
Umm..., but when I run the same code for the second time, there was a different error message showed up.
I really want to figure out it...

runfile('D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py', wdir='D:/user/Desktop/WPy64-3740/settings/.spyder-py3')
Traceback (most recent call last):

  File "<ipython-input-2-e68d4507caad>", line 1, in <module>
    runfile('D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py', wdir='D:/user/Desktop/WPy64-3740/settings/.spyder-py3')

  File "d:\user\desktop\wpy64-3740\python-3.7.4.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "d:\user\desktop\wpy64-3740\python-3.7.4.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/user/Desktop/WPy64-3740/settings/.spyder-py3/temp.py", line 8, in <module>
    from vpython import *

  File "d:\user\desktop\wpy64-3740\python-3.7.4.amd64\lib\site-packages\vpython\__init__.py", line 42, in <module>
    del gsprint, vpython

NameError: name 'gsprint' is not defined

Bruce Sherwood於 2019年8月26日星期一 UTC+8下午10時23分34秒寫道:

Matt Craig

unread,
Aug 31, 2019, 5:19:19 PM8/31/19
to VPython-users
I saw this the other day too. Best guess is that there has been a change in what the spyder settings are called.

Matt

陳韋安

unread,
Sep 6, 2019, 10:29:05 AM9/6/19
to VPython-users
Umm...do you know any solution?


Matt Craig於 2019年9月1日星期日 UTC+8上午5時19分19秒寫道:

Matt Craig

unread,
Sep 6, 2019, 10:47:08 AM9/6/19
to vpytho...@googlegroups.com
Hi,

In the short run (today), no, except maybe using an older version of spyder. My plan for the weekend involves getting out a new release of vpython, and I'll at least take a look at this. There is an easy fix (removing the cheeck of the spyder environment that causes this error) even if that isn't necessarily the right fix (keeping up with how spyder preferences are named).

My sincere hoping, barring any surprises in my inbox today, is to have a new release out on Monday.

Matt


--
You received this message because you are subscribed to a topic in the Google Groups "VPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vpython-users/jFiOpafJnkI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vpython-users/b1c29e77-9b31-4ca0-8629-df4d5d504264%40googlegroups.com.

Matt Craig

unread,
Sep 7, 2019, 3:51:00 PM9/7/19
to VPython-users
Hi,

Still hoping for a release on Monday that fixes this, but in the meantime, there is a workaround:

  • Open spyder
  • Go to Preferences
  • Navigate to the "Run" preference
  • Under "Console", select "Execute in a dedicated console"
  • Click the "Apply" button.
That is the best way to run vpython in spyder, but if you want you can change the console setting to the other choices. Choosing "Execute in a dedicated console" once will ensure that the preference exists, so the error won't occur.

Matt


On Friday, September 6, 2019 at 9:47:08 AM UTC-5, Matt Craig wrote:
Hi,

In the short run (today), no, except maybe using an older version of spyder. My plan for the weekend involves getting out a new release of vpython, and I'll at least take a look at this. There is an easy fix (removing the cheeck of the spyder environment that causes this error) even if that isn't necessarily the right fix (keeping up with how spyder preferences are named).

My sincere hoping, barring any surprises in my inbox today, is to have a new release out on Monday.

Matt


On Fri, Sep 6, 2019 at 9:29 AM 陳韋安 <1030...@gmail.com> wrote:
Umm...do you know any solution?


Matt Craig於 2019年9月1日星期日 UTC+8上午5時19分19秒寫道:
I saw this the other day too. Best guess is that there has been a change in what the spyder settings are called.

Matt

--
You received this message because you are subscribed to a topic in the Google Groups "VPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vpython-users/jFiOpafJnkI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages