modalで何度やっても実行できない

実現したいこと

modalでプログラムを実行する

発生している問題・分からないこと

modal run で実行しようとするとエラーが起きる

エラーメッセージ

error

1(venv) D:\~~>modal run modal.py 2┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐ 3│ C:\Users\~~~~~\AppData\Local\Programs\Python\Python310\lib\runpy.py:196 in _run_module_as_main │ 4│ │ 5│ 195 │ │ sys.argv[0] = mod_spec.origin │ 6│ > 196 │ return _run_code(code, main_globals, None, │ 7│ 197 │ │ │ │ │ "__main__", mod_spec) │ 8│ │ 9│ C:\Users\~~~~~\AppData\Local\Programs\Python\Python310\lib\runpy.py:86 in _run_code │ 10│ │ 11│ 85 │ │ │ │ │ __spec__ = mod_spec) │ 12│ > 86 │ exec(code, run_globals) │ 13│ 87 │ return run_globals │ 14│ │ 15│ D:\discordbot\modal\venv\Scripts\modal.exe\__main__.py:7 in <module> │ 16│ │ 17│ │ 18│ D:\discordbot\modal\venv\lib\site-packages\modal\__main__.py:9 in main │ 19│ │ 20│ 8 │ setup_rich_traceback() │ 21│ > 9 │ entrypoint_cli() │ 22│ 10 │ 23│ │ 24│ D:\discordbot\modal\venv\lib\site-packages\click\core.py:1157 in __call__ │ 25│ │ 26│ 1156 │ │ """Alias for :meth:`main`.""" │ 27│ > 1157 │ │ return self.main(*args, **kwargs) │ 28│ 1158 │ 29│ │ 30│ D:\discordbot\modal\venv\lib\site-packages\typer\core.py:778 in main │ 31│ │ 32│ 777 │ ) -> Any: │ 33│ > 778 │ │ return _main( │ 34│ 779 │ │ │ self, │ 35│ │ 36│ D:\discordbot\modal\venv\lib\site-packages\typer\core.py:216 in _main │ 37│ │ 38│ 215 │ │ │ with self.make_context(prog_name, args, **extra) as ctx: │ 39│ > 216 │ │ │ │ rv = self.invoke(ctx) │ 40│ 217 │ │ │ │ if not standalone_mode: │ 41│ │ 42│ D:\discordbot\modal\venv\lib\site-packages\click\core.py:1688 in invoke │ 43│ │ 44│ 1687 │ │ │ │ with sub_ctx: │ 45│ > 1688 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │ 46│ 1689 │ 47│ │ 48│ D:\discordbot\modal\venv\lib\site-packages\click\core.py:1682 in invoke │ 49│ │ 50│ 1681 │ │ │ with ctx: │ 51│ > 1682 │ │ │ │ cmd_name, cmd, args = self.resolve_command(ctx, args) │ 52│ 1683 │ │ │ │ assert cmd is not None │ 53│ │ 54│ D:\discordbot\modal\venv\lib\site-packages\click\core.py:1729 in resolve_command │ 55│ │ 56│ 1728 │ │ # Get the command │ 57│ > 1729 │ │ cmd = self.get_command(ctx, cmd_name) │ 58│ 1730 │ 59│ │ 60│ D:\discordbot\modal\venv\lib\site-packages\modal\cli\run.py:200 in get_command │ 61│ │ 62│ 199 │ │ ctx.obj["env"] = ensure_env(ctx.params["env"]) │ 63│ > 200 │ │ function_or_entrypoint = import_function(func_ref, accept_local_entrypoint=True, │ 64│ 201 │ │ stub: Stub = function_or_entrypoint.stub │ 65│ │ 66│ D:\discordbot\modal\venv\lib\site-packages\modal\cli\import_refs.py:215 in import_function │ 67│ │ 68│ 214 │ try: │ 69│ > 215 │ │ module = import_file_or_module(import_ref.file_or_module) │ 70│ 216 │ │ obj_path = import_ref.object_path or DEFAULT_STUB_NAME # get variable named "st │ 71│ │ 72│ D:\discordbot\modal\venv\lib\site-packages\modal\cli\import_refs.py:63 in import_file_or_module │ 73│ │ 74│ 62 │ │ sys.modules[module_name] = module │ 75│ > 63 │ │ spec.loader.exec_module(module) │ 76│ 64 │ else: │ 77│ <frozen importlib._bootstrap_external>:883 in exec_module │ 78│ │ 79│ <frozen importlib._bootstrap>:241 in _call_with_frames_removed │ 80│ │ 81│ │ 82│ D:\discordbot\modal\modal.py:3 in <module> │ 83│ │ 84│ 2 │ 85│ > 3 stub = modal.stub() │ 86│ 4 │ 87 88AttributeError: module 'modal' has no attribute 'stub'

該当のソースコード

Python

1import modal 2 3stub = modal.Stub()4 5@stub.function()6def hello():7 print("Running remotely on Modal!")

試したこと・調べたこと

上記の詳細・結果

Stubをstubにしてみたり、コミュニティで聞いたりしたが原因は不明だった。
また、ネットでそのような記事は見つけられなかった。

補足

特になし

コメントを投稿

0 コメント