3

I wrote a script using andaconda2 python2.7, and wxpython, matplotlib, skimage, numpy. After using pyinstaller to generate an executable files. the total size is almost 700 mb. it feels too large. Someone said because numpy uses MKL which is very large ~ 400 mb as I saw in folder. so I wonder how to create an environment using numpy nomkl? Or if anyone has experience to reduce the size of executable files using pyinstaller, please let me know. BTW, I tried py2exe. it creates a much smaller folder, but somehow the exe doesn't work.

Thanks!

Forrest
  • 51
  • 1
  • 9
  • Does this answer your question? [Tutorial for installing numpy with OpenBLAS on Windows](https://stackoverflow.com/questions/45722188/tutorial-for-installing-numpy-with-openblas-on-windows) – Thomas Jun 13 '21 at 10:01

1 Answers1

5

I think the canonical way would be:

conda create -n new_env nomkl numpy scipy ...

But depending on your OS, it might be possible that there is no nomkl distribution available (windows?).

Example-quote from here:

On Windows, we have always been linking against MKL. However, with the Anaconda 2.5 release we separated the MKL runtime into its own conda package, in order to things uniformly on all platforms.

Some more relevant discussion might be this

Edit: official blog-post pointing out: the nomkl package is not available on Windows (2/2016)

Edit 2: And even Gohlke nowadays only provide MKL-based windows-binaries.

Edit 3: So if all you need is a numpy-distribution without MKL, you can use these official wheels which are linked against OpenBLAS instead of MKL.

In general you can create a new env:

conda create -n wheel_based python
activate wheel
pip install numpy-1.13.3-cp36-none-win_amd64.whl  # or whatever the file is named

There are two problems still:

  • which anaconda-builds will work with non-MKL numpy
  • will anaconda (probably because of point 1) try to overwrite this numpy-install?

There is some discussion here.

It might be advisable to not use anaconda for this very specific use-case if you are able to install your remaining dependencies. Scipy (usually the most pain) now has windows-builds (1.0 beta).

sascha
  • 32,238
  • 6
  • 68
  • 110
  • Thanks for quick response. yes I am using windows. and from the discussion you linked, it still didn't clearly have a solution for windows to use nomkl numpy. I am using anaconda 4.3.27. – Forrest Oct 09 '17 at 23:37
  • 1
    I think the conda forge version comes linked against OpenBLAS: `conda create -n new_env -c conda-forge numpy`. – Daniel Oct 10 '17 at 01:57
  • @Daniel Are you sure (i hope so)? [This discussion](https://github.com/conda-forge/numpy-feedstock/issues/46) is a bit ambiguous. – sascha Oct 10 '17 at 02:20
  • @sascha I am absolutely not sure :) I just know that Linux and OSX come with OpenBLAS. Whatever Windows has, its likely *not* MKL, thats about as far as I can guess. – Daniel Oct 10 '17 at 14:32
  • Well... i read my links as: it's very likely MKL-only on windows. – sascha Oct 10 '17 at 21:28
  • I just installed numpy linked against OpenBlas on windows by doing as Daniel suggested. - it works :) – balletpiraat Oct 19 '18 at 21:39