BruceSherwood / vpython-jupyter

This repository has been moved to https://github.com/vpython/vpython-jupyter
64 stars 33 forks source link

Compiling with Mingw64 #128

Closed JonathanRayner closed 5 years ago

JonathanRayner commented 5 years ago

Hi, we've been using VPython for our first year physics students for several years now, but we're looking to streamline the (Windows) installation process.

Is it possible to install with Mingw64 instead of Visual Studio Build Tools?

Very detailed instructions for overcoming the initial errors were written here, but still this ultimately relies on a Visual Studio dll through the cygwinccompiler.py, which is undesirable.

BruceSherwood commented 5 years ago

The only existing mechanisms for installing the vpython module to use with installed Python are those documented at vpython.org. Or are you asking how to build VPython from source?

For intro physics students there is an option that has proved to be a huge improvement in that it eliminates having to install any software at all. This is GlowScript VPython, which is browser-based. See vpython.org and glowscript.org. After being introduced to programming and VPython using GlowScript VPython, students can graduate to using full Python, with access to all Python modules, in more advanced courses, using VPython 7, which has the same syntax as GlowScript VPython. Physics instructors who switched from having students install Python and VPython to just logging into glowscript.org report much greater enthusiasm for and acceptance of VPython; we had not realized just how big a barrier it is to students with no programming experience to install software.

Note that there are some (relatively minor) differences between current VPython and older versions (the "visual"module). These are explained on the first page of the Help at glowscript.org.

BruceSherwood commented 5 years ago

https://vpython.org/contents/announcements/evolution.html is a document that explains why it became necessary to end support for the visual module (replaced by the vpython module) in January 2016. Among many other major improvements is the fact that the new VPython works with Python 3.

mwcraig commented 5 years ago

Hi @JonathanRayner -- I haven't tried building vpython with mingw, but imagine it shouldn't be terrible (there isn't anything fancy going on in the C code). I'm not sure if vpython built with mingw will work well with, e.g., numpy built without mingwith, though.

These days you should be able to install on Windows with either pip or conda and download/install a binary distribution so that no compiling is required at all.

In this case "should be able" means "it is a bug if it doesn't work" so if you try installing on Windows and it claims to need a compiler please let us know.

It will be hard to completely avoid the Visual Studio dll since python itself is typically compiled with visual studio.

JonathanRayner commented 5 years ago

Sorry for the slow reply:

@BruceSherwood Glowscript is a great option, but unfortunately not desirable for our particular case (unfortunately we are unable to consistently guarantee internet access to our students).

@mwcraig Installing through pip (pip install vpython) currently requires a C++ compiler - pip throws an error. I have confirmed this on a virtual machine running a fresh Windows 10 install and on several fresh Windows laptops.

Perhaps there's an additional pip command that should be used to get the binary distribution?

Indeed, I didn't realize this originally, but it's true that python compiled with Visual Studio means that it's probably impossible to avoid that dll. So we've abandoned trying to use Mingw64.

Our eventual workaround has been to use anaconda. An earlier version of vpython.org reported that for later versions of python, "pip install vpython" was preferred to "conda install -c vpython vpython" and so using pip within anaconda again threw a "no C++ compiler error." But I believe that vpython.org has been updated to show that "conda install ..." is preferred.

So, perhaps my original issue is resolved (we aren't trying to use Mingw64 anymore). But yes, it seems that pip is asking for a C++ compiler, or at least was as of about a week ago. Have not tested the latest commit.

BruceSherwood commented 5 years ago

It is not true that one requires internet access to use GlowScript VPython. From the page at vpython.org on "Using VPython without installing any software":

At glowscript.org, your programs are stored in the cloud and are accessible from anywhere. However, there are times when you might need to write and run programs even when disconnected from the internet.

Go to this download site and click Download.

Unzip the GlowScriptOffline package to any convenient place on your computer.

Inside the GlowScriptOffline folder, read the README file to learn how to use the package.

JonathanRayner commented 5 years ago

Oh! My apologies, sorry I had misunderstood. Will try it out, thanks.

mwcraig commented 5 years ago

Thanks for letting me know about the pip installs. It should have installed a binary wheel, will try to figure out why it didn't.

JonathanRayner commented 5 years ago

I've just confirmed that the latest commit is working as intended. But definitely ~1 week ago it wasn't in the way I mentioned.

Thanks for the correspondence, probably okay to close the issue now?

mwcraig commented 5 years ago

Closing, thanks for the update!