{"record":{"id":"93ff9837cfd8bdd5","repo":"xtekky/gpt4free","slug":"markitdown-is-not-installed-please-install-it-wit","errorCode":null,"errorMessage":"MarkItDown is not installed. Please install it with `pip install markitdown`.","messagePattern":"MarkItDown is not installed\\. Please install it with `pip install markitdown`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/audio/MarkItDown.py","lineNumber":28,"sourceCode":"except ImportError:\n    has_markitdown = False\n\nfrom ...typing import AsyncResult, Messages, MediaListType\nfrom ...tools.files import get_tempfile\nfrom ..base_provider import AsyncGeneratorProvider, ProviderModelMixin\n\n\nclass MarkItDown(AsyncGeneratorProvider, ProviderModelMixin):\n    working = has_markitdown\n\n    @classmethod\n    async def create_async_generator(\n        cls, model: str, messages: Messages, media: MediaListType = None, **kwargs\n    ) -> AsyncResult:\n        if media is None:\n            raise ValueError(\"MarkItDown requires media to be provided.\")\n        if not has_markitdown:\n            raise ImportError(\n                \"MarkItDown is not installed. Please install it with `pip install markitdown`.\"\n            )\n        md = MaItDo()\n        for file, filename in media:\n            text = None\n            try:\n                if isinstance(file, str) and file.startswith((\"http://\", \"https://\")):\n                    result = md.convert_url(file)\n                else:\n                    result = md.convert(\n                        file,\n                        stream_info=StreamInfo(filename=filename) if filename else None,\n                    )\n                if asyncio.iscoroutine(result.text_content):\n                    text = await result.text_content\n                else:\n                    text = result.text_content\n            except TypeError:","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/audio/MarkItDown.py#L10-L46","documentation":"ImportError from MarkItDown when media was provided but the optional markitdown package isn't installed (has_markitdown is False, which also sets working=False). The dependency check deliberately comes after the media check so callers get the most specific error first.","triggerScenarios":"Calling MarkItDown with media on an environment where 'pip install markitdown' was never run; note the source also hints at a typo risk — the constructor used is MaItDo(), which must resolve to the MarkItDown class.","commonSituations":"Base g4f install without document-conversion extras; slim containers; new machines provisioned from a partial requirements list.","solutions":["pip install markitdown","Add markitdown to the deployment's dependency list if document conversion is used","Check provider.working / has_markitdown before routing requests to MarkItDown","Update g4f in case the import shim was fixed upstream"],"exampleFix":"# before\n# ImportError: MarkItDown is not installed\nresp = await client.chat.completions.create(model='MarkItDown', messages=msgs, media=media)\n\n# after (shell)\n# pip install markitdown","handlingStrategy":"validation","validationCode":"from g4f.Provider.audio.MarkItDown import has_markitdown\n\nif not has_markitdown:\n    raise RuntimeError('run: pip install markitdown')  # fail fast with actionable msg","typeGuard":null,"tryCatchPattern":"try:\n    ...  # MarkItDown call with media\nexcept ImportError as e:\n    if 'markitdown' in str(e):\n        disable_markitdown_feature()","preventionTips":["Add markitdown to requirements when document conversion is a feature","Check has_markitdown at startup, not per request"],"tags":["markitdown","dependencies","installation"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}