如何使用numpy nomkl在anaconda中创建环境? [英] how to create an environment in anaconda with numpy nomkl?

查看:325
本文介绍了如何使用numpy nomkl在anaconda中创建环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用andaconda2 python2.7和wxpython,matplotlib,skimage,numpy编写了一个脚本. 使用pyinstaller生成可执行文件后.总大小将近700 mb.感觉太大了. 有人说,因为numpy使用的MKL非常大,如我在文件夹中所见,约为400 mb.所以我想知道如何使用numpy nomkl创建环境? 或者,如果有人有使用pyinstaller减少可执行文件大小的经验,请告诉我. 顺便说一句,我尝试了py2exe.它会创建一个更小的文件夹,但不知该exe无法正常工作.

谢谢!

解决方案

我认为规范的方式是:

conda create -n new_env nomkl numpy scipy ...

但是根据您的操作系统,可能没有可用的nomkl发行版(Windows?).

此处的示例引用:

在Windows上,我们一直在与MKL链接.但是,在Anaconda 2.5版本中,我们将MKL运行时分成了自己的conda程序包,以便在所有平台上统一运行.

更多相关的讨论可能是

编辑: Gohlke 如今也仅提供基于MKL的Windows二进制文件. /p>

修改3: 因此,如果您只需要一个没有MKL的numpy发行版,则可以使用这些官方工具是与OpenBLAS而非MKL关联的.

通常,您可以创建一个新的环境:

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

仍然有两个问题:

  • 哪一个anaconda-builds可以与非MKL numpy一起使用
  • anaconda(可能由于第1点)会尝试覆盖此numpy安装吗?

此处.

如果能够安装其余的依赖项,建议不要在该非常特殊的用例中使用anaconda. Scipy(通常是最痛苦的)现在具有Windows构建(1.0 beta).

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!

解决方案

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

这篇关于如何使用numpy nomkl在anaconda中创建环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆