USEPA / WNTR

An EPANET compatible python package to simulate and analyze water distribution networks under disaster scenarios.
Other
318 stars 184 forks source link

ModuleNotFoundError: No module named 'wntr.sim.aml._evaluator' #259

Closed olejonny closed 2 years ago

olejonny commented 2 years ago

(env) C:\Software Dev\wntr_test>python Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import wntr Traceback (most recent call last): File "", line 1, in File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr__init.py", line 3, in from wntr import morph File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\morph__init.py", line 13, in from wntr.morph.skel import skeletonize File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\morph\skel.py", line 11, in from wntr.sim.core import WNTRSimulator File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\init__.py", line 5, in from wntr.sim.core import WaterNetworkSimulator, WNTRSimulator File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\core.py", line 1, in import wntr.sim.hydraulics File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\hydraulics.py", line 13, in from wntr.sim import aml File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\aml\init__.py", line 2, in from .aml import Model, ParamDict, VarDict, ConstraintDict, Constraint File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\aml\aml.py", line 3, in from .evaluator import Evaluator File "C:\Software Dev\wntr_test\env\lib\site-packages\wntr\sim\aml\evaluator.py", line 13, in
from ._evaluator import * ModuleNotFoundError: No module named 'wntr.sim.aml._evaluator'

Installed wntr in virtual environment using pip.

kaklise commented 2 years ago

It looks like you're using Python 3.10 which WNTR does not currently support. We can try to include the build for 3.10 in the next release.

terrahaxton commented 2 years ago

I saw the same error message and my Python is 3.9.7. Please see message below. I had recently updated the WNTR package and I wasn't having this issue in the past.

Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information.

IPython 7.29.0 -- An enhanced Interactive Python.

import wntr Traceback (most recent call last):

File "C:\Users\user1\AppData\Local\Temp/ipykernel_16424/35592916.py", line 1, in import wntr

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr__init__.py", line 3, in from wntr import morph

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\morph__init__.py", line 13, in from wntr.morph.skel import skeletonize

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\morph\skel.py", line 11, in from wntr.sim.core import WNTRSimulator

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim__init__.py", line 5, in from wntr.sim.core import WaterNetworkSimulator, WNTRSimulator

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim\core.py", line 1, in import wntr.sim.hydraulics

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim\hydraulics.py", line 13, in from wntr.sim import aml

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim\aml__init__.py", line 2, in from .aml import Model, ParamDict, VarDict, ConstraintDict, Constraint

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim\aml\aml.py", line 3, in from .evaluator import Evaluator

File "c:\users\user1\profile\documents\coding\repos\wntr\wntr\sim\aml\evaluator.py", line 13, in from ._evaluator import *

ModuleNotFoundError: No module named 'wntr.sim.aml._evaluator'

kaklise commented 2 years ago

@terrahaxton, How did you update WNTR (git pull, pip, conda)? Also, do you have a Python 3.9 windows build of the evaluator in the wntr\sim\aml folder? The file would be called _evaluator.cp39-win_amd64.pyd.

terrahaxton commented 2 years ago

@kaklise I updated WNTR using git pull and then ran python setup.py develop. No, I don't have the file by the name you listed. Here are the files in the wntr\sim\aml folder

wntr_sim_aml_folder

kaklise commented 2 years ago

@terrahaxton, was this issue resolved when you pull from the main branch?

Thaulino commented 2 years ago

I am running python 10 and had some trouble but it is not an issue because as far as i know python 10 is currently not supported but will be with the next major release. i left this comment as i am not knowing how to delete it

terrahaxton commented 2 years ago

@terrahaxton, was this issue resolved when you pull from the main branch?

@kaklise Yes, this issue was resolved when I pulled from the main branch. Thanks!

kaklise commented 2 years ago

Closing this ticket and referencing #254. We hope to support Python 3.10 soon.

henro316 commented 1 year ago

having challenges to. just installed the complete package and gettint the wntr error. pleas who can assist. Thanks

kaklise commented 1 year ago

The WNTR repository no longer contains the prebuilt binaries. If you clone the repository, you need to build it using --build option, see https://wntr.readthedocs.io/en/latest/installation.html#developer-instructions. If you install through pip, the binaries are packaged.

henro316 commented 1 year ago

The WNTR repository no longer contains the prebuilt binaries. If you clone the repository, you need to build it using --build option, see https://wntr.readthedocs.io/en/latest/installation.html#developer-instructions. If you install through pip, the binaries are packaged.

Thanks

henro316 commented 1 year ago

good day everyone,

could some assist, trying to run a code and i get this error Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1699, in sys.exit( main() ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1629, in main udp=args.udp, broadcast=args.broadcast ) as connection: File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 949, in init super( connector, self ).init( host=host, port=port, timeout=timeout, kwds ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 377, in init self.conn = socket.create_connection( self.addr, timeout=timeout ) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err socket.timeout: timed out 22:19:03 - DEBUG @ control.py: PLC5 applied Control if T5 < 1.5 then set PU8 to open because dep_val 1.2631394863128662. Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1699, in sys.exit( main() ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1629, in main 22:19:04 - DEBUG @ control.py: PLC3 applied Control if T4 < 3.0 then set PU7 to open because dep_val 2.6051316261291504. udp=args.udp, broadcast=args.broadcast ) as connection: File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 949, in init super( connector, self ).init( host=host, port=port, timeout=timeout, kwds ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 377, in init self.conn = socket.create_connection( self.addr, timeout=timeout ) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err socket.timeout: timed out 22:19:04 - INFO @ generic_plc.py: PLC1 receive T1 from 10.0.3.1 failed with exception 'Invalid literal for Decimal: ''' 22:19:05 - INFO @ generic_plc.py: Warning: Cache for tag T1 could not be updated 22:19:05 - DEBUG @ control.py: PLC1 applied Control if T1 < 4.0 then set PU1 to open because dep_val 3.016186475753784. 22:19:09 - DEBUG @ concealment_netfilter_queue.py: Attacked tags:[{'tag': 'T1', 'value': 0.0}, {'tag': 'T2', 'value': 0.4}] Traceback (most recent call last): File "/home/henry/DHALSIM-master/dhalsim/network_attacks/concealment_netfilter_queue.py", line 199, in attack = ConcealmentMiTMNetfilterQueue( File "/home/henry/DHALSIM-master/dhalsim/network_attacks/concealment_netfilter_queue.py", line 34, in init self.concealment_data_pd = pd.read_csv(self.intermediate_attack['concealment_data']['path']) File "/usr/local/lib/python3.10/dist-packages/pandas/util/_decorators.py", line 311, in wrapper return func(*args, kwargs) File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/readers.py", line 586, in read_csv return _read(filepath_or_buffer, kwds) File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/readers.py", line 482, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/readers.py", line 811, in init self._engine = self._make_engine(self.engine) File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine return mapping[engine](self.f, self.options) # type: ignore[call-arg] File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in init self._open_handles(src, kwds) File "/usr/local/lib/python3.10/dist-packages/pandas/io/parsers/base_parser.py", line 222, in _open_handles self.handles = get_handle( File "/usr/local/lib/python3.10/dist-packages/pandas/io/common.py", line 702, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'concealment_test.csv' Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1699, in sys.exit( main() ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1629, in main udp=args.udp, broadcast=args.broadcast ) as connection: File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 949, in init super( connector, self ).init( host=host, port=port, timeout=timeout, kwds ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 377, in init self.conn = socket.create_connection( self.addr, timeout=timeout ) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err socket.timeout: timed out 22:19:12 - INFO @ generic_plc.py: PLC1 receive T1 from 10.0.3.1 failed with exception 'Invalid literal for Decimal: ''' 22:19:12 - INFO @ generic_plc.py: Warning: Cache for tag T1 could not be updated 22:19:19 - DEBUG @ physical_process.py: Iteration 6 out of 20. Internal timestep 300 Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1699, in sys.exit( main() ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 1629, in main udp=args.udp, broadcast=args.broadcast ) as connection: File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 949, in init super( connector, self ).init( host=host, port=port, timeout=timeout, **kwds ) File "/usr/local/lib/python2.7/dist-packages/cpppo/server/enip/client.py", line 377, in init self.conn = socket.create_connection( self.addr, timeout=timeout ) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err socket.timeout: timed out 22:19:20 - INFO @ generic_plc.py: PLC1 receive T1 from 10.0.3.1 failed with exception 'Invalid literal for Decimal: ''' 22:19:20 - INFO @ generic_plc.py: Warning: Cache for tag T1 could not be updated

kaklise commented 1 year ago

I don't see an error related to wntr.sim.aml._evaluator in the traceback. It looks like you're using DHALSIM, which I believe uses Python 2.7 and 3.8. I'm not sure if that is causing the issue. We recently push a change to WNTR that adds the --build option to setup.py by default. This will build the evaluator module if you need to clone and build WNTR.

henro316 commented 1 year ago

I don't see an error related to wntr.sim.aml._evaluator in the traceback. It looks like you're using DHALSIM, which I believe uses Python 2.7 and 3.8. I'm not sure if that is causing the issue. We recently push a change to WNTR that adds the --build option to setup.py by default. This will build the evaluator module if you need to clone and build WNTR.

Are you suggesting I install WNTR on the machine. Not very good in Linux. Please be more specific. Thnaks

kaklise commented 1 year ago

I'm not sure what the issue is. If you need to add the evaluator module, you can build WNTR using the instructions at https://wntr.readthedocs.io/en/latest/installation.html#developer-instructions. Our team has used DHALSIM in the past and I believe the install process with WNTR was fine. @dbhart, any advice based on traceback?

henro316 commented 1 year ago

I'm not sure what the issue is. If you need to add the evaluator module, you can build WNTR using the instructions at https://wntr.readthedocs.io/en/latest/installation.html#developer-instructions. Our team has used DHALSIM in the past and I believe the install process with WNTR was fine. @dbhart, any advice based on traceback?

Thanks for the update followed the steps but got the message below. Note that i have tried upgrading the version python henro316@UBUNTU:~/master/master/WNTR$ pip install -r requiremensts.txt DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Defaulting to user installation because normal site-packages is not writeable ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requiremensts.txt'