【问题标题】:install lightfm on windows在 Windows 上安装 lightfm
【发布时间】:2017-03-24 18:37:15
【问题描述】:

我已经尝试了几天来实现这一目标。所以请接受任何建议。我试图在我的 Windows 上安装 lightfm,但我一直在报这个错误

Collecting lightfm
  Using cached lightfm-1.12.tar.gz
Requirement already satisfied: numpy in c:\users\hp\appdata\local\programs\python\python35\lib\site-packages (from light
fm)
Requirement already satisfied: scipy>=0.17.0 in c:\users\hp\appdata\local\programs\python\python35\lib\site-packages (fr
om lightfm)
Requirement already satisfied: requests in c:\users\hp\appdata\local\programs\python\python35\lib\site-packages (from li
ghtfm)
Building wheels for collected packages: lightfm
  Running setup.py bdist_wheel for lightfm ... error
  Complete output from command c:\users\hp\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, t
okenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-gao0_4o3\\lightfm\\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\hp\AppData\Local\Temp\tmpvva8cxrepip-wheel- --python-tag cp35:
  Compiling without OpenMP support.
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.5
  creating build\lib.win-amd64-3.5\lightfm
  copying lightfm\evaluation.py -> build\lib.win-amd64-3.5\lightfm
  copying lightfm\lightfm.py -> build\lib.win-amd64-3.5\lightfm
  copying lightfm\_lightfm_fast.py -> build\lib.win-amd64-3.5\lightfm
  copying lightfm\__init__.py -> build\lib.win-amd64-3.5\lightfm
  creating build\lib.win-amd64-3.5\lightfm\datasets
  copying lightfm\datasets\movielens.py -> build\lib.win-amd64-3.5\lightfm\datasets
  copying lightfm\datasets\stackexchange.py -> build\lib.win-amd64-3.5\lightfm\datasets
  copying lightfm\datasets\_common.py -> build\lib.win-amd64-3.5\lightfm\datasets
  copying lightfm\datasets\__init__.py -> build\lib.win-amd64-3.5\lightfm\datasets
  copying lightfm\_lightfm_fast_no_openmp.c -> build\lib.win-amd64-3.5\lightfm
  copying lightfm\_lightfm_fast_openmp.c -> build\lib.win-amd64-3.5\lightfm
  running build_ext
  building 'lightfm._lightfm_fast_no_openmp' extension
  creating build\temp.win-amd64-3.5
  creating build\temp.win-amd64-3.5\Release
  creating build\temp.win-amd64-3.5\Release\lightfm
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\u
sers\hp\appdata\local\programs\python\python35\include -Ic:\users\hp\appdata\local\programs\python\python35\include "-IC
:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10
240.0\ucrt" /Tclightfm/_lightfm_fast_no_openmp.c /Fobuild\temp.win-amd64-3.5\Release\lightfm/_lightfm_fast_no_openmp.obj
 -ffast-math -march=native
  cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
  cl : Command line warning D9002 : ignoring unknown option '-march=native'
  _lightfm_fast_no_openmp.c
  c:\users\hp\appdata\local\programs\python\python35\include\pyconfig.h(243): fatal error C1083: Cannot open include fil
e: 'basetsd.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit st
atus 2

  ----------------------------------------
  Failed building wheel for lightfm
  Running setup.py clean for lightfm
  Complete output from command c:\users\hp\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, t
okenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-gao0_4o3\\lightfm\\setup.py';f=getattr(tokenize, 'open'
, open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Compiling without OpenMP support.
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: option --all not recognized

  ----------------------------------------
  Failed cleaning build dir for lightfm
Failed to build lightfm
Installing collected packages: lightfm
  Running setup.py install for lightfm ... error
    Complete output from command c:\users\hp\appdata\local\programs\python\python35\python.exe -u -c "import setuptools,
 tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-gao0_4o3\\lightfm\\setup.py';f=getattr(tokenize, 'ope
n', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --recor
d C:\Users\hp\AppData\Local\Temp\pip-eybv98gb-record\install-record.txt --single-version-externally-managed --compile:
    Compiling without OpenMP support.
    running install
    running build
    running build_py
    running build_ext
    building 'lightfm._lightfm_fast_no_openmp' extension
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:
\users\hp\appdata\local\programs\python\python35\include -Ic:\users\hp\appdata\local\programs\python\python35\include "-
IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.
10240.0\ucrt" /Tclightfm/_lightfm_fast_no_openmp.c /Fobuild\temp.win-amd64-3.5\Release\lightfm/_lightfm_fast_no_openmp.o
bj -ffast-math -march=native
    cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
    cl : Command line warning D9002 : ignoring unknown option '-march=native'
    _lightfm_fast_no_openmp.c
    c:\users\hp\appdata\local\programs\python\python35\include\pyconfig.h(243): fatal error C1083: Cannot open include f
ile: 'basetsd.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit
status 2

    ----------------------------------------
Command "c:\users\hp\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\
Users\\hp\\AppData\\Local\\Temp\\pip-build-gao0_4o3\\lightfm\\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\hp\AppData\Lo
cal\Temp\pip-eybv98gb-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1
in C:\Users\hp\AppData\Local\Temp\pip-build-gao0_4o3\lightfm\

我已经安装了 microsoft visual c++ 14 甚至 miniconda 但仍然是同样的错误。欢迎任何建议。在此先感谢

【问题讨论】:

  • 安装时在windows上编译python包是轮盘赌。我通常会下载 Windows 预制轮子。不幸的是,这似乎不存在(还)

标签: python windows failed-installation


【解决方案1】:

试试这个选项:

$ conda install -c conda-forge lightfm

【讨论】:

    【解决方案2】:

    您是尝试通过 pip 还是通过其 Git 存储库安装它?

    他们的documentation 表示:

    使用 pip 从 pypi 安装:pip install lightfm。一切都应该 在 Linux、使用 Homebrew Python 的 OSX 和 Windows 上开箱即用 使用 Miniconda。

    您是否使用了适合操作系统的包管理器?您确定它应该与您似乎正在使用的 python3.5 一起使用吗?

    另外请注意their git-page,似乎只有 Linux 操作系统完全通过,其他主要操作系统(macOS en Windows)没有..这让我相信 pip-install 可能仍然不稳定。也许您可以尝试开发安装提示?或者在 Git 上提出问题。

    【讨论】:

    • 感谢您的回复。我已经尝试使用 pip install lightfm 这就是导致该错误的原因,我也尝试了开发安装提示但仍然没有运气,并且他们的 Git 存储库中存在类似的问题
    • 好吧,你显然错过了basetsd.h.. 谷歌搜索似乎指向它是一个 Visual Studio 文件,也许你可以尝试重新安装 Visual Studio,看看它是否有帮助.. 如果这无济于事,也许您可​​以尝试自己编译该软件,因为它是开源的。否则.. 我猜在他们的 Git 上提交问题是你最好的选择。
    • 啊,不用等待.. 您的错误消息还指出它在包含短语 import setuptools 的命令上失败。所以也许你可以先试试pip install setuptools!我以前见过这解决了类似的错误。
    • 非常感谢您指出我会尝试重新安装 Visual Studio 的方向,如果它不起作用,那么我会在他们的 git 上提出问题
    • Ps:当您使用 python3.5 时,您最好的选择实际上是pip3 install setuptools,然后是pip3 install lightfm。在某些系统/设置上,您甚至可以执行 pip35
    【解决方案3】:

    在 Windows 操作系统上,我遇到了与您相同的问题。尝试使用 conda 安装软件包,方法是运行以下命令之一:

    conda install -c conda-forge lightfm

    conda install -c conda-forge/label/gcc7 lightfm

    conda install -c conda-forge/label/cf201901 lightfm

    第三个命令行对我有用。

    【讨论】:

      猜你喜欢
      • 2021-06-21
      • 1970-01-01
      • 2011-06-10
      • 2014-06-26
      • 2016-06-05
      • 2013-12-25
      • 2018-06-16
      • 2018-09-29
      • 2014-02-07
      相关资源
      最近更新 更多