sympy / scipy-2017-codegen-tutorial

SymPy code generation tutorial at SciPy 2017
http://www.sympy.org/scipy-2017-codegen-tutorial/
Other
61 stars 26 forks source link

Cython & Sundials on Windows, OS X & Linux #2

Closed bjodah closed 7 years ago

bjodah commented 7 years ago

So I have got my first preliminary notebooks to compile on all systems (see below for details, OS X still needs some fixing).

The notebooks are still quite rough (I need to rephrase texts, fix misspellings & reformat them into exercises of some sort).

Do you think we should configure CI services for all platforms? (I am not familiar with appveyor, nor OSX on travis)

Ubuntu

Using Python 3 with local (pip) environment on Ubuntu 16.04:

Using Anaconda2 on a fresh install of Ubuntu 16.04:

OS X

Using Anaconda3 on OS X El Capitan:

Windows

Using Anaconda2 on Windows 10 (no msvc installed):

ImportError: Building module ode_c_e70fd5ee80 failed: ['DistutilsPlatformError: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27\n']

using mingw give linking errors when linking against sundials (a bunch of missing symbols)

if I instead follow the link and download and installed VCForPython27.msi (weighing in at 86 MiB). I then restarted the system (maybe logging on/off is enough), and then every thing worked fine.

Using Anaconda3 on Windows 10:

ImportError: Building module ode_c_09959cfb97 failed: ['distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools\n']

Downloading Visual C++ Build Tools 2015 from the above link (beware: it's a 4 GiB installation -- and one may not skip the Windows 8.1 SDK or headers will be missing) and restarting the system allows the notebooks to be run successfully.

If that is an unacceptable requirement I suppose we could look into building sundials using mingw (but the linker were spitting out tons of errors mentioning python related missing symbols).

isuruf commented 7 years ago

On OSX, to fix the linking, do export LDFLAGS="-Wl,-rpath,/Users/user/miniconda3/envs/codegen17/lib/" before doing the compilation.

On Windows, if you are using mingw, you'll need to patch python.dll to make it work with both msvc and mingw. We do this for symengine in appveyor. Let me know if you want to go ahead with mingw and I can help.

bjodah commented 7 years ago

@asmeurer I'm running into this bug under windows using Anaconda3 when trying to use mingw: https://bugs.python.org/issue21821

Is there a way under conda to have our environment.yml e.g. patch distutils/cygwincompiler.py?

mingw under Anaconda2 now actually works if I make sure python27.dll is available in library_dirs. Linking against sundials however still generates lots of errors (when using mingw, not msvc).

isuruf commented 7 years ago

@bjodah, if it helps, see https://github.com/conda-forge/rpy2-feedstock/blob/master/recipe/bld.bat and meta.yaml for a windows build of a python extension.

bjodah commented 7 years ago

@isuruf thank you for the link! I'm currently using pyximport with a custom pyxbld file to build the code generated in the notebooks. But maybe we should turn this into a conda package, I don't now. Windows users could run a .bat file which sets up those files (patched dll's etc.) after creating the conda environment.

certik commented 7 years ago

Yes, a conda package is probably the most robust and usable solution.

bjodah commented 7 years ago

Thanks for all the input. The notebooks are rendering on all 3 platforms (with system provided compilers).