{"record":{"id":"d61fa072aec5fa00","repo":"xtekky/gpt4free","slug":"wasmtime-and-numpy-are-required-for-pow-solving","errorCode":null,"errorMessage":"wasmtime and numpy are required for PoW solving","messagePattern":"wasmtime and numpy are required for PoW solving","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/DeepSeek.py","lineNumber":58,"sourceCode":"\n    has_curl_cffi = True\nexcept ImportError:\n    has_curl_cffi = False\n\nWASM_PATH = os.path.join(os.path.dirname(__file__), \"deepseek\", \"pow_solver.wasm\")\n\n\nclass DeepSeekHash:\n    \"\"\"Custom SHA3 hash solver using WebAssembly\"\"\"\n\n    def __init__(self):\n        self.instance = None\n        self.memory = None\n        self.store = None\n\n    def init(self, wasm_path: str):\n        if not has_wasmtime_and_numpy:\n            raise ImportError(\"wasmtime and numpy are required for PoW solving\")\n\n        if not Path(wasm_path).exists():\n            raise FileNotFoundError(f\"WASM file not found: {wasm_path}\")\n\n        engine = wasmtime.Engine()\n\n        with open(wasm_path, \"rb\") as f:\n            wasm_bytes = f.read()\n\n        module = wasmtime.Module(engine, wasm_bytes)\n\n        self.store = wasmtime.Store(engine)\n        linker = wasmtime.Linker(engine)\n        linker.define_wasi()\n\n        self.instance = linker.instantiate(self.store, module)\n        self.memory = self.instance.exports(self.store)[\"memory\"]\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/DeepSeek.py#L40-L76","documentation":"ImportError raised by DeepSeekHash.init in g4f/Provider/needs_auth/DeepSeek.py: DeepSeek's authenticated endpoint requires solving a proof-of-work challenge executed as WebAssembly, and the optional dependencies that run it — wasmtime (WASM runtime) and numpy — are not installed. The module-level has_wasmtime_and_numpy flag is false, so init refuses to proceed.","triggerScenarios":"Using the DeepSeek (authenticated, cookie/HAR-based) provider in an environment where 'pip install wasmtime numpy' (or g4f's extras including them) was never run. The check fires the moment the PoW solver initializes, before any hash work starts.","commonSituations":"Minimal installs of g4f without the deepseek/websocket extras; slim Docker images; upgrading g4f in a venv created before the PoW requirement was added.","solutions":["Install the missing dependencies: pip install wasmtime numpy.","Or reinstall g4f with the extras that pull them in for the DeepSeek provider.","If you intentionally cannot install them, use a different provider or the API-key based DeepSeek path that does not need PoW."],"exampleFix":"# before\n# ImportError: wasmtime and numpy are required for PoW solving\n\n# after\n# pip install wasmtime numpy\nfrom g4f.Provider import DeepSeek\n# provider now initializes DeepSeekHash successfully","handlingStrategy":"validation","validationCode":"def deepseek_pow_ready():\n    try:\n        import wasmtime  # noqa\n        import numpy  # noqa\n        return True\n    except ImportError:\n        return False\n\nif not deepseek_pow_ready():\n    raise SystemExit(\"pip install wasmtime numpy to use the DeepSeek provider\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = await client.chat.completions.create(model=m, provider=DeepSeek, messages=msgs)\nexcept ImportError as e:\n    subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"wasmtime\", \"numpy\"])\n    # retry once after install","preventionTips":["Include wasmtime and numpy in your deployment requirements when using DeepSeek auth.","Run a dependency probe at application startup.","Prefer the API-key DeepSeek path in minimal containers."],"tags":["dependencies","import-error","deepseek","wasm"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}