Installation issue with epanet toolkit - python package

I am new to Python and tried to install the epanet toolkit python package, but failed to install.

I have tried ‘pip install owa-epanet’ first then received the error for scikit-build not found.
Then I tried ‘pip install scikit-build’ and ‘pip install cmake’ to solve the error.

But now I am stuck in the error shown in the figure when building wheels for the package. It seems that Visual Studio is required for building wheels in Python 3.8.

Not sure any other ways to get the package installed.

Would appreciate a lot if anyone has any advice.

Hi Jason, I’ve had similar experiences as owa-epanet has a few dependencies that need to be installed first. From your screenshot, skbuild is not present, so you’ll need to add that. As you said, you’ll also need to instal visual studio and swig.

It’s a bit of a faff, but it will build eventually.

Best,
Gareth

Thanks Gareth for your reply.

I have installed those packages above as well as Visual Studio. But I am still having errors below:

(base) D:\Python Projects\EPANET>pip install owa-epanet
Collecting owa-epanet
Using cached owa-epanet-2.2.3.tar.gz (800 kB)
Building wheels for collected packages: owa-epanet
Building wheel for owa-epanet (setup.py) … error
ERROR: Command errored out with exit status 1:
command: ‘d:\miniconda3\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\qzhao4\AppData\Local\Temp\pip-install-3fh3agz_\owa-epanet_92c43eb6cc0d4f60ab077f9c173c0ac
f\setup.py’"’"’; file=’"’"‘C:\Users\qzhao4\AppData\Local\Temp\pip-install-3fh3agz_\owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf\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\qzhao4\AppData\Local\Temp\pip-wheel-tczhhkxs’
cwd: C:\Users\qzhao4\AppData\Local\Temp\pip-install-3fh3agz_\owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf
Complete output (153 lines):


– Trying “Ninja (Visual Studio 15 2017 Win64 v141)” generator







Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
– Configuring incomplete, errors occurred!
See also “C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz_/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log”.







– Trying “Ninja (Visual Studio 15 2017 Win64 v141)” generator - failure


– Trying “Visual Studio 15 2017 Win64 v141” generator







Not searching for unused variables given on the command line.
CMake Error at CMakeLists.txt:2 (PROJECT):
Generator

  Visual Studio 15 2017 Win64

could not find any instance of Visual Studio.

– Configuring incomplete, errors occurred!
See also “C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz_/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log”.







– Trying “Visual Studio 15 2017 Win64 v141” generator - failure


– Trying “NMake Makefiles (Visual Studio 15 2017 Win64 v141)” generator







Not searching for unused variables given on the command line.
– The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:

  cl

is not a full path and was not found in the PATH.

To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line.  This environment is
unable to invoke the cl compiler.  To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.

– Configuring incomplete, errors occurred!
See also “C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz_/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz
/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/_cmake_test_compile/build/CMakeFiles/CMakeError.log”.







– Trying “NMake Makefiles (Visual Studio 15 2017 Win64 v141)” generator - failure


– Trying “NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)” generator







Not searching for unused variables given on the command line.
– The C compiler identification is unknown
CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
The CMAKE_C_COMPILER:

  cl

is not a full path and was not found in the PATH.

To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line.  This environment is
unable to invoke the cl compiler.  To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.

– Configuring incomplete, errors occurred!
See also “C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz_/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/qzhao4/AppData/Local/Temp/pip-install-3fh3agz
/owa-epanet_92c43eb6cc0d4f60ab077f9c173c0acf/_cmake_test_compile/build/CMakeFiles/CMakeError.log”.







– Trying “NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)” generator - failure


scikit-build could not get a working generator for your system. Aborting build.

Building windows wheels for Python 3.8 requires Microsoft Visual Studio 2017.
Get it with “Visual Studio 2017”:

https://visualstudio.microsoft.com/vs/


ERROR: Failed building wheel for owa-epanet
Running setup.py clean for owa-epanet
Failed to build owa-epanet

Still looking for solutions.

Thanks again,
Jason

have you installed the C/C++ compiler for visual studio? it’s not a default option. The easiest way to check is load up visual studio and see if you can create a c++ project.

Hi Gareth, thank you very much. Following your advice, I have installed the C/C++ compiler for VS 2019 community version. But still the same error message as above.

I have solved the error by installing Visual Studio 2017 rather than 2019 which I had been using. I did not uninstall VS 2019 by the way. I am using Python 3.8 and windows 10

Just in case other new users may find similar errors, things I did after ‘pip install owa-epanet’ include:

Thanks again for all useful information and help.
Jason

Hi Jason,
Glad to hear everything is working for you. I had exactly the same issues with vs2019 vs. vs2017 and it looks like vs2019 is producing make scripts that are broken (hence the no build).

I don’t think the vs buildtool is necessary as vs2017 community + c/c++ compiler should address all of the functional requirements.
SWIG is absolutely necessary as it wraps the c-epanet code into python and there’s a couple of environment variables that need to be set in windows, though I think this is covered in the swig website.
CMake is also necessary to build the epanet library from C.

Best,
Gareth.