Open LittleZi opened 3 years ago
It looks like you are trying to build the wrapper from a clone of the repository. CMake cannot find EPANET because it is linked as a git submodule.
Assuming this is the case, please use the instructions provided: https://github.com/OpenWaterAnalytics/epanet-python/tree/dev/owa-epanet -- you will find notes there about initializing the EPANET submodule.
Thanks for your replying!
What I did is shown below:
C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet>cd EPANET
C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\EPANET>git init
Reinitialized existing Git repository in C:/Users/Ziyuan/AppData/Local/Programs/Python/Python37/Lib/site-packages/owa-epanet/EPANET/.git/
C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\EPANET>git submodule update --init
C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet\EPANET>cd ..
C:\Users\Ziyuan\AppData\Local\Programs\Python\Python37\Lib\site-packages\owa-epanet>python setup.py sdist bdist_wheel
Is it correct? But it still returned the same cmake error, I still feel confused about this issue.
you must run the git submodule update --init
command from the base repo directory, not from inside EPANET
directory.
Thanks for you replying again! Do you mean like this shown below?
C:\>cd epanet-python
C:\epanet-python>cd epanet-python-dev
C:\epanet-python\epanet-python-dev>cd owa-epanet
C:\epanet-python\epanet-python-dev\owa-epanet>git init
Reinitialized existing Git repository in C:/epanet-python/epanet-python-dev/owa-epanet/.git/
C:\epanet-python\epanet-python-dev\owa-epanet>git submodule update --init
C:\epanet-python\epanet-python-dev\owa-epanet>python setup.py sdist bdist_wheel
But finally, I still got the same error.
I think the git init
command is resetting the repository and causing you to lose the submodule. The instructions provided do not suggest reinitializing the base repo, so try re-cloning the repo and following the instructions again.
Thanks for your patience! I am new to python. This time I did not run git init first.
C:\epanet-python\epanet-python-dev>cd owa-epanet
C:\epanet-python\epanet-python-dev\owa-epanet>git submodule update --init
C:\epanet-python\epanet-python-dev\owa-epanet>python setup.py sdist bdist_wheel
I am confused that it still returned the same cmake error.
What overall are you trying to accomplish? If it is just to use the wrapper, then a simple install via pypi should work (assuming you have the proper build tools). If you are trying to learn about and/or improve how the wrapper works, then cloning this repo and approaching it this way would work better.
assuming you want to get into the wrapper's internals, please provide more history of commands - did you download the repository, or clone it? what exactly is the git/console response to the commands?
I downloaded the repository and followed the instructions to build the epanet-python-packages, because I want to get coordinates of nodes in a water distribution network using this package.
Thank you very much!
I have fixed the cmake error I encountered after running the code: python3 setup.py sdist bdist_wheel.
And now, I changed directory into test
folder, and ran the code: pipenv install ../dist/*.whl
, an new error emerged shown below:
C:\Users\Ziyuan\epanet-python\epanet-python\owa-epanet\test>pipenv install ../dist/*.whl
Installing ../dist/*.whl...
Traceback (most recent call last):
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 98, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1654, in parseString
raise exc
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1644, in parseString
loc, tokens = self._parse( instring, 0 )
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 3417, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 3739, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "c:\users\ziyuan\appdata\local\programs\python\python37\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\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\pyparsing.py", line 1406, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "c:\users\ziyuan\appdata\local\programs\python\python37\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\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 966, in _parse_name_from_line
self._requirement = init_requirement(self.line)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\utils.py", line 200, in init_requirement
req = Requirement.parse(name)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\__init__.py", line 3139, in parse
req, = parse_requirements(s)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\__init__.py", line 3084, in parse_requirements
yield Requirement(line)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\__init__.py", line 3094, in __init__
super(Requirement, self).__init__(requirement_string)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 102, in __init__
requirement_string[e.loc : e.loc + 8], e.msg
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'../dist/'": Expected W:(abcd...)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\ziyuan\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\cli\command.py", line 253, in install
site_packages=state.site_packages
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 2100, in do_install
pkg_requirement = Requirement.from_line(pkg_line)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 2676, in from_line
parsed_line = Line(line)
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 171, in __init__
self.parse()
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1304, in parse
self.parse_name()
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1027, in parse_name
name = self._parse_name_from_line()
File "C:\Users\Ziyuan\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 969, in _parse_name_from_line
"Failed parsing requirement from {0!r}".format(self.line)
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from '../dist/*.whl'
Could you please give me some ideas about how to fix this issue? I have no ideas about it. Thanks a lot in advance!
should probably establish whether pipenv works properly on your system first, without trying to install the epanet wrapper. This looks like a pipenv problem.
I'm thinking this is fixed? I think you've opened some threads on the OWA forum - apologies if I am mistaken
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:Appreicate a lot if any advices!