【问题标题】:Failed building wheel for spacyspacy 的造轮子失败
【发布时间】:2017-09-08 07:29:08
【问题描述】:

我正在尝试通过为 python 版本 3.6.1 运行 pip install spacy 来安装 spacy,但我不断收到如下错误,如何解决这个问题?以前我遇到 cl.exe not found 错误,之后我在 cl.exe 存在的环境变量中添加了 Visual Studio 路径。

     Failed building wheel for spacy
  Running setup.py clean for spacy
  Running setup.py bdist_wheel for murmurhash ... error
  Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpa6tzdkovpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
----------------------------------------
  Failed building wheel for murmurhash
  Running setup.py clean for murmurhash
  Running setup.py bdist_wheel for cymem ... error
  Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\cymem\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpz7p6hkiwpip-wheel- --python-tag cp36:

 ----------------------------------------
  Failed building wheel for cymem
  Running setup.py clean for cymem
  Running setup.py bdist_wheel for preshed ... error
  Complete output from command c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\preshed\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\SH0042~1\AppData\Local\Temp\tmpwppgmyp9pip-wheel- --python-tag cp36:

  ----------------------------------------
  Failed building wheel for preshed
  Running setup.py clean for preshed
  Running setup.py bdist_wheel for thinc ... error
 ----------------------------------------
  Failed building wheel for thinc
  Running setup.py clean for thinc
  Running setup.py bdist_wheel for ujson ... error
  ----------------------------------------
  Failed building wheel for ujson
  Running setup.py clean for ujson
  Running setup.py bdist_wheel for cytoolz ... error
  ----------------------------------------
  Failed building wheel for cytoolz
  Running setup.py clean for cytoolz
Failed to build spacy murmurhash cymem preshed thinc ujson cytoolz
Installing collected packages: murmurhash, cymem, preshed, wrapt, tqdm, toolz, cytoolz, plac, pyreadline, dill, termcolor, pathlib, thinc, ujson, regex, spacy
  Running setup.py install for murmurhash ... error

   C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -IC:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\murmurhash\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include -Ic:\users\sh00428701\appdata\local\programs\python\python36\include /EHsc /Tpmurmurhash/mrmr.cpp /Fobuild\temp.win-amd64-3.6\Release\murmurhash/mrmr.obj /Ox /EHsc
    mrmr.cpp
    c1xx: fatal error C1083: Cannot open source file: 'murmurhash/mrmr.cpp': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\sh00428701\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\SH0042~1\\AppData\\Local\\Temp\\pip-build-joi6voav\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SH0042~1\AppData\Local\Temp\pip-_j1cxej1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SH0042~1\AppData\Local\Temp\pip-build-joi6voav\murmurhash\

【问题讨论】:

    标签: python scipy pip python-wheel spacy


    【解决方案1】:

    对我来说,pip install --no-cache-dir spacy 工作

    【讨论】:

    • 太棒了!我花了几个小时试图弄清楚这一点。这条简单的小线使我免于理智。谢谢!
    • 如果由于 /tmp 卷空间不足而导致安装失败的正确解决方案
    【解决方案2】:

    几个想法:

    【讨论】:

    • 第一个选项适用于 Windows 64 位 python 2.7。请注意,您还需要 cytoolz 和 ujson 来自:lfd.uci.edu/~gohlke/pythonlibs
    • 老兄,你刚刚救了我的命。非常感谢
    • 什么是 mac 替代品?
    • 什么是 Raspbian/Linux 替代方案?
    【解决方案3】:

    我安装了这些软件包,然后它就可以工作了:

    sudo apt-get install python-dev 
    sudo apt-get install python3-dev 
    sudo apt-get install libevent-dev
    

    【讨论】:

    • 什么是 Windows 等价物?
    • yum RHEL 的等价物
    • 这是 ubuntu 的吗?
    • 在 Windows 上,您可以使用 Cygwin 的安装程序(如果您已经拥有 Cygwin,只需重新运行它)来添加这些软件包
    【解决方案4】:

    这对我有用:

    # Note, use sudo. I'm in a docker image, so i dont need it.
    
    # install dev libs
    apt-get install python-dev -y && \
    apt-get install python3-dev -y && \
    apt-get install libevent-dev -y && \
    
    # install new gcc
    apt-get update && \
    apt-get install build-essential software-properties-common -y && \
    add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
    apt-get update && \
    apt-get install gcc-snapshot -y && \
    apt-get update && \
    apt-get install gcc-6 g++-6 -y && \
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
    apt-get install gcc-4.8 g++-4.8 -y && \
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
    

    https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91

    【讨论】:

    • 根据反馈更新。
    【解决方案5】:

    conda install -c conda-forge spacy 为我工作。我有 Windows 10 和 Python 3.5.3 :: Anaconda custom (64-bit)

    【讨论】:

      【解决方案6】:

      如果您使用的是 Ubuntu,请执行此操作

      sudo apt-get install build-essential python-dev git
      

      现在通过

      安装 spacy
      pip install -U spacy
      

      【讨论】:

        【解决方案7】:

        从 Gihub 源下载并安装。这是链接:https://github.com/explosion/spaCy

        使用这些命令:

        python -m pip install -U pip venv              # update pip & virtualenv
        git clone https://github.com/explosion/spaCy   # clone spaCy
        cd spaCy                                       # navigate into directory
        
        venv .env                                      # create environment in .env
        source .env/bin/activate                       # activate virtual environment
        export PYTHONPATH=`pwd`                        # set Python path to spaCy directory
        pip install -r requirements.txt                # install all requirements
        python setup.py build_ext --inplace            # compile spaCy
        

        如果不使用虚拟环境,请随意使用最后两个命令。关注官方文档here

        【讨论】:

          【解决方案8】:

          如果您将它与手动安装的 python3.6 一起使用并尝试在 3.6 环境中安装,那么您可能缺少 python3.6-dev

          sudo apt-get install python3.6-dev
          

          也许

          sudo apt-get install gcc
          

          这是对特定情况的回答。

          【讨论】:

          • 基于我假设操作使用 Windows 的问题。所以这可能对 OP 没有帮助。
          • 我同意。答案是给像我这样来搜索的人的。
          【解决方案9】:

          yum -y groupinstall 开发

          为我工作

          【讨论】:

            【解决方案10】:

            Spacy 需要 64 位 python。

            卸载 32 位。 安装 64 位 python。

            再次尝试 spacy 安装。

            【讨论】:

              【解决方案11】:

              对于在Ubuntu 中寻找spacy 2.XPython 3.8 答案的任何人,我遇到了同样的问题。我正在使用venv。由于其他答案还不够,我写了解决我问题的解决方案。

              1. 安装其他答案中提到的所需库:
              sudo apt-get install python3-dev libevent-dev build-essential gcc g++
              pip install setuptools wheel
              
              1. 更新 pip 并安装 cython
              pip install -U pip
              pip install cython
              

              我怀疑将 pip 更新到最新版本解决了我的问题。

              【讨论】:

                【解决方案12】:

                首先,安装这些包并尝试安装 spacy

                sudo apt update
                sudo apt install python3-dev
                sudo apt install libpython3-dev
                sudo apt install python3-devel
                sudo apt-get install libevent-dev
                sudo apt update
                

                【讨论】:

                  猜你喜欢
                  • 2020-12-06
                  • 2019-02-22
                  • 2020-05-12
                  • 2020-05-28
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 2020-06-11
                  • 2018-01-07
                  相关资源
                  最近更新 更多