Error in import vpython

1,022 views
Skip to first unread message

Sequencer

unread,
Apr 7, 2016, 1:48:12 AM4/7/16
to VPython-users
Hello,
Thank you for clicking in.
here is my environment.

OS X 10.11.4

Python 3.5.1 (default, Mar 17 2016, 16:57:46) 

[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin

Python 2.7.11 (default, Mar 17 2016, 16:53:31) 

[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin


Installed python3 and python2 from brew


pip2 list

appnope (0.1.0)

backports-abc (0.4)

backports.ssl-match-hostname (3.5.0.1)

certifi (2016.2.28)

cocos2d (0.6.3)

colorama (0.3.7)

crayola (0.1.1)

decorator (4.0.9)

functools32 (3.2.3.post2)

gnureadline (6.3.3)

ipykernel (4.3.1)

ipython (4.1.2)

ipython-genutils (0.1.0)

ipywidgets (4.1.1)

IVisual (0.2.88)

Jinja2 (2.8)

jsonschema (2.5.1)

jupyter (1.0.0)

jupyter-client (4.2.2)

jupyter-console (4.1.1)

jupyter-core (4.1.0)

MarkupSafe (0.23)

mercurial (3.7.2)

mistune (0.7.2)

nbconvert (4.1.0)

nbformat (4.0.1)

notebook (4.1.0)

numpy (1.10.4)

path.py (8.1.2)

pexpect (4.0.1)

pickleshare (0.6)

pip (8.1.0)

ptyprocess (0.5.1)

pyglet (1.2.4)

Pygments (2.1.3)

pyzmq (15.2.0)

qtconsole (4.2.1)

setuptools (19.4)

simplegeneric (0.8.1)

singledispatch (3.4.0.3)

six (1.10.0)

terminado (0.6)

tornado (4.3)

traitlets (4.2.1)

ujson (1.35)

urllib3 (1.14)

vpnotebook (0.1.3)

vpython (0.3.4)

wheel (0.26.0)


pip3 list

appnope (0.1.0)

beautifulsoup4 (4.4.1)

biopython (1.66)

cocos2d (0.6.3)

cycler (0.10.0)

dask (0.8.1)

decorator (4.0.9)

Django (1.9.2)

gnureadline (6.3.3)

ipykernel (4.3.1)

ipython (4.1.2)

ipython-genutils (0.1.0)

ipywidgets (4.1.1)

Jinja2 (2.8)

jsonschema (2.5.1)

jupyter (1.0.0)

jupyter-client (4.2.2)

jupyter-console (4.1.1)

jupyter-core (4.1.0)

MarkupSafe (0.23)

matplotlib (1.5.1)

mistune (0.7.2)

mpmath (0.19)

nbconvert (4.1.0)

nbformat (4.0.1)

networkx (1.11)

notebook (4.1.0)

numpy (1.10.1)

pandas (0.18.0)

path.py (8.1.2)

pexpect (4.0.1)

pickleshare (0.6)

Pillow (3.1.1)

pip (8.1.1)

ptyprocess (0.5.1)

pygame (1.9.2a0)

pyglet (1.2.4)

Pygments (2.1.3)

pylab (0.1.3)

pyparsing (2.1.1)

pypybox2d (2.1.post331)

python-dateutil (2.5.1)

pytz (2016.3)

pyzmq (15.2.0)

qtconsole (4.2.1)

scikit-image (0.12.3)

scikit-learn (0.17.1)

scipy (0.16.0)

seaborn (0.7.0)

setuptools (20.6.7)

simplegeneric (0.8.1)

six (1.10.0)

sympy (1.0)

terminado (0.6)

toolz (0.7.4)

tornado (4.3)

traitlets (4.2.1)

ujson (1.35)

urllib3 (1.14)

vpnotebook (0.1.3)

vpython (0.3.4)

wheel (0.26.0)




When I using python3

import vpython

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python3.5/site-packages/vpython/__init__.py", line 1, in <module>

    from .vpython import *

  File "/usr/local/lib/python3.5/site-packages/vpython/vpython.py", line 315, in <module>

    get_ipython().kernel.comm_manager.register_target('glow', GlowWidget)

AttributeError: 'NoneType' object has no attribute 'kernel'


When I suing python2

import vpython

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python2.7/site-packages/vpython/__init__.py", line 1, in <module>

    from .vpython import *

  File "/usr/local/lib/python2.7/site-packages/vpython/vpython.py", line 315, in <module>

    get_ipython().kernel.comm_manager.register_target('glow', GlowWidget)

AttributeError: 'NoneType' object has no attribute 'kernel'

>>> Exception in thread Thread-1:

Traceback (most recent call last):

  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner

    self.run()

  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 1073, in run

    self.function(*self.args, **self.kwargs)

  File "/usr/local/lib/python2.7/site-packages/vpython/vpython.py", line 178, in commsend

    with glowlock:

AttributeError: __exit__


I have no idea why these error raised.

Aaron Titus

unread,
Apr 7, 2016, 8:17:49 AM4/7/16
to vpytho...@googlegroups.com
Is there a reason that you must use brew?

I suggest installing anaconda. After it is installed, on the command line type:

pip install vpython

In my experience, this has worked every time with no errors.

Aaron

--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Spicklemire

unread,
Apr 7, 2016, 8:20:47 AM4/7/16
to vpytho...@googlegroups.com, Steve Spicklemire
I’ve used brew successfully.

However, it looks like you’re not in a jupyter notebook. vpython only works in a jupyter notebook, not from the command line!

-steve

Kevin Karplus

unread,
Apr 7, 2016, 10:33:34 AM4/7/16
to vpytho...@googlegroups.com
One of the anaconda users here found it difficult to install gnuplot afterwards, because anaconda (or something else—hard to tell on an older system when the student doesn't remember what has been installed) had messed up a bunch of the paths used by compilers.  So doing a "homebrew" installation is not necessarily an evil thing.

Kevin Karplus   kar...@soe.ucsc.edu    http://www.soe.ucsc.edu/~karplus
Professor of Biomolecular Engineering, University of California, Santa Cruz
Program Chair and Undergraduate Director, Bioengineering
Undergraduate Director, Bioinformatics
Affiliations for identification only.

Sequencer

unread,
Apr 7, 2016, 2:15:19 PM4/7/16
to VPython-users
Thank you!
However because I'm trying to build a project in PyCharm.
So I have to use Terminal.
anaconda is overstaffed.
I'd rather use original python instead.
So is there another way to solve it?
Thank you for your time!

Sequencer

unread,
Apr 7, 2016, 2:20:03 PM4/7/16
to VPython-users, stevespi...@gmail.com
Thank you!
I have nerver used jupyter notebook I found I might have installed jupyter in pip.
I have a package which import ivisual.
I find it isn't an interpreter form its website.
Would you mind tell me how to use it?
Thank you for your time!

Sequencer

unread,
Apr 7, 2016, 2:34:02 PM4/7/16
to VPython-users
Thank you for your replying!
Same here. I have used python for over 3 years. I found it's more wise to use the pure python.
If installed a no-open-source software, it seems to be not pythonic :)
I'm trying to use an package wrote in 2000, which has import ivisual. I try to imitate molecule vibration.
And after tried so hard, I came here to ask question.
So if ivisual can't be imported with pure python, is there any way to substitute for it's function? 
Thank you for your time!

Bruce Sherwood

unread,
Apr 7, 2016, 3:03:28 PM4/7/16
to VPython-users, Steve Spicklemire
That 2000 package imported the Classic VPython module, named visual, not ivisual. Starting with Classic VPython 6, several years ago, running from a terminal is difficult, although Steve Spicklemire (who made major contributions to VPython 6) did find a way to do this, and I've copied him on this note. With that information it might be possible for you to install Classic VPython and run from a terminal. 

As has been said, to run Jupyter VPython you must necessarily import vpython into a program housed in a Jupyter notebook, which establishes connections to a browser.

Sequencer

unread,
Apr 10, 2016, 3:33:46 AM4/10/16
to VPython-users
Thank you!
So sorry for replying late. I was trouble by fortran these days. 
I think the Classic VPython module has the same api with nowadays.
Would you mind teaching me how to do this?
If I can't use this module. I have to use numpy+OpenGL instead.
Thank you!

Steve Spicklemire

unread,
Apr 10, 2016, 4:43:43 AM4/10/16
to vpytho...@googlegroups.com, Steve Spicklemire
You can get classic vpython by visiting <http://vpython.org> and scrolling down to the “Download VPython” link.

Which operating system are you using? Some of the details may depend on that.

When you say “run from a terminal” do you mean interactive use from the python shell, or just launching python from the terminal? If the latter, you need nothing special, you can just run the python executable using the standard command line options. The “way to do this” that Bruce refers to is a way to use an interactive python shell without having to call “rate()” by hand. That’s available here:

<https://dl.dropboxusercontent.com/u/20562746/vpysh.py>

It requires wxPython (which VPython 6 already requires anyway).

Hope that helps!

take care,
-steve

Sequencer

unread,
Apr 10, 2016, 11:12:37 AM4/10/16
to VPython-users, stevespi...@gmail.com
Hello, My system is OS X 10.11.4,using brew to install python. I doubt it's the problem of 64 bit.

Steve Spicklemire

unread,
Apr 10, 2016, 2:32:01 PM4/10/16
to Sequencer, Steve Spicklemire, VPython-users
Have you tried ‘brew install vpython’?

-steve

Steve Spicklemire

unread,
Apr 10, 2016, 2:45:55 PM4/10/16
to Sequencer, Steve Spicklemire, VPython-users
Also, be aware of this thread:

<https://groups.google.com/forum/#!searchin/vpython-users/wxmac/vpython-users/sIjW42s3V2w/GMBJv_C8BgAJ>

If you see problems with the rate() function, you may need to revert to an older version of wxpython.

-steve

Bruce Sherwood

unread,
Apr 10, 2016, 11:06:43 PM4/10/16
to VPython-users, Sequencer, Steve Spicklemire
Correct me if I'm wrong, Steve, but isn't it the case that the Jupyter notebook provides very powerful command-line capabilities? The the need for command-line capability doesn't preclude using a Jupyter notebook?

Steve Spicklemire

unread,
Apr 11, 2016, 5:35:27 AM4/11/16
to Bruce Sherwood, VPython-users, Sequencer
That's a very good point Bruce. It really depends on the reason a "command line" interface is desired. If the ultimate goal is to produce a standalone application then jupyter won't help you. If the idea is to interact with vpython then the notebook interface is great!

thanks,
-steve

Ratan Deshpande

unread,
Oct 15, 2017, 8:51:12 AM10/15/17
to VPython-users
I have got similar errors when I tried to use import ivisual in command prompt as below
<IPython.core.display.HTML object>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ratangd\Anaconda3\lib\site-packages\ivisual\__init__.py", line 1, in <module>
    from .visual import *
  File "C:\Users\ratangd\Anaconda3\lib\site-packages\ivisual\visual.py", line 562, in <module>
    get_ipython().kernel.comm_manager.register_target('glow', GlowWidget)
AttributeError: 'InteractiveShell' object has no attribute 'kernel'
In :

I need to use import ivisual in Jupyter Notebook for using vpython. But before that import ivisual should work on cmd

Bruce Sherwood

unread,
Oct 15, 2017, 9:49:40 AM10/15/17
to VPython-users
The line numbers displayed in the error messages refer to some very old version of the vpython module, and I don't understand how one obtains that very old version.

Also, ivisual was an early experimental module that has been superceded by the contemporary vpython module. The ivisual module is not needed by the vpython module.

Please read carefully the installation instructions for vpython found at vpython.org.

Bruce

Ratan Deshpande

unread,
Oct 16, 2017, 12:27:03 PM10/16/17
to VPython-users
Thank you mine is latest version of Anaconda with Python 3.5 and I will check about vpython 
Reply all
Reply to author
Forward
0 new messages