Using Spyder

899 views
Skip to first unread message

Bruce Sherwood

unread,
Aug 8, 2017, 8:55:15 AM8/8/17
to VPython-users
There is a new 3.2.0 release of Spyder that makes it unusable with the vpython module. An IDE that does work is IDLE (enter "idle" at a command line).

The Spyder people, who are fans of VPython, have promised to do something special to make it possible to use Spyder with the vpython module. Here is the thread on this:


The last word in that thread is this:

Sorry, we're busy preparing to release Spyder 3.2.

We'll take a look at this in two months for Spyder 3.2.1


There are two possible ways to continue using Spyder until Spyder is changed. One is to attempt to install an older version of Spyder. The other would be to edit the file __init__.py found in the Anaconda folder Lib/site-packages/jvpython to precede the statement "if _isnotebook:" with "_isnotebook = False" in order to force the use of the no-notebook environment.


John

unread,
Aug 8, 2017, 3:11:58 PM8/8/17
to VPython-users
Hi Bruce

   I came across this talk about a new plugins for spyder. 


At the 3:45 minute mark he talks about a jupyter-notebook plugin for spyder called spyder-notebook. You can install it using pip 

pip install spyder-notebook

After you launch spyder you should see a notebook tab at the bottom of the screen, which should bring up a new jupyter notebook inside of spyder. If you can get spyder-notebook working then maybe you can try running vpython from a jupyter-notebook in spyder.

John

Bruce Sherwood

unread,
Aug 8, 2017, 5:24:19 PM8/8/17
to VPython-users
This sounds like embedded Russian dolls.....

Bruce

John

unread,
Aug 8, 2017, 6:12:25 PM8/8/17
to VPython-users
Hi Bruce

    I gave is a try and it worked. So it is possible to run vpython in spyder via the new spyder-notebook plugin. Give is a try, just perform

pip install spyder-notebook

then launch spyder and click on the notebook tab at the bottom of the screen and then click on the "untitled0" tab to see the empty notebook. You can then enter code in the notebook cells and run it. I tried

from vpython import *
box()

and it displayed the 3D box in the output cell just like in a jupyter notebook. However, you will also have to do the additional imports that the vpython-notebook was doing doing.

John

Bruce Sherwood

unread,
Aug 9, 2017, 4:18:06 PM8/9/17
to VPython-users
I updated Spyder (to 3.2.0) and installed spyder-notebook. Now nothing works on my Windows 10 laptop. When I click "Notebook" I do get two tabs, "welcome" and "untitled0". Entering the simple box program (into an infinitesimal edit space) and trying to run gave a Spyder error. I quit Spyder and restarted it. Now I can't even enter code into the untitled0 space (which is now large and blank). I tried to follow the invitation to report this to the spyder repository but the "Submit new issue" button is grayed out despite having logged in.


Bruce Sherwood

unread,
Aug 9, 2017, 4:19:55 PM8/9/17
to VPython-users
For the record, this is the report I tried to give Spyder:

1. On Windows 10 laptop with Anaconda with Python 3.6 and old Spyder, execute conda update qt pyqt, then conda update spyder. Next execute pip install spyder-notebook. I see the "Notebook" tab and click it. The welcome and untitled0 tabs display. I enter a trivial program in untitled0 (whose font is infinitesimally small) and run, and I get an error. I quit Spyder and restart. Now the untitled0 tab is a big blank sheet into which I cannot enter any text. After a while of not touching the laptop the error below occurs.

  File "C:\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "C:\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py", line 83, in create_connection
    raise err
  File "C:\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

Traceback (most recent call last):
  File "C:\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 356, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Anaconda3\lib\http\client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Anaconda3\lib\http\client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Anaconda3\lib\http\client.py", line 1234, in endheaders
    self._send_output(messa

John

unread,
Aug 9, 2017, 5:11:15 PM8/9/17
to VPython-users
Hi Bruce

  I initially had a problem also and reported it and the spyder people responded by asking me which version of the notebook package I was using. Then I updated the notebook package to version 5.0.0 with conda and it started to work for me.

Try the command 

conda list

to see which version of the notebook package you are using. If it is not version 5.0.0 then you can try

conda update notebook 

to get the latest version. 

I also tried setting up a separate conda environment called "py36" so that I could test it in its own sandboxed environment. You can do the same with the following command assuming you don't already have a conda environment named "py36". You can name it whatever you want.

conda create -n py36 python=3.6 jupyter spyder pip

then once the environment is created you need to activate it with the command

activate py36

next you need to pip install the following in this py36 environment

pip install spyder-notebook

pip install vpython

Then once everything is installed in the environment just launch spyder from this environment.

spyder

See if that works for you. You can list all the packages in this 'py36' conda environment with the command

activate py36           (If you are not in py36 environment)

conda list

And you can also install other packages that you might like in this environment using conda or pip such as the idle package.


You can list all of the conda environments on your computer with the command

conda info -e

You can exit the py36 environment with the command

deactivate

or just close the window.

You can delete an environment that you no longer need with the command the root environment.

conda remove -n py36 --all

John

Bruce Sherwood

unread,
Sep 20, 2017, 10:16:30 AM9/20/17
to VPython-users
Another option is to install Spyder 3.1.4.

Bruce
Reply all
Reply to author
Forward
0 new messages