FreeCAD 0.16 with numpy and scipy in windows?

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

FreeCAD 0.16 with numpy and scipy in windows?

Post by joha2 »

The root of this question is twofold:

1. I work on a FreeCAD interface for an optical raytracer written in Python. The optimization of the raytracer needs scipy. In Linux this is usually no problem, but in windows it is.
2. For more sophisticated scientific calculations, it would be nice to have an interface to scipy on-board in FreeCAD.

My question is: Is it possible to get scipy running together with FreeCAD 0.16 in windows 64 (but on a userspace level, without recompiling)? My second question is: Is it possible that you guys ship the future precompiled windows binaries with scipy support?
The goal is to have full scipy support after a quick setup in windows to get users more attracted to the project.

Btw: How is it decided which modules are shipped with FreeCAD's Python?

Best wishes
Johannes
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by peterl94 »

joha2 wrote:Is it possible to get scipy running together with FreeCAD 0.16 in windows 64
Not that I know of. The trouble is fortran. The windows builds are compiled with Visual Studio 2013, and the only fortran compiler that works with VS is the expensive Intel compiler (as far as I know).
joha2 wrote:Is it possible that you guys ship the future precompiled windows binaries with scipy support
Yes, but it won't be for a few months. There is an on going effort to add Python 3 support to FreeCAD. Once that is completed, we will be able to use the precompiled scipy/numpy provided by Anaconda.
joha2 wrote:How is it decided which modules are shipped with FreeCAD's Python?
So far it has just been what is used by the workbenches shipped with FreeCAD.

Again, this situation will improve once python 3 is here because freecad can use the same version of visual studio as the official python (only needed for non python-only libraries).
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by sgrogan »

peterl94 wrote:Not that I know of.
Hello Peter, actually for 0.16 this should be possible if you can compile x64 with VC9 (I could never get the hack to work with VS2008 Express)
Then I think these packages should work. http://www.lfd.uci.edu/~gohlke/pythonlibs/
But for 0.17 until we have Python3 and VS2015 libpacks we're stuck.
BTW: We do have NumPy thanks to Peter already.
"fight the good fight"
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by peterl94 »

True, but that is too much work. :mrgreen: It seems like if people really needed to use scipy with freecad on windows, they could install 0.16 32bit.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by sgrogan »

peterl94 wrote:True, but that is too much work. :mrgreen: It seems like if people really needed to use scipy with freecad on windows, they could install 0.16 32bit.
+1 Any and all efforts should be directed at FreeCAD 0.17, VC14, QT5, OCCT 7.x, VTK 7.x, Pyside2, nglib 6.2+, etc.
"fight the good fight"
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by joha2 »

peterl94 wrote:True, but that is too much work. :mrgreen: It seems like if people really needed to use scipy with freecad on windows, they could install 0.16 32bit.
Thank you guys for all the answers! Could you tell me where to get the appropriate scipy binary for FC 0.16 32 bit? I want to add it to some install notes on our git repo.

Best wishes
Johannes
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by peterl94 »

joha2 wrote:Could you tell me where to get the appropriate scipy binary for FC 0.16 32 bit?
Download numpy‑1.12.0+mkl‑cp27‑cp27m‑win32.whl and scipy‑0.18.1‑cp27‑cp27m‑win32.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/

To install:
1. Delete (or rename) C:\Program Files (x86)\FreeCAD 0.16\bin\Lib\site-packages\numpy
2. Use 7-zip to extract numpy‑1.12.0+mkl‑cp27‑cp27m‑win32.whl\numpy to C:\Program Files (x86)\FreeCAD 0.16\bin\Lib\site-packages
3. Use 7-zip to extract scipy‑0.18.1‑cp27‑cp27m‑win32.whl\scipy to C:\Program Files (x86)\FreeCAD 0.16\bin\Lib\site-packages

I'm sure there has to be a way to do it with pip, but I didn't spend the time to figure it out.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by sgrogan »

peterl94 wrote: Download numpy‑1.12.0+mkl‑cp27‑cp27m‑win32.whl and scipy‑0.18.1‑cp27‑cp27m‑win32.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/
@Peterl94, probably replace matplotlib also?
"fight the good fight"
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by peterl94 »

I think you would only need to do that if the older version of matplotlib uses an API that is not in numpy 1.12. I haven't tested that.

Edit: Just tried a simple test, and matplotlib seemed to work fine.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FreeCAD 0.16 with numpy and scipy in windows?

Post by joha2 »

Thanks guys. For win32 it worked and I integrated your installation procedure into our README.md file.

Best wishes
Johannes
Post Reply