I want to install METIS for python3.6 on windows7.I did the following steps:
1-Download the source (tar.gz or zip file) from https://pypi.python.org/pypi/networkx-metis/
2-Unpack and change directory to the source directory (it should have the setup.py on top level).
3-Run
python setup.py build
to build
in this step, I encountered the following error:
error: Microsoft Visual C++ 14.0 is required.
i installed "Visual Studio Tools 2017", Then I run the code again. I encountered the following error:
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio
14.0\\VC\\BIN\\cl.exe' failed with exit status 2
I would be very grateful if you answer my questions.
Although what I used was Windows 10, perhaps the same steps as I laid out here may work for you.
First, you should get the python metis wrapper using pip:
pip install metis.Second, you must install conda-metis, which you can find here. Note, it does not require you to install Anaconda to work.
Place the files in conda-metis-master in some file path.
The installation requires some fixes. Make sure you have a recent version of Visual Studios (I used 2017). For me, VS had a problem running the instructions in BUILD-WINDOWS.txt, which landed me on this thread:
Why does MSBuild look in C:\ for Microsoft.Cpp.Default.props instead of c:\Program Files (x86)\MSBuild? ( error MSB4019)
Specifically, the answer For Visual Studio 2017 and 2019 on Windows 10 was what I went with. It could potentially be different for you since you are on Windows 7.
For the python metis package, we need to generate a
metis.dll, not ametis.libfile, so we must also look closer at theCMakeLists.txt(see the Linux version of this discussion here). We add on line 19:set(METIS_LIBRARY_TYPE SHARED).You should follow the BUILD-WINDOWS.txt instructions, but run
.\vsgen -G "Visual Studio 15 2017 Win64"inside your conda-metis file path in command prompt with full permissions instead of using Visual Studio 10.Before moving on to using the files that were generated by the above command in
path_to_your_metis_dir\build\windows\, we need another fix. Following what was said in:rint() issue after creating VS Project using CMake
we have to edit the file
path_to_your_metis_dir\GKlib\gk_arch.hby removing the line:#define rint(x) ((idx_t)((x)+0.5)). (Or the fix listed on this github exchange.)Then go to
path_to_your_metis_dir\build\windows\.Open
METIS.slnin Visual Studios, go to the top toBuildand from the scroll-down go toBuild Solution. Afterwards, the.dllfile will be inpath_to_your_metis_dir\build\windows\libmetis\Release\.Last, we run in command prompt:
set METIS_DLL=path_to_your_metis_dir\build\windows\libmetis\Release\metis.dllAfter this, python metis no longer failed when I would import it into my code with the step
from metis import *.