GithubHelp home page GithubHelp logo

epanet-python's People

Contributors

eladsal avatar galperelman avatar gonccalo avatar mauriziocingi avatar michaeltryby avatar samhatchett avatar samrensenhouse avatar sm-rana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epanet-python's Issues

Water quality analysis error

Hi,
When calling quality analysis functions such as EN.initQ() or EN.runQ() I get the following error:

File "path_to_epamodule.py/epamodule.py", line 624, in ENinitQ
if ierr !=0: raise ENtoolkitError(ierr)
epamodule.ENtoolkitError: Error 105: water quality solver not opened

I'm using Python 3.7 on windows 64 bit

Turn on CI

I need an administrator to turn on Appveyor for this repo. Thanks!

Problem Building on WSL - Ubuntu 18.04

After following the instructions for building, I get the following error when I try to test my build.

ImportError while importing test module '/mnt/c/Users/maxwe/OneDrive/Documents/UpWork/Water/epanet-python/owa-epanet/test/test_owa_epanet.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/home/max/.local/share/virtualenvs/test-CAxsfYHR/lib/python3.7/site-packages/epanet/toolkit.py:14: in swig_import_helper
return importlib.import_module(mname)
/home/max/miniconda3/lib/python3.7/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
:1006: in _gcd_import
???
:983: in _find_and_load
???
:967: in _find_and_load_unlocked
???
:670: in _load_unlocked
???
:583: in module_from_spec
???
:1043: in create_module
???
:219: in _call_with_frames_removed
???
E ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:
test_owa_epanet.py:5: in
import epanet.toolkit as en
/home/max/.local/share/virtualenvs/test-CAxsfYHR/lib/python3.7/site-packages/epanet/toolkit.py:17: in
_toolkit = swig_import_helper()
/home/max/.local/share/virtualenvs/test-CAxsfYHR/lib/python3.7/site-packages/epanet/toolkit.py:16: in swig_import_helper
return importlib.import_module('_toolkit')
/home/max/miniconda3/lib/python3.7/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
E ModuleNotFoundError: No module named '_toolkit'

Do you have any guidance or troubleshooting tips? Please let me know if there's any more information that I can provide that might be helpful.

Local wheel built on Windows many unit tests are failing

Building owa-epanet wheel locally on Windows 10 with Python 3.7 running in Conda env.

The build and install proceed as normal. 21 of 24 unit tests fail when running pytest. Typical error follows

FAILED test/test_owa_epanet.py::test_open - PermissionError: [WinError 32] The process cannot access the file because...

Which parameters should I set to fix the fatal error in the "PDA" mode?

When I use the latest version of owa-epanet to run the hydraulic analysis in the mode of PDA, I encountered a fatal error about pump simulation.

The network contains many leak nodes, which are modelled by emitters. Pumps are used to lift the water in the upstream tank to the downside. The initial status of pumps is OPEN. There are no any control rules for them. During the EPS, the upstream tank is empty, whereas the value of the flow for pumps are positive.

When I use the EPANET 2.2 GUI to run the same network, there are no errors. That is, the flowrate of pump is zero. They are switched closed.

I do not know how to set parameters for this error.

Errors in CMakeLists.txt when building epanet-python package

I am trying to build epanet-python package on my computer.
After running the code: python3 setup.py sdist bdist_wheel, it returned the cmake error at CMakeLists.txt.
The cmake error I encoutered is specified below:

CMake Error at CMakeLists.txt:38 (ADD_SUBDIRECTORY):
  The source directory

    C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/owa-epanet/EPANET

  does not contain a CMakeLists.txt file.

Appreicate a lot if any advices!

Negative pressures warning with net6

I am getting the Exception: WARNING: System has negative pressures. while running
`from epanet.toolkit import toolkit as EN
inpfile = 'Networks/Net6.inp'
rptfile = 'temp.rpt'
binfile = 'temp.bin'

errors = []

ph = EN.proj_create()
errors.append(EN.proj_open(ph, inpfile, rptfile, binfile))
errors.append(EN.hydr_solve(ph))`

This inconsistent with EPANET2 behavior with the same .inp file

Reconfigure to support multiple version of Python

Python Windows Platform Compilers:
Python 2.7 - Visual Studio 9 2008
Python 3.3, 3.4 - Visual Studio 10 2010
Python 3.5, 3.6, 3.7 - Visual Studio 14 2015

Current EPANET benchmark builds on Visual Studio 15 2017

PyQGIS targets Python 3.6
Should we support Python 2.7, 3.3, 3.4?

dmnd_setmodel() type argument is integer

dmnd_setmodel(ph: 'Handle', type: 'int', pmin: 'double', preq: 'double', pexp: 'double') -> "int":

To match the rest of the toolkit wrapper, shouldn't the type of type be EN.DemandModel enum?

Calling EN.dmnd_setmodel(ph, EN.DemandModel.PDA, pmin, preq, pexp) raises
'TypeError: in method 'dmnd_setmodel', argument 2 of type 'int'' in spyder.

Errors on instalation

I've tried doing this

$ python -m pip install owa-epanet --user

and returned this error:

 ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-od5rmipk/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pdma2s/.local/include/python3.8/owa-epanet                                                               
         cwd: /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/                                                                                                                                                 
    Complete output (90 lines):                                                                                                                                                                                                      
                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                     
    --------------------------------------------------------------------------------                                                                                                                                                 
    -- Trying "Ninja" generator                                                                                                                                                                                                      
    --------------------------------                                                                                                                                                                                                 
    ---------------------------                                                                                                                                                                                                      
    ----------------------                                                                                                                                                                                                           
    -----------------                                                                                                                                                                                                                
    ------------                                                                                                                                                                                                                     
    -------                                                                                                                                                                                                                          
    --                                                                                                                                                                                                                               
    Not searching for unused variables given on the command line.                                                                                                                                                                    
    CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):                                                                                                                                                          
      Compatibility with CMake < 2.8.12 will be removed from a future version of                                                                                                                                                     
      CMake.                                                                                                                                                                                                                         
                                                                                                                                                                                                                                     
      Update the VERSION argument <min> value or use a ...<max> suffix to tell                                                                                                                                                       
      CMake that the project does not need compatibility with older versions.                                                                                                                                                        
                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                     
    -- The C compiler identification is GNU 10.2.0                                                                                                                                                                                   
    -- Detecting C compiler ABI info                                                                                                                                                                                                 
    -- Detecting C compiler ABI info - done                                                                                                                                                                                          
    -- Check for working C compiler: /usr/bin/cc - skipped                                                                                                                                                                           
    -- Detecting C compile features                                                                                                                                                                                                  
    -- Detecting C compile features - done                                                                                                                                                                                           
    -- The CXX compiler identification is GNU 10.2.0                                                                                                                                                                                 
    -- Detecting CXX compiler ABI info                                                                                                                                                                                               
    -- Detecting CXX compiler ABI info - done                                                                                                                                                                                        
    -- Check for working CXX compiler: /usr/bin/c++ - skipped                                                                                                                                                                        
    -- Detecting CXX compile features                                                                                                                                                                                                
    -- Detecting CXX compile features - done                                                                                                                                                                                         
    -- Configuring done                                                                                                                                                                                                              
    -- Generating done                                                                                                                                                                                                               
    -- Build files have been written to: /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_cmake_test_compile/build                                                                                             
    --                                                                                                                                                                                                                               
    -------                                                                                                                                                                                                                          
    ------------                                                                                                                                                                                                                     
    -----------------                                                                                                                                                                                                                
    ----------------------                                                                                                                                                                                                           
    ---------------------------                                                                                                                                                                                                      
    --------------------------------                                                                                                                                                                                                 
    -- Trying "Ninja" generator - success                                                                                                                                                                                            
    --------------------------------------------------------------------------------                                                                                                                                                 
                                                                                                                                                                                                                                     
    Configuring Project                                                                                                                                                                                                              
      Working directory:                                                                                                                                                                                                             
        /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_skbuild/linux-x86_64-3.8/cmake-build                                                                                                                  
      Command:                                                                                                                                                                                                                       
        cmake /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71 -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.6 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython3.8.so -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/home/pdma2s/.local/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release                                                                                  
                                                                                                                                                                                                                                     
    -- The C compiler identification is GNU 10.2.0                                                                                                                                                                                   
    -- The CXX compiler identification is GNU 10.2.0                                                                                                                                                                                 
    -- Detecting C compiler ABI info                                                                                                                                                                                                 
    -- Detecting C compiler ABI info - done                                                                                                                                                                                          
    -- Check for working C compiler: /usr/bin/cc - skipped                                                                                                                                                                           
    -- Detecting C compile features                                                                                                                                                                                                  
    -- Detecting C compile features - done                                                                                                                                                                                           
    -- Detecting CXX compiler ABI info                                                                                                                                                                                               
    -- Detecting CXX compiler ABI info - done                                                                                                                                                                                        
    -- Check for working CXX compiler: /usr/bin/c++ - skipped                                                                                                                                                                        
    -- Detecting CXX compile features                                                                                                                                                                                                
    -- Detecting CXX compile features - done                                                                                                                                                                                         
    -- The project is built using scikit-build                                                                                                                                                                                       
    -- Found PythonLibs: /usr/lib/libpython3.8.so (found suitable version "3.8.6", minimum required is "3")                                                                                                                          
    -- Found PythonInterp: /usr/bin/python (found suitable version "3.8.6", minimum required is "3.8.6")
    CMake Error at /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
      Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)
    Call Stack (most recent call first):
      /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:577 (_FPHSA_FAILURE_MESSAGE)
      /usr/share/cmake-3.19/Modules/FindSWIG.cmake:138 (find_package_handle_standard_args)
      CMakeLists.txt:19 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_skbuild/linux-x86_64-3.8/cmake-build/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "/home/pdma2s/.local/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 582, in setup
        env = cmkr.configure(cmake_args,
      File "/home/pdma2s/.local/lib/python3.8/site-packages/skbuild/cmaker.py", line 229, in configure
        raise SKBuildError(
    
    An error occurred while configuring with CMake.
      Command:
        cmake /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71 -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_skbuild/linux-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.6 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython3.8.so -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/home/pdma2s/.local/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release
      Source directory:
        /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71
      Working directory:
        /tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/_skbuild/linux-x86_64-3.8/cmake-build
    Please see CMake's output for more information.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5tonw7z1/owa-epanet_3b448e6abee14f07a6dcbd1b2fbbbe71/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-od5rmipk/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pdma2s/.local/include/python3.8/owa-epanet Check the logs for full command output.

Is there something I can do to fix this issue?

what is the purpose of epanet_python?

sorry for the uber-general issue title, but I can find no other way to express the root question I have.

In the other repo, it looks like epanet_py.c directly wraps and exposes most of the EPANET API, with the addition of an error manager layer. This file is an intermediate API that unpacks error conditions, and then the swig-generated toolkit_wrap.c / toolkit.py paired functions (in this repo) take care of appropriate type conversions and warning/exception throwing.

So the first question is about the interdependencies. In the EPANET repo:

  • epanet_py.c (excluded from normal C build)
  • errormanager.c (excluded from normal C build)
  • BUILD_PY_LIB option in CMakeLists.txt to add above files into compilation

... these are not needed for the EPANET toolkit/cli compilation or anything, so I'm confused as to where they really belong.

Now the real questions is - is all this necessary? I realize that this is the product of much effort, so I assume that much thought went into this structure. I'm looking for some written history of the events leading up to this, and I'm just not able to string together the narrative from issue-threads and commit messages.

I was under the impression that a major advantage of using SWIG is to automatically handle much of what is being done via these mechanisms by crafting a concise interface file. Does this not pan out in practice? I'm grateful for any background info, links, blogs, or otherwise.

Could there be any methods to analyses the warning throws?

When I was using the python version of OWA-EPANET, I found all functions do not retrieve the integer values of warnings, as it's stated in "README". You know it's hard to check these basically identical warnings. Could there be any methods to analyses the warning throws?

Automate package build and test

The epanet-python package contains two Python extension modules epanet.toolkit and epanet.output created using SWIG and epanet2.dll and epanet-output.dll respectively.

The libraries are built separately and the wrappers are generated, built, and linked with them. The code for epanet2.dll requires some patches prior to the library build.

Initial target is Python 3.6 64 bit. Therefore on Windows the target compiler is Visual Studio 14 2015. This is a hard requirement the packages will not build successfully otherwise. This differs from the current target compiler for the OWA epanet/dev (Visual Studio 15 2017).

Tests are currently written using pytest.

Complete unit testing

Unit tests are in the process of being written. More are needed that specifically target API that creates and deletes model elements.

Library import error when running owa-epanet MacOS wheel installed from pypi

Running Python 3.8 in a Conda env on Mac OS 11.4.

When I run owa-epanet wheel binary install from pypi I get the following library import error

(py38) michaeltryby@iMac-Pro owa-epanet % pytest
======================================== test session starts =========================================
platform darwin -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/michaeltryby/Workspace/OWA/epanet-python/owa-epanet
collected 0 items / 1 error                                                                          

=============================================== ERRORS ===============================================
______________________________ ERROR collecting test/test_owa_epanet.py ______________________________
ImportError while importing test module '/Users/michaeltryby/Workspace/OWA/epanet-python/owa-epanet/test/test_owa_epanet.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/anaconda3/envs/py38/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_owa_epanet.py:5: in <module>
    import epanet.toolkit as en
/usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/epanet/toolkit.py:13: in <module>
    from . import _toolkit
E   ImportError: dlopen(/usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/epanet/_toolkit.so, 2): Library not loaded: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/Python
E     Referenced from: /usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/epanet/_toolkit.so
E     Reason: image not found
====================================== short test summary info =======================================
ERROR test/test_owa_epanet.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================== 1 error in 0.16s ==========================================

exceptions are thrown but I still want the return value

when iterating through a hydraulic simulation using the nextH-type methods, if there is an epanet-related error like "negative pressures", the stepping call will raise an exception. We can catch it, but we will not get the time return value from the function (which we need for various reasons).

I see that the toolkit.i file declares some macros to accomplish both routing of OUTVALUEs to returns, and checking the C toolkit return value to raise, but this is preventing us from using the functions as we desire.

our workaround seems to be changing the swig interface file to avoid raising, or to avoid passing the OUTVALUE as a return so we can retrieve it even if the function raises.

any thoughts?

Strip prefixes and suffixes from wrapper function names

This task involves removing these prefixes using the SWIG %rename.

The modules in this package are contained within the epanet namespace. Consequently, prefixes such as EN are no longer required in the python wrapper. Removing them will improve conformance of the function names with python PEP 8 naming conventions.

Errors on installation of epanet-python package

After installing owa-epanet on my computer using the code pip install owa-epanet, I just ran the code python3 setup.py sdist bdist_wheel, but it returned the error shown below:

`C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet>python setup.py sdist bdist_wheel


--------------------------------------------------------------------------------
-- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is MSVC 19.16.27045.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is MSVC 19.16.27045.0
CMake Warning (dev) at C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.18/Modules/CMakeDetermineCXXCompiler.cmake:157 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  CMakeLists.txt:4 (ENABLE_LANGUAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.18/Modules/CMakeDetermineCXXCompiler.cmake:177 (elseif):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  CMakeLists.txt:4 (ENABLE_LANGUAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/owa-epanet/_cmake_test_compile/build
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator - success
--------------------------------------------------------------------------------

Configuring Project
  Working directory:
    C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\_skbuild\win-amd64-3.7\cmake-build
  Command:
    cmake 'C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet' -G Ninja '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\_skbuild\win-amd64-3.7\cmake-install' '-DPYTHON_EXECUTABLE:FILEPATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\python.exe' -DPYTHON_VERSION_STRING:STRING=3.7.9 '-DPYTHON_INCLUDE_DIR:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Include' '-DPYTHON_LIBRARY:FILEPATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\libs\python37.lib' -DSKBUILD:BOOL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\lib\site-packages\skbuild\resources\cmake' -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release

-- The project is built using scikit-build
PYTHONLIBS_VERSION_STRING: 3.7.9
CMAKE_SWIG_FLAGS: -py3
CMake Error at CMakeLists.txt:38 (ADD_SUBDIRECTORY):
  The source directory

    C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/owa-epanet/EPANET

  does not contain a CMakeLists.txt file.


CMake Warning (dev) at C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.18/Modules/UseSWIG.cmake:634 (message):
  Policy CMP0078 is not set: UseSWIG generates standard target names.  Run
  "cmake --help-policy CMP0078" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

Call Stack (most recent call first):
  CMakeLists.txt:42 (SWIG_ADD_LIBRARY)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.18/Modules/UseSWIG.cmake:486 (message):
  Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
  flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/cmake/data/share/cmake-3.18/Modules/UseSWIG.cmake:736 (SWIG_ADD_SOURCE_TO_MODULE)
  CMakeLists.txt:42 (SWIG_ADD_LIBRARY)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at CMakeLists.txt:44 (set_property):
  set_property could not find TARGET epanet2.  Perhaps it has not yet been
  created.


-- Configuring incomplete, errors occurred!
See also "C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/owa-epanet/_skbuild/win-amd64-3.7/cmake-build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
  File "C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\lib\site-packages\skbuild\setuptools_wrap.py", line 586, in setup
    languages=cmake_languages
  File "C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\lib\site-packages\skbuild\cmaker.py", line 240, in configure
    os.path.abspath(CMAKE_BUILD_DIR())))

An error occurred while configuring with CMake.
  Command:
    cmake 'C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet' -G Ninja '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\_skbuild\win-amd64-3.7\cmake-install' '-DPYTHON_EXECUTABLE:FILEPATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\python.exe' -DPYTHON_VERSION_STRING:STRING=3.7.9 '-DPYTHON_INCLUDE_DIR:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Include' '-DPYTHON_LIBRARY:FILEPATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\libs\python37.lib' -DSKBUILD:BOOL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\lib\site-packages\skbuild\resources\cmake' -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release
  Source directory:
    C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet
  Working directory:
    C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\_skbuild\win-amd64-3.7\cmake-build
Please see CMake's output for more information`

Could you please give me some ideas about how to fix this issue? Thanks a lot in advance!

Automate library and python package build

The package build is currently performed manually. It requires the epanet-toolkit and epanet-output libraries to be built a priori. The required .dll, .lib, and .h files are then manually copied to the source directory for the module being built. Then the python packaging system is used to build the swig wrapper and create the package. This process need to be automated for easy packaging and distribution of the python modules.

Error in CMakeLists.txt - Ws7 & VS 2019

Trying to generate whl for py 3.8-32 (python 3.8.5) under Ws7 / VS2019, the chain fails to generate .whl.
The fix consists in removing the 'Release' path chunk from the last two copy commands from /bin/Release and /lib/Release
CMakeLists.txt

Owa-epanet RequirementError

I was following the building instructions in the readme at owa-epanet and when preforming pipenv install ../dist /*.whl I met the following error

C:\Users\lulin\pythonroom\epanet-python\owa-epanet\dist>pipenv install *whl    
Installing *whl...                                                                                                   
Traceback (most recent call last):                                                                                  
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 98, in __init__                                                                                   
           req = REQUIREMENT.parseString(requirement_string)                                                            
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1654, in parseString                                                                                             
           raise exc                                                                                                       
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1644, in parseString                                                             
           loc, tokens = self._parse( instring, 0 )                                                                     
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache                                                                         
           loc,tokens = self.parseImpl( instring, preloc, doActions )                                                   
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 3417, in parseImpl                                                                           
           loc, exprtokens = e._parse( instring, loc, doActions )                                                        
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache                                                                                     
          loc,tokens = self.parseImpl( instring, preloc, doActions )                                                    
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 3739, in parseImpl                                                                                       
           return self.expr._parse( instring, loc, doActions, callPreParse=False )                                       
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache                                                                                   
           loc,tokens = self.parseImpl( instring, preloc, doActions )                                                    
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 3400, in parseImpl                                                                                       
           loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )                        
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1406, in _parseNoCache                                                                                   
           loc,tokens = self.parseImpl( instring, preloc, doActions )                                                    
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 2711, in parseImpl                                                                                       
           raise ParseException(instring, loc, self.errmsg, self)                                                           
pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)                                                                                                                                         

During handling of the above exception, another exception occurred:                                                                                                                                                                       

Traceback (most recent call last):                                                                                
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 966, in _parse_name_from_line                                                          
           self._requirement = init_requirement(self.line)                                                               
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\utils.py", line 200, in init_requirement                                                                      
           req = Requirement.parse(name)                                                                                 
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 3139, in parse                                                                                                    
           req, = parse_requirements(s)                                                                                  
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 3084, in parse_requirements                                                                                       
           yield Requirement(line)                                                                                       
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\__init__.py", line 3094, in __init__                                                                                                 
           super(Requirement, self).__init__(requirement_string)                                                         
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 100, in __init__                                                                            
           raise InvalidRequirement(                                                                                        
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'*whl'": Expected W:(abcd...)                                                                                                                             

During handling of the above exception, another exception occurred:                                                                                                                                                                       

Traceback (most recent call last):                                                                                
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main 
           return _run_code(code, main_globals, None,                                                                   
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code            
           exec(code, run_globals)                                                                                       
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__                                                                                                
           return self.main(*args, **kwargs)                                                                             
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main                                                                                                    
           rv = self.invoke(ctx)                                                                                         
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke                                                                                                 
           return _process_result(sub_ctx.command.invoke(sub_ctx))                                                       
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke                                                                                                 
           return ctx.invoke(self.callback, **ctx.params)                                                               
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke                                                                                                 
           return callback(*args, **kwargs)                                                                             
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func                                                                                          
           return ctx.invoke(f, obj, *args, **kwargs)                                                                   
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke                                                                                                  
           return callback(*args, **kwargs)                                                                              
     File "C:\Users\lulin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func                                                                                           
           return f(get_current_context(), *args, **kwargs)                                                              
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\cli\command.py", line 233, in install                                                                                                       
           retcode = do_install(                                                                                         
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\core.py", line 2100, in do_install                                                                                                          
           pkg_requirement = Requirement.from_line(pkg_line)                                                             
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 2676, in from_line                                                                     
           parsed_line = Line(line)                                                                                      
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 171, in __init__                                                                       
           self.parse()                                                                                                  
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1304, in parse                                                                         
           self.parse_name()                                                                                            
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1027, in parse_name                                                                   
           name = self._parse_name_from_line()                                                                           
     File "c:\users\lulin\appdata\local\programs\python\python39\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 968, in _parse_name_from_line                                                          
           raise RequirementError(                                                                                          
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from '*whl'

I hope someone can provide some guidance in how to solve this error.

Some tips in the installation on windows

With several trials, i installed it successfully. Some tips may be useful for you, as listed below.

  1. Before all the tips, you should know the epanet version run successfully only on the python 3.x. My python version is 3.7.9.
  2. it requires the python module "scikit-build". You can install them easily via command line "pip install scikit-build".
  3. it requires the SWIG. Download the package from the official website and unzip it. Then add the path of file to system path.
  4. Because the installation requires cmake to complie the C source codes, cmake certainly need to be installed on your platform.
  5. Just follow the "README". Take the command line and build the libraries. Finally, you can use it through the updated file named by "epanet" under "packages".

SWIG generated Toolkit API wrapper?

Hey @mauriziocingi I have worked with ctypes, ctypesgen, and now SWIG for integrating our EPANET outputapi library with python. You can see the latest SWIG version here.

I am really happy with how it came out. Using SWIG it is easy to handle memory management, error handling, and best of all the library becomes a fully fledged Python extension. I was thinking about SWIG wrapping the Toolkit API. Is that something that could live in this repo along with your work?

I also created several Python packages related to regression testing that need a home. We are contemplating a bit of a reorganization over in the EPANET repo in Issue #123. Would you be amenable to keeping multiple EPANET related python packages here in your repo? Give it some thought and let us know what your preferences are. Thanks!

Errors on installation of owa-epanet

I was trying to install owa-epanet library using the code pip install owa-epanet.
But it returned the error shown below:

C:\Users\Ziyuan>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: 'c:\users\ziyuan\appdata\local\programs\python\python37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ziyuan\\AppData\\Local\\Temp\\pip-install-q6ub27xj\\owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ziyuan\\AppData\\Local\\Temp\\pip-install-q6ub27xj\\owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2\\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\Ziyuan\AppData\Local\Temp\pip-wheel-g59ckj0l'
       cwd: C:\Users\Ziyuan\AppData\Local\Temp\pip-install-q6ub27xj\owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2\
  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/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_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/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_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/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_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/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/Ziyuan/AppData/Local/Temp/pip-install-q6ub27xj/owa-epanet_dc5c9205daa9406797dfe7c2d9957cd2/_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.7 requires Microsoft Visual Studio 2017.
  Get it with "Visual Studio 2017":

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

  ********************************************************************************
  ----------------------------------------
  ERROR: Failed building wheel for owa-epanet

Appreicate a lot if any advices!

element counts are missing from python37 whl

Just tried out the epanet.output-0.2.0.dev0-cp37-cp37m-win_amd64.whl in the PyQGIS EPANET ui project (issue 289), it installed correctly, but it is missing some general element count variables such as: ENR_nodeCount, ENR_linkCount etc, also, I hope the getnodeseries, getnodeattribute, and getnoderesult in the whl have the same api as the current ENR_get versions in the output api dll.

Local wheel built on Linux exhibits multiple library import errors when loading wrapper library

Building owa-epanet wheel locally on Ubuntu 18 (WSL) with Python 3.7 in a Conda env.

The build and install proceed as normal. I get the following error when running pytest

(base) mtryby@DESKTOP-NLLFR13:~/OWA/epanet-python/owa-epanet$ python -m pytest
================================================= test session starts ==================================================
platform linux -- Python 3.7.6, pytest-6.0.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/mtryby/OWA/epanet-python/owa-epanet
collected 0 items / 1 error

======================================================== ERRORS ========================================================
_______________________________________ ERROR collecting test/test_owa_epanet.py _______________________________________
ImportError while importing test module '/home/mtryby/OWA/epanet-python/owa-epanet/test/test_owa_epanet.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../miniconda3/lib/python3.7/site-packages/epanet/toolkit.py:14: in swig_import_helper
    return importlib.import_module(mname)
../../../miniconda3/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:670: in _load_unlocked
    ???
<frozen importlib._bootstrap>:583: in module_from_spec
    ???
<frozen importlib._bootstrap_external>:1043: in create_module
    ???
<frozen importlib._bootstrap>:219: in _call_with_frames_removed
    ???
E   ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:
../../../miniconda3/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_owa_epanet.py:5: in <module>
    import epanet.toolkit as en
../../../miniconda3/lib/python3.7/site-packages/epanet/toolkit.py:17: in <module>
    _toolkit = swig_import_helper()
../../../miniconda3/lib/python3.7/site-packages/epanet/toolkit.py:16: in swig_import_helper
    return importlib.import_module('_toolkit')
../../../miniconda3/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named '_toolkit'
=============================================== short test summary info ================================================
ERROR test/test_owa_epanet.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=================================================== 1 error in 0.41s ===================================================

Problem with `setvertices` in owa-epanet?

In the EPANET source code, EN_setvertices has five arguments:

EN_setvertices(EN_Project ph, int index, double *x, double *y, int count)

In the owa-epanet toolkit, setvertices is missing the x and y arguments and there is no other function that allows these to be set.

def setvertices(ph, index, count):
    r"""
    setvertices(ph, index, count) -> int

    Parameters
    ----------
    ph: EN_Project
    index: int
    count: int

    """
    return _toolkit.setvertices(ph, index, count)

I can't run epamodule on Python

Hello,

I am trying to install and use the epamodule in python but so far I had no success.
I tried to install into the terminal, but than I cant find the module at C:\Users\ferna\AppData\Local\Programs\Python\Python37\Lib\site-packages
image

I also tried to download the version on the github import the epamodule.py from the owa-epanet-2.2.3, but I always get an error

C:\Users\ferna\venv\Python3.7\Scripts\python.exe "C:/Users/ferna/Desktop/AIDE/teste.py"
Traceback (most recent call last):
  File "C:/Users/ferna/Desktop/AIDE/teste.py", line 2, in <module>
    import epamodule
  File "C:\Users\ferna\Desktop\AIDE\epamodule.py", line 130
    ierr = _lib.ENsetflowunits(ctypes.c_int(units_code))
                                                       ^
TabError: inconsistent use of tabs and spaces in indentation 

I am sorry for the simple question, but I have no other idea of what I can do.

Thanks very much for the attention

Make toolkit and output APIs consistent

Minor naming and indexing differences between packages should be addressed. For example, toolkit model elements are indexed starting from 1, while in output they are indexed starting from 0.

Since both packages are in the epanet namespace 'EN' prefixes can be stripped from the API. A Python compliant naming convention should be used.

API to access headloss model code

Currently, there appears to be no way to access the headloss model code using the API. Such API would be useful to help correctly interpret the roughness values after having read an input file.

Local wheel built on Mac OS seg faults when loading wrapper library

Building owa-epanet wheel locally on Mac OS 11.4 with Python 3.8 running in a Conda env.

The build and install proceed as normal. I get the following error when running pytest

(py38) michaeltryby@iMac-Pro owa-epanet % pytest 
======================================== test session starts =========================================
platform darwin -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/michaeltryby/Workspace/OWA/epanet-python/owa-epanet
collecting ... Fatal Python error: Segmentation fault

Current thread 0x0000000109d6ce00 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1166 in create_module
  File "<frozen importlib._bootstrap>", line 556 in module_from_spec
  File "<frozen importlib._bootstrap>", line 657 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/usr/local/anaconda3/envs/py38/lib/python3.8/site-packages/epanet/toolkit.py", line 13 in <module>
  ...

Combine Toolkit and Output modules into a single package

Currently Toolkit and Output extension modules are organized into separate implicit namespace packages. The modules are most likely going to be used together, so it makes more sense to distribute them as a single package. Therefore the modules should be combined.

Pivot epanet-python packaging to binary distribution

I had a chance to review the Issues posted to this repository and it seems like build and install problems have been coming up frequently.

Is there any interest in pivoting from a source distribution to a binary distribution for an EPANET wrapper package?

Over at OWA/swmm-python we recently completed work on a binary distribution for SWMM.

https://github.com/OpenWaterAnalytics/swmm-python/tree/dev/swmm-toolkit

https://pypi.org/project/swmm-toolkit/

It would be straight forward to use swmm-toolkit as a template and create an epanet-toolkit wheel.

Such a wheel would resolve many of the build and install issues Python developers are experiencing here on the EPANET side.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.