【发布时间】:2019-07-15 23:17:23
【问题描述】:
我正在尝试在 anaconda 环境 AutoSKLearn 中安装 autosklearn,之后我正在使用 jupyter notebook 并尝试 import autosklearn.classification 但我收到此错误,“ValueError:numpy.ufunc 大小已更改,可能表示二进制不兼容。预期216 来自 C 标头,192 来自 PyObject”。我该如何解决这个错误?
【问题讨论】:
我正在尝试在 anaconda 环境 AutoSKLearn 中安装 autosklearn,之后我正在使用 jupyter notebook 并尝试 import autosklearn.classification 但我收到此错误,“ValueError:numpy.ufunc 大小已更改,可能表示二进制不兼容。预期216 来自 C 标头,192 来自 PyObject”。我该如何解决这个错误?
【问题讨论】:
尝试:
conda install -c conda-forge auto-sklearn
【讨论】:
**** 如何在 Mac OS Big Sur 11.2.1 和 gcc 10.2.04 上安装 auto-sklearn 和 pyrtr ****
这就是我在 Anaconda 3 下的 Mac OS Big Sur 上成功安装 auto-sklearn 的方法
瓶颈是使用最新的 gcc 编译器来安装 pyrfr,它是 auto-sklearn 的依赖项,以及其他一些东西。 在 Mac OS 上,C++ 和 dev 工具是通过 xcode-select 安装的,而 C++ 编译器的默认版本不是我们需要的(参考这个thread):
gcc --version
默认是 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
首先,确保所有内容都已更新:
xcode-select --install
酿造更新 冲泡升级 酿造信息 gcc 酿造安装 gcc 冲泡清理 酿造医生
并且也更新 conda,以防万一:
conda 更新 -n 基础 conda 康达更新--全部
(“conda install gcc”对我不起作用,就像一些线程建议的那样,“conda config --set restore_free_channel true”也没有帮助) 如果“冻结”
conda update -prefix /opt/anaconda3 anaconda
但是“brew install gcc”为我安装了 gcc,现在我们只需要在 ~/.zshrc(或 ~/.bash_profile 或 ~/.bashrc,如果你还没有切换到使用 zsh,它是较新的 Mas OS 中的默认值)
酿造 gcc 信息 gcc:稳定 10.2.0(瓶装),HEAD GNU 编译器集合 https://gcc.gnu.org/ /usr/local/Cellar/gcc/10.2.0_4
建议,我的 gcc 现在在 /usr/local/Cellar/gcc/10.2.0_4/bin/gcc-10 查看: /usr/local/Cellar/gcc/10.2.0_4/bin/gcc-10 -v
制作别名:
vi ~/.zshrc 添加别名 别名 gcc="/usr/local/Cellar/gcc/10.2.0_4/bin/gcc-10" 源码~/.zshrc
现在,继续安装:
brew install swig 点安装延迟导入 pip install pyrfr --no-cache-dir pip install auto-sklearn --no-cache-dir
完成!
也许,这会有所帮助:
pip 卸载 pyrfr auto-sklearn 卷曲https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 点安装 CC=/usr/local/Cellar/gcc/10.2.0_4/bin/gcc-10 pip installlazy-import pyrfr auto-sklearn --no-cache-dir
或者,如果你设法在 Anaconda3 中安装了 gcc:
pip 卸载 pyrfr auto-sklearn 卷曲https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 点安装 CC=/Users//opt/anaconda3/bin/gccpip install pyrfr auto-sklearn --no-cache-dir
也许,你需要重新安装auto-sklearn,然后
pip install autosklearn --no-cache-dir --force-reinstall -I --no-deps --upgrade
可能有助于实现目标的其他资源: https://medium.com/@dvdasari/install-latest-gcc-on-mac-os-x-b4ce9a66a184 http://www-scf.usc.edu/~csci104/installation/gccmac.html https://github.com/automl/auto-sklearn/issues/155
【讨论】:
根据 autosklearn 文档,它不会在 windows 上正式支持,
auto-sklearn relies heavily on the Python module resource. resource is part of Python’s Unix Specific Services and not available on a Windows machine. Therefore, it is not possible to run auto-sklearn on a Windows machine.
Possible solutions (not tested):
Windows 10 bash shell
virtual machine
docker image
【讨论】:
一切都在解释here。
Anaconda 安装
Anaconda 不提供 auto-sklearn,也没有 conda 包 用于自动 sklearn。因此,最容易安装 auto-sklearn 为 在安装 auto-sklearn 一节中有详细说明。最近的 Linux 发行版下的一个常见安装问题是 用于编译 Python 的编译器版本不兼容 AnaConda 提供的二进制文件和安装的编译器 分配。这可以通过安装 gcc 编译器来解决 随 AnaConda(以及 swig)一起提供:
conda install gxx_linux-64 gcc_linux-64 swig
【讨论】: