VIDLE installation/usage with Anaconda

528 views
Skip to first unread message

Jerome Fung

unread,
Aug 6, 2015, 7:32:02 PM8/6/15
to VPython-users

Hi everyone,

I have a pre-existing installation of Anaconda on my Mac (running OS 10.10) for research use and plan to use VPython in the introductory mechanics course I am teaching this fall. I successfully installed Matt Craig's conda package (following the instructions at http://vpython.org/contents/download_mac.html) and I can execute sample scripts from the Terminal. I would like to be able to use VIDLE since that is what most of my students are probably going to use.

The Python package for VIDLE is clearly present in 

/Users/[my username]/anaconda/lib/python2.7/site-packages/VPython-6.11-py2.7-macosx-10.5-x86_64.egg/vidle. 

When I run idle.py (using either python idle.py or pythonw idle.py from the Terminal), VIDLE starts up. But if I try to execute "import visual" in VIDLE, I get the error message "System Exit: This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac" in VIDLE's Python shell.

What am I doing wrong? I've tried searching this forum as well as Google for "anaconda vidle". (I couldn't find a solution in this thread: https://groups.google.com/d/msg/vpython-users/qMyvWsjyJKs/boDDQyWwFm8J). Thanks in advance.

Sincerely,
Jerome Fung


Bruce Sherwood

unread,
Aug 6, 2015, 8:18:47 PM8/6/15
to vpytho...@googlegroups.com
When you execute "python idle.py" or "python2 idle.py" you will run IDLE, not VIDLE, which addresses some problems with the standard IDLE distributed with Python. Try running the idle.py found in the vidle folder and tell us what happens.

Jerome Fung

unread,
Aug 6, 2015, 9:38:59 PM8/6/15
to VPython-users
Sorry I was unclear, but I was indeed running idle.py from the vidle folder. It was also apparent from the help menu that I was not running Python's native IDLE.

Thanks,
Jerome

Aaron Titus

unread,
Aug 6, 2015, 10:22:13 PM8/6/15
to vpytho...@googlegroups.com
I have not tested this, so I can’t guarantee it will work perfectly. :-)

If you install python 2.7.9 and vpython from python.org, it will install the python binaries and packages in a different location than anaconda. The installer will likely change your bash profile and create a symbolic link for python to point to the one just installed in:

/System/Library/Frameworks/Python.framework/Versions

From a command line, type “which python” to see the full path to the python binary. Run VIDLE, and it will likely work just fine.

When you want to run anaconda’s python from a terminal, use:

//anaconda/bin/pythonw myprogram.py

Alternatively, create a symbolic link like “anapython" that points to:

//anaconda/bin/python

Then you could run:

anapypthon myprogram.py

I think there are many solutions to this, but this is what I would try first.

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,
Aug 7, 2015, 5:28:48 AM8/7/15
to vpytho...@googlegroups.com, Steve Spicklemire
So I think this is due to the way vidle launches a subprocess to run your program. It uses the ‘sys.executable’ property to find the version of python to run. The trouble is the anaconda build really needs to use pythonw, but for some reason sys.executable is pointing to the “non-w” version:

aluminum:~ steve$ ~/anaconda/bin/pythonw
Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import sys
>>> sys.executable
'/Users/steve/anaconda/bin/python’

You can “fix” this with a hack if you edit the file:

anaconda/lib/python2.7/site-packages/VPython-6.11-py2.7-macosx-10.5-x86_64.egg/vidle/PyShell.py

thusly:

aluminum:~ steve$ diff ~/anaconda/lib/python2.7/site-packages/VPython-6.11-py2.7-macosx-10.5-x86_64.egg/vidle/PyShell.py~ ~/anaconda/lib/python2.7/site-packages/VPython-6.11-py2.7-macosx-10.5-x86_64.egg/vidle/PyShell.py
361c361
< self.rpcproc = subprocess.Popen([sys.executable] + args[1:])
---
> self.rpcproc = subprocess.Popen([sys.executable+'w'] + args[1:])

But there must be a better solution. I’ll try to sort out a cleaner way.

thanks for reporting the problem!
-steve

> On Aug 6, 2015, at 7:32 PM, Jerome Fung <jfu...@wellesley.edu> wrote:
>
>

Steve Spicklemire

unread,
Aug 7, 2015, 6:24:44 AM8/7/15
to VPython-users, stevespi...@gmail.com
Hi Jerome,

BTW, I should've pointed out that this line:

    self.rpcproc = subprocess.Popen([sys.executable+'w'] + args[1:]) 

is line number 361 of the PyShell.py file.

-steve

Jerome Fung

unread,
Aug 7, 2015, 10:54:22 AM8/7/15
to VPython-users, stevespi...@gmail.com
Steve -- your suggestion of modifying self.rpcproc in PyShell.py worked. Thank you very much.

Perhaps it would be useful to document this somewhere, or to change this in Matt Craig's conda package?

Jerome

Steve Spicklemire

unread,
Aug 7, 2015, 10:59:17 AM8/7/15
to vpytho...@googlegroups.com, Steve Spicklemire
Hi Jerome,

We certainly need to do something, but I think this is probably not the best way. I don’t know what other possible side effects this might cause on other platforms (e.g., Canopy, python.org python, Win/Linux/etc.), so I’m reluctant to make this change in the vpython code base. Does anyone know if there’s an easy/reliable way to detect whether you’re running under anaconda? I don’t actually *use* anaconda myself on a daily basis so I’m not that familiar with it’s quirks.

thanks,
-steve

Matt Craig

unread,
Aug 9, 2015, 9:56:53 PM8/9/15
to VPython-users
Hi,

It is easy in a conda recipe to add a patch, so I could just do it that way. That is almost certainly preferable to modifying their underlying code, since it is distribution- specific.

Let me check at work Monday with some folks who used anaconda and Vpython last semester to see if they hit errors/how they handle them.

Matt Craig

Adam Hausknecht

unread,
Aug 18, 2015, 11:53:24 AM8/18/15
to VPython-users
Jerome and all, 

I too would like to know of this best way to fix this problem.

I am setting up a computer classroom with new iMacs for the Fall that includes the Anaconda distribution of python and would like to be able to run VIDLE  from  the Anaconda VPython package rather than the standard standalone VPython package!  Note that I have been able to run vPython programs by using the "pythonw" command directly from the Terminal. However, many of my students are new to programming and have difficult time with switching between different versions of Python and different editors. Perhaps a script could be written that sets/resets the version of python that sys.executable invokes.

Regards,

Adam Hausknecht
Department of Mathematics
UMass Dartmouth

Matt Craig

unread,
Aug 18, 2015, 11:54:26 AM8/18/15
to vpytho...@googlegroups.com
Hi,

I'll make this a priority today. More by 10PM CDT at latest...

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/vU_r0fGBL2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.

Ashreya Jayaram

unread,
Aug 18, 2015, 1:11:11 PM8/18/15
to VPython-users
Is there a way to install vpython for anaconda on linux-64?

Matt Craig

unread,
Aug 18, 2015, 1:35:10 PM8/18/15
to vpytho...@googlegroups.com
Not at the moment, but I think I could make that happen -- do you have anaconda?

If so, I can send you the recipe, which hopefully works without modification on linux.

Can get you the recipe later today, won't have a chance to try the build myself until tomorrow.

Matt

PS Was just waiting for a linux person to ask before going there :)

Rob Knop

unread,
Aug 18, 2015, 2:30:22 PM8/18/15
to vpytho...@googlegroups.com
On August 18, 2015 1:11:11 PM EDT, Ashreya Jayaram <ashre...@gmail.com> wrote:
>Is there a way to install vpython for anaconda on linux-64?
>
>On Tuesday, 18 August 2015 21:24:26 UTC+5:30, Matt Craig wrote:
>>
>> Hi,
>>
>> I'll make this a priority today. More by 10PM CDT at latest...
>>
>> Matt
>>
>>
>> On Tue, Aug 18, 2015 at 10:53 AM, Adam Hausknecht
><aohaus...@gmail.com
>>> vpython-user...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

Not as much of a need; there's a good chance on your Linux distro that all the stuff in anaconda is in your package manager anyway. On Ubuntu, it is.

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Matt Craig

unread,
Aug 18, 2015, 4:33:02 PM8/18/15
to VPython-users
Hi,

Good news/bad news, then a question...

Good news: I have a recipe working locally that patches PyShell.py

Bad news: I can't seem to upload *anything* to anaconda.org (nee binstar.org) right now.

Question, especially for Bruce and Steve

Right now launching vidle is a pain, something like python /path/to/vidle/in/site-packages/in-my-environment/idle.py

Do you have any objection to me patching setup.py for anaconda to add an entry point for vidle that calls the appropriate thing?

Then launching vidle would be a matter of opening the terminal and typing: vidle

I'm inquiring at continuum about the upload issue....worst case I'll email a link to the conda package with you can install locally/kick the tires of tonight.

Matt

Steve Spicklemire

unread,
Aug 18, 2015, 4:49:00 PM8/18/15
to vpytho...@googlegroups.com, Steve Spicklemire
Hi Matt,

Thanks! I don’t see how that could produce any trouble. It would be a patch you apply at the ‘conda install’ step no?

Thanks for all your work on this.

-steve
> --
> 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.

Matt Craig

unread,
Aug 18, 2015, 4:51:28 PM8/18/15
to VPython-users, stevespi...@gmail.com
Hi,

Yes, it would be applied as a patch when the package is built, which is how I'm doing the PyShell change (only on Mac for now because that is where I can test easily).

Will give the script a try later today!

Matt

Matt Craig

unread,
Aug 19, 2015, 12:20:29 AM8/19/15
to VPython-users
Hi Jerome and Adam,

anaconda.org still isn't taking uploads (or at least not my uploads :(), but a mac package is built that:

+ Lets vidle run correctly
+ Include vidle command line script, so students can open a terminal and type: vidle

Right now the script holds on to the command line, but that's the best I can do for now (suggestions welcome).

While we are waiting for anaconda.org to work you can do this:

2. install it with: conda install -c mwcraig /full/path/to/your/downloaded/vpython-6.11.0-np19py27_1.tar.bz2

You might want to create a test environment to install it into in case things go south. You want the "-c mwcraig" to make sure you pull in the right boost build.

Please report back as the whether this does what you want...

Matt


On Tuesday, August 18, 2015 at 10:53:24 AM UTC-5, Adam Hausknecht wrote:

Jerome Fung

unread,
Aug 19, 2015, 10:05:59 AM8/19/15
to vpytho...@googlegroups.com
Hi Matt,

Your new package works for me. I can execute vidle from the command line, and from vidle my vpython programs run with the expected 3D scene control. Thank you very much.

Best,
Jerome



--
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/vU_r0fGBL2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jerome Fung
Lecturer in Physics
Wellesley College

Ashreya Jayaram

unread,
Aug 19, 2015, 11:23:49 AM8/19/15
to VPython-users
Hi Matt

I have anaconda running (on ubuntu). Please do let me know the installation process. Also, I am able to find 'vpython 3d scientific visual library' in the ubuntu software centre. Will vpython run on anaconda if I install this? Thanks.

Ashreya

Adam Hausknecht

unread,
Aug 19, 2015, 11:26:34 AM8/19/15
to VPython-users
Hi Matt,

Your new package also works for me on my MacBookPro.  

Regards and thanks for your quick fix!

Adam Hausknecht
Department of Mathematics
UMass Dartmouth




Matt Craig

unread,
Aug 19, 2015, 11:32:28 AM8/19/15
to vpytho...@googlegroups.com
Hi Adam & Jerome,

Thanks for the quick reports -- I'll try to get the package uploaded in the next couple of days.  

One other thought -- I can toss together in about thirty seconds an example of a double-clickable file that will launch a terminal, set anaconda as default python (if you want it to do that) and run vidle.

Well, in thirty seconds I could you send you an example of that kind of thing, which would be easy to modify.

Do you guys have an order-of-magnitude estimate of the number of students you might be using this with? I have an internal two-year report to write this year for which numbers are helpful :)

Matt


--

Matt Craig

unread,
Aug 19, 2015, 11:37:33 AM8/19/15
to vpytho...@googlegroups.com
Hi Ashreya,

There is no harm in trying the ubuntu package, but my guess is it won't know about anaconda, it will point to the ubuntu python package.

I'm about to drop a bunch of things on you at once below, and some of it may be stuff you haven't seen before. If so, please speak up!

To try a linux compile, in a terminal window do:

conda update conda              # always do this, it updates frequently
conda install conda-build       # or conda update conda-build if already installed
cd some/directory/for recipes   # Can be anywhere, but NOT in your ~/anaconda tree
# Line below clones the repository of my conda-related recipes

# Then follow the directions in the README at https://github.com/mwcraig/conda-vpython-recipes

I will get to this eventually, but not before the weekend :(

Matt



Jerome Fung

unread,
Aug 19, 2015, 11:40:54 AM8/19/15
to vpytho...@googlegroups.com
I personally expect to be using vpython with around 50 students total this year; including other faculty here would bring the total to around 80.

Thanks,
Jerome

Aaron Titus

unread,
Aug 19, 2015, 8:51:11 PM8/19/15
to vpytho...@googlegroups.com
Thank you, Matt. All of us who are using anaconda greatly appreciate your build.

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.

Matt Craig

unread,
Aug 20, 2015, 2:48:01 PM8/20/15
to vpytho...@googlegroups.com
Hi Aaron,

I'd normally say it is my pleasure but there were line ending hacks involved in getting the vidle thing working ;).

More seriously, I do appreciate the message and, at risk sounding like an anaconda evangelist, think that it will be the go-to distribution for scientific software.

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/vU_r0fGBL2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vpython-user...@googlegroups.com.

Matt Craig

unread,
Aug 23, 2015, 10:48:05 PM8/23/15
to vpytho...@googlegroups.com
Hi all,

The "improved" Mac build of vpython 6.11 which lets you launch vidle from the command line is now available on the usual conda channel:

conda install -c mwcraig vpython

or

conda update -c mwcraig vpython 

The latter should work even if you have v6.11 already installed because I increased the build number.

Still have on the radar that a linux build would be nice...

Matt

heafnerj

unread,
Aug 24, 2015, 12:35:39 AM8/24/15
to VPython-users

On Sunday, August 23, 2015 at 10:48:05 PM UTC-4, Matt Craig wrote:
Hi all,

The "improved" Mac build of vpython 6.11 which lets you launch vidle from the command line is now available on the usual conda channel:

conda install -c mwcraig vpython

or

conda update -c mwcraig vpython 

Hello Matt.

I've used VPython since it was invented but I'm very new to Anaconda, so I need some clarification. I currently have VPython 6.11 installed from vpython.org and I have the latest Anaconda installed so I can use notebooks.  Will installing VPython in Anaconda as described above install everything or just the ability to launch VIDLE from the vpython.org distribution? I'm rather confused about this.

Joe

Matt Craig

unread,
Aug 24, 2015, 2:32:27 PM8/24/15
to vpytho...@googlegroups.com
Hi Joe,

Anaconda will not see the vpython from vpython.org. If you install with

conda install -c mwcraig vpython

you will get 5 or 6 packages, which includes vpython 6.11 and all of its dependencies; that anaconda package was originally released roughly 8 months ago when 6.11 was released.

The new, additional bit, for mac only, is that starting vidle from the command line now works.

If you run vpython 6.11 in a notebook I believe it will display the graphics in a separate window.

If you are interested in running it in a jupyter (nee ipython) notebook, would you mind starting a separate thread? It is a question that gets asked frequently around this time of year, so I think there would be a lot of interest in it (and I'm not sure about the current state-of-the-art on that front), so it would be appreciated by many, I'm sure, if you were to pose it.

If you have more anaconda questions, of course keep this thread going!

Thanks,
Matt 



--

Adam Hausknecht

unread,
Aug 29, 2015, 11:03:29 PM8/29/15
to VPython-users
Hi all,

I found that it is easy to create an AppleScript app to launch VIDLE  rather than using the command line (via the Terminal app): Here is the script:

do shell script ".Full_Path_To_anaconda/bin/vidle"


This line must be entered into Apple's AppleScript editor and compiled.  The script can then be exported as a double-clickable AppleScript app with an icon. 

The app launches VIDLE without opening the Terminal app.


Note: I've attached an example of the script and app.


Regards,


Adam Hausknecht

Department of Mathematics

UMass Dartmouth







main.scpt
MacBookVidle.app.zip
Reply all
Reply to author
Forward
0 new messages