由于 C 核心构建失败,无法安装 igraph
Unable to install igraph due to failing build for the C core
我一直在尝试使用 pip 安装 igraph,但一直失败。
我收到以下错误:
Using cached igraph-0.9.8.tar.gz (3.6 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: texttable>=1.6.2 in c:\msys64\mingw64\lib\python3.9\site-packages (from igraph) (1.6.4)
Building wheels for collected packages: igraph
Building wheel for igraph (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\HP\AppData\Local\Temp\pip-wheel-6pxfcwpb'
cwd: C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\
Complete output (65 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\clustering.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\configuration.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\cut.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\datatypes.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\formula.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\layout.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\matching.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\operators.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\sparse_matrix.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\statistics.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\summary.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\utils.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\version.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\__init__.py -> build\lib.mingw_x86_64-3.9\igraph
creating build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\shell.py -> build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\app
creating build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\baseclasses.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\colors.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\coord.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\edge.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\graph.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\metamagic.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\shapes.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\text.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\utils.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\vertex.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
creating build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\gephi.py -> build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\remote
running build_ext
running build_c_core
-- Building for: NMake Makefiles
-- Setting build type to 'Release' as none was specified.
-- Version number: 0.9.4-24-gb29e741ea
CMake Error at CMakeLists.txt:30 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/HP/AppData/Local/Temp/pip-install-nrm8rlun/igraph_85a609eb9b2b457aa62af06569648cc8/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
We are going to build the C core of igraph.
Source folder: vendor\source\igraph
Build folder: vendor\build\igraph
Install folder: vendor\install\igraph
Configuring build...
Build failed for the C core of igraph.
----------------------------------------
ERROR: Failed building wheel for igraph
Running setup.py clean for igraph
Failed to build igraph
Installing collected packages: igraph
Running setup.py install for igraph ... error
ERROR: Command errored out with exit status 1:
command: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HP\AppData\Local\Temp\pip-record-vzu8m8eh\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\msys64\mingw64\include\python3.9\igraph'
cwd: C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\
Complete output (65 lines):
running install
C:\msys64\mingw64\lib\python3.9\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\clustering.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\configuration.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\cut.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\datatypes.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\formula.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\layout.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\matching.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\operators.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\sparse_matrix.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\statistics.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\summary.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\utils.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\version.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\__init__.py -> build\lib.mingw_x86_64-3.9\igraph
creating build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\shell.py -> build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\app
creating build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\baseclasses.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\colors.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\coord.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\edge.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\graph.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\metamagic.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\shapes.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\text.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\utils.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\vertex.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
creating build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\gephi.py -> build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\remote
running build_ext
running build_c_core
-- Version number: 0.9.4-24-gb29e741ea
CMake Error at CMakeLists.txt:30 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/HP/AppData/Local/Temp/pip-install-nrm8rlun/igraph_85a609eb9b2b457aa62af06569648cc8/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
We are going to build the C core of igraph.
Source folder: vendor\source\igraph
Build folder: vendor\build\igraph
Install folder: vendor\install\igraph
Configuring build...
Build failed for the C core of igraph.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HP\AppData\Local\Temp\pip-record-vzu8m8eh\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\msys64\mingw64\include\python3.9\igraph' Check the logs for full command output.
问题与构建igraph的C核心有关。我应该采取什么步骤来解决这个错误?
我的系统信息(如果相关):
- 惠普馆 14
- 英特尔酷睿 i7-1065G7 CPU
- Windows10家21H1 64位
- Python 3.9.7
- 点 21.3.1
tl;dr 使用 Windows 的官方 Python 发行版,或使用 Anaconda。
你不应该将 python-igraph 与 MSYS2 中包含的 Python 一起使用,除非你有充分的理由。此 Python 与 Windows 上的官方 Python 发行版不兼容,这意味着您将无法从 PyPI 安装二进制轮子,并且需要从源代码编译所有内容。正如您所发现的,这并不总是微不足道的。
如果您确实有充分的理由将此 Python 与 igraph 一起使用,最简单的方法如下:
- 确保您使用的是 the appropriate subsystem (i.e. you launch the correct terminal)。这里我假设你使用的是 MinGW64。
- 从 MSYS2 安装 igraph C 库:
pacman -S mingw-w64-x86_64-igraph
- 确保您使用的是来自 MSYS2 的
pip
:pacman -S mingw-w64-x86_64-python-pip
- 安装
texttable
:pip install texttable
- 安装
igraph
和link to the existing C library:pip install igraph --install-option="--use-pkg-config"
走这条路,您将踏入未知的水域。预计您将需要自己解决的问题。
我一直在尝试使用 pip 安装 igraph,但一直失败。 我收到以下错误:
Using cached igraph-0.9.8.tar.gz (3.6 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: texttable>=1.6.2 in c:\msys64\mingw64\lib\python3.9\site-packages (from igraph) (1.6.4)
Building wheels for collected packages: igraph
Building wheel for igraph (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\HP\AppData\Local\Temp\pip-wheel-6pxfcwpb'
cwd: C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\
Complete output (65 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\clustering.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\configuration.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\cut.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\datatypes.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\formula.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\layout.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\matching.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\operators.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\sparse_matrix.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\statistics.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\summary.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\utils.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\version.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\__init__.py -> build\lib.mingw_x86_64-3.9\igraph
creating build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\shell.py -> build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\app
creating build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\baseclasses.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\colors.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\coord.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\edge.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\graph.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\metamagic.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\shapes.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\text.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\utils.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\vertex.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
creating build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\gephi.py -> build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\remote
running build_ext
running build_c_core
-- Building for: NMake Makefiles
-- Setting build type to 'Release' as none was specified.
-- Version number: 0.9.4-24-gb29e741ea
CMake Error at CMakeLists.txt:30 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/HP/AppData/Local/Temp/pip-install-nrm8rlun/igraph_85a609eb9b2b457aa62af06569648cc8/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
We are going to build the C core of igraph.
Source folder: vendor\source\igraph
Build folder: vendor\build\igraph
Install folder: vendor\install\igraph
Configuring build...
Build failed for the C core of igraph.
----------------------------------------
ERROR: Failed building wheel for igraph
Running setup.py clean for igraph
Failed to build igraph
Installing collected packages: igraph
Running setup.py install for igraph ... error
ERROR: Command errored out with exit status 1:
command: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HP\AppData\Local\Temp\pip-record-vzu8m8eh\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\msys64\mingw64\include\python3.9\igraph'
cwd: C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\
Complete output (65 lines):
running install
C:\msys64\mingw64\lib\python3.9\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\clustering.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\configuration.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\cut.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\datatypes.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\formula.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\layout.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\matching.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\operators.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\sparse_matrix.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\statistics.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\summary.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\utils.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\version.py -> build\lib.mingw_x86_64-3.9\igraph
copying src\igraph\__init__.py -> build\lib.mingw_x86_64-3.9\igraph
creating build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\shell.py -> build\lib.mingw_x86_64-3.9\igraph\app
copying src\igraph\app\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\app
creating build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\baseclasses.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\colors.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\coord.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\edge.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\graph.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\metamagic.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\shapes.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\text.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\utils.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\vertex.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
copying src\igraph\drawing\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\drawing
creating build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\gephi.py -> build\lib.mingw_x86_64-3.9\igraph\remote
copying src\igraph\remote\__init__.py -> build\lib.mingw_x86_64-3.9\igraph\remote
running build_ext
running build_c_core
-- Version number: 0.9.4-24-gb29e741ea
CMake Error at CMakeLists.txt:30 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/HP/AppData/Local/Temp/pip-install-nrm8rlun/igraph_85a609eb9b2b457aa62af06569648cc8/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
We are going to build the C core of igraph.
Source folder: vendor\source\igraph
Build folder: vendor\build\igraph
Install folder: vendor\install\igraph
Configuring build...
Build failed for the C core of igraph.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\msys64\mingw64\bin\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"'; __file__='"'"'C:\Users\HP\AppData\Local\Temp\pip-install-nrm8rlun\igraph_85a609eb9b2b457aa62af06569648cc8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\HP\AppData\Local\Temp\pip-record-vzu8m8eh\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\msys64\mingw64\include\python3.9\igraph' Check the logs for full command output.
问题与构建igraph的C核心有关。我应该采取什么步骤来解决这个错误?
我的系统信息(如果相关):
- 惠普馆 14
- 英特尔酷睿 i7-1065G7 CPU
- Windows10家21H1 64位
- Python 3.9.7
- 点 21.3.1
tl;dr 使用 Windows 的官方 Python 发行版,或使用 Anaconda。
你不应该将 python-igraph 与 MSYS2 中包含的 Python 一起使用,除非你有充分的理由。此 Python 与 Windows 上的官方 Python 发行版不兼容,这意味着您将无法从 PyPI 安装二进制轮子,并且需要从源代码编译所有内容。正如您所发现的,这并不总是微不足道的。
如果您确实有充分的理由将此 Python 与 igraph 一起使用,最简单的方法如下:
- 确保您使用的是 the appropriate subsystem (i.e. you launch the correct terminal)。这里我假设你使用的是 MinGW64。
- 从 MSYS2 安装 igraph C 库:
pacman -S mingw-w64-x86_64-igraph
- 确保您使用的是来自 MSYS2 的
pip
:pacman -S mingw-w64-x86_64-python-pip
- 安装
texttable
:pip install texttable
- 安装
igraph
和link to the existing C library:pip install igraph --install-option="--use-pkg-config"
走这条路,您将踏入未知的水域。预计您将需要自己解决的问题。