Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] FileNotFoundError: [WinError 2] #150

Open
TDL77 opened this issue Apr 2, 2023 · 0 comments
Open

[BUG] FileNotFoundError: [WinError 2] #150

TDL77 opened this issue Apr 2, 2023 · 0 comments
Assignees

Comments

@TDL77
Copy link

TDL77 commented Apr 2, 2023

I'm trying to reproduce this piece of code, the rest of the laptops worked fine .. and here is the error .. help me figure it out
#-----------------------------
from merlion.utils import TimeSeries
from ts_datasets.anomaly import NAB

  • Data loader returns pandas DataFrames, which we convert to Merlion TimeSeries
    time_series, metadata = NAB(subset="realKnownCause")[3]
    train_data = TimeSeries.from_pd(time_series[metadata.trainval])
    test_data = TimeSeries.from_pd(time_series[~metadata.trainval])
    test_labels = TimeSeries.from_pd(metadata.anomaly[~metadata.trainval])
    from merlion.models.defaults import DefaultDetectorConfig, DefaultDetector
    model = DefaultDetector(DefaultDetectorConfig())
    model.train(train_data=train_data)
    test_pred = model.get_anomaly_label(time_series=test_data)
    #---------------------
    the files themselves downloaded normally and open, but an error will appear that the file cannot be found

FileNotFoundError Traceback (most recent call last)
Cell In[3], line 3
1 from merlion.models.defaults import DefaultDetectorConfig, DefaultDetector
2 model = DefaultDetector(DefaultDetectorConfig())
----> 3 model.train(train_data=train_data)
4 test_pred = model.get_anomaly_label(time_series=test_data)

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\merlion\models\defaults.py:88, in DefaultDetector.train(self, train_data, train_config, anomaly_labels, post_rule_train_config)
66 self.model = ModelFactory.create(
67 "DetectorEnsemble",
68 models=[
(...)
79 **self.config.model_kwargs,
80 )
82 # Univariate model is ETS/RRCF/ZMS ensemble
83 else:
84 self.model = ModelFactory.create(
85 "DetectorEnsemble",
86 models=[
87 ModelFactory.create("AutoETS", model=dict(name="ETSDetector"), transform=transform_dict),
---> 88 ModelFactory.create(
89 "RandomCutForest",
90 online_updates=True,
91 parallel=n_threads > 1,
92 thread_pool_size=n_threads,
93 n_estimators=100,
94 max_n_samples=512,
95 ),
96 ModelFactory.create("ZMS", n_lags=3, transform=transform_dict),
97 ],
98 **self.config.model_kwargs,
99 )
101 return super().train(
102 train_data=train_data,
103 anomaly_labels=anomaly_labels,
104 train_config=train_config,
105 post_rule_train_config=post_rule_train_config,
106 )

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\merlion\models\factory.py:94, in ModelFactory.create(cls, name, return_unused_kwargs, **kwargs)
92 model._load_state(state)
93 return model, {k: v for k, v in kwargs.items() if k not in state}
---> 94 model._load_state(kwargs)
95 return model

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\merlion\models\base.py:396, in ModelBase._load_state(self, state_dict, **kwargs)
394 if "config" in state_dict: # don't re-set the config
395 state_dict.pop("config")
--> 396 self.setstate(state_dict)

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\merlion\models\anomaly\random_cut_forest.py:147, in RandomCutForest.setstate(self, state)
144 def setstate(self, state):
145 # Remove the serialized forest from the state before setting it
146 # Set the forest manually after deserializing it
--> 147 RCFSerDe = JVMSingleton.gateway().jvm.com.amazon.randomcutforest.serialize.RandomCutForestSerDe
148 forest = RCFSerDe().fromJson(state.pop("forest", None))
149 super().setstate(state)

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\merlion\models\anomaly\random_cut_forest.py:41, in JVMSingleton.gateway(cls)
38 if cls._gateway is None:
39 # --add-opens necessary to avoid exceptions in newer Java versions
40 javaopts = ["--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.nio=ALL-UNNAMED"]
---> 41 cls._gateway = JavaGateway.launch_gateway(classpath=classpath, javaopts=javaopts)
42 return cls._gateway

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\venv\lib\site-packages\py4j\java_gateway.py:2159, in JavaGateway.launch_gateway(cls, port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth, cwd, use_shell)
2099 @classmethod
2100 def launch_gateway(
2101 cls, port=0, jarpath="", classpath="", javaopts=[],
(...)
2104 create_new_process_group=False, enable_auth=False, cwd=None,
2105 use_shell=False):
2106 """Launch a Gateway in a new Java process and create a default
2107 :class:JavaGateway <py4j.java_gateway.JavaGateway> to connect to
2108 it.
(...)
2157 connected to the Gateway server.
2158 """
-> 2159 _ret = launch_gateway(
2160 port, jarpath, classpath, javaopts, die_on_exit,
2161 redirect_stdout=redirect_stdout, redirect_stderr=redirect_stderr,
2162 daemonize_redirect=daemonize_redirect, java_path=java_path,
2163 create_new_process_group=create_new_process_group,
2164 enable_auth=enable_auth, cwd=cwd, return_proc=True,
2165 use_shell=use_shell)
2166 if enable_auth:
2167 _port, _auth_token, proc = _ret

File C:\Mail@Cloud\DataMining\Python\The Numenta Anomaly Benchmark (NAB)\GitHub\Merlion\venv\lib\site-packages\py4j\java_gateway.py:331, in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth, cwd, return_proc, use_shell)
328 popen_kwargs.update(get_create_new_process_group_kwargs())
330 popen_kwargs["shell"] = use_shell
--> 331 proc = Popen(
332 command, stdout=PIPE, stdin=PIPE, stderr=stderr, cwd=cwd,
333 **popen_kwargs)
335 # Determine which port the server started on (needed to support
336 # ephemeral ports)
337 _port = int(proc.stdout.readline())

File ~\AppData\Local\Programs\Python\Python39\lib\subprocess.py:951, in Popen.init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
947 if self.text_mode:
948 self.stderr = io.TextIOWrapper(self.stderr,
949 encoding=encoding, errors=errors)
--> 951 self._execute_child(args, executable, preexec_fn, close_fds,
952 pass_fds, cwd, env,
953 startupinfo, creationflags, shell,
954 p2cread, p2cwrite,
955 c2pread, c2pwrite,
956 errread, errwrite,
957 restore_signals,
958 gid, gids, uid, umask,
959 start_new_session)
960 except:
961 # Cleanup if the child failed starting.
962 for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File ~\AppData\Local\Programs\Python\Python39\lib\subprocess.py:1420, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
1418 # Start the process
1419 try:
-> 1420 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
1421 # no special security
1422 None, None,
1423 int(not close_fds),
1424 creationflags,
1425 env,
1426 cwd,
1427 startupinfo)
1428 finally:
1429 # Child is launched. Close the parent's copy of those pipe
1430 # handles that only the child should have open. You need
(...)
1433 # pipe will not close when the child process exits and the
1434 # ReadFile will hang.
1435 self._close_pipe_fds(p2cread, p2cwrite,
1436 c2pread, c2pwrite,
1437 errread, errwrite)

FileNotFoundError: [WinError 2] Не удается найти указанный файл

@Emerald01 Emerald01 self-assigned this Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants