WNTR icon indicating copy to clipboard operation
WNTR copied to clipboard

Please add Python 3.10 support

Open jjstickel opened this issue 2 years ago • 1 comments

Please add Python 3.10 support. Thanks.

jjstickel avatar Mar 03 '22 19:03 jjstickel

As reported in #194, it is possible to generate the necessary library for Python 3.10 in the sources of the latest release:

  1. set use_swig and build to True in setup.py
  2. execute the command python setup.py build_ext --inplace
  3. use pip to install your local copy of wntr with pip install --user -e [path to wntr]

jjstickel avatar Mar 04 '22 02:03 jjstickel

As the PR is merged when can we expect a new release? :)

DanielHabenicht avatar Nov 17 '22 11:11 DanielHabenicht

Thanks for inquiring. It took us a while to finalize the new build/release process that works without the precompiled files. I think we have that wrapped up now. I plan to post the release by the end of the week.

kaklise avatar Nov 17 '22 16:11 kaklise

WNTR 0.5.0 has been tagged. The release is available through PyPI. We're working on some issues with the conda release.

kaklise avatar Nov 22 '22 21:11 kaklise

@kaklise Works for python3.10 on linux.

But I get the same error still if I use it with pyscript, it uses wntr-0.5.0-py3-none-any.whl. Is this the conda release issue?

I can also reproduce it:

pip install wntr
wget https://files.pythonhosted.org/packages/12/96/5825a53339046f49ec20f82ff9ef518302322c1accd8becc47c96ab118fc/wntr-0.5.0-py3-none-any.whl
pip install wntr-0.5.0-py3-none-any.whl --force-reinstall
# Execute Python
python
>>> import wntr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/__init__.py", line 3, in <module>
    from wntr import morph
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/morph/__init__.py", line 13, in <module>
    from wntr.morph.skel import skeletonize
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/morph/skel.py", line 11, in <module>
    from wntr.sim.core import WNTRSimulator
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/__init__.py", line 5, in <module>
    from wntr.sim.core import WaterNetworkSimulator, WNTRSimulator
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/core.py", line 1, in <module>
    import wntr.sim.hydraulics
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/hydraulics.py", line 13, in <module>
    from wntr.sim import aml
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/aml/__init__.py", line 2, in <module>
    from .aml import Model, ParamDict, VarDict, ConstraintDict, Constraint
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/aml/aml.py", line 3, in <module>
    from .evaluator import Evaluator
  File "/usr/local/python/3.10.4/lib/python3.10/site-packages/wntr/sim/aml/evaluator.py", line 13, in <module>
    from ._evaluator import *
ModuleNotFoundError: No module named 'wntr.sim.aml._evaluator'

DanielHabenicht avatar Nov 27 '22 10:11 DanielHabenicht

I should remove wntr-0.5.0-py3-none-any.whl, that was uploaded by mistake. It still works, but the code needs to be built by the user. The other wheels that are specific to an operating system and python version (e.g., wntr-0.5.0-cp310-cp310-win_amd64.whl) should not have this issue.

kaklise avatar Nov 28 '22 21:11 kaklise

Alright, please keep us updated when you release a 0.5.1 without the any wheel. (I have seen that you setup the release process in github-actions, if you need help with that. I am glad to help)

Seems like adding support for wntr running inside the WASM environment of pyscript needs some more work.

DanielHabenicht avatar Nov 29 '22 17:11 DanielHabenicht

The any wheel has been removed from the 0.5.0 release on PyPI. The github actions should push directly to PyPI on our next release (there was an issue with the token). I'm not familiar with the pyodide package you referenced, I'll take a look.

kaklise avatar Nov 29 '22 17:11 kaklise

Thanks! I think you can close this issue then :)

It just crossed my mind that executing WNTR in WASM (in Browser) would enable enabling a faster and up to date version of https://github.com/sdteffen/epanet.js (+ all WNTR specific stuff) (until then https://github.com/modelcreate/epanet-js/ seems more up to date)

DanielHabenicht avatar Nov 29 '22 18:11 DanielHabenicht