{"record":{"id":"567cdbdc57d49cbf","repo":"mlflow/mlflow","slug":"an-error-occurred-while-downloading-the-dependency","errorCode":null,"errorMessage":"An error occurred while downloading the dependency wheels: {e.stdout}","messagePattern":"An error occurred while downloading the dependency wheels: (.+?)","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/models/wheeled_model.py","lineNumber":279,"sourceCode":"                    sys.executable,\n                    \"-m\",\n                    \"pip\",\n                    \"wheel\",\n                    pip_wheel_options,\n                    \"--wheel-dir\",\n                    dst_path,\n                    \"-r\",\n                    pip_requirements_path,\n                    \"--no-cache-dir\",\n                    \"--progress-bar=off\",\n                ],\n                check=True,\n                stdout=subprocess.PIPE,\n                stderr=subprocess.STDOUT,\n                env=env,\n            )\n        except subprocess.CalledProcessError as e:\n            raise MlflowException(\n                f\"An error occurred while downloading the dependency wheels: {e.stdout}\"\n            )\n\n    def _overwrite_pip_requirements_with_wheels(self, pip_requirements_path, wheels_dir):\n        \"\"\"\n        Overwrites the requirements.txt with the wheels of the required dependencies.\n\n        Args:\n            pip_requirements_path: Path to requirements.txt in the model directory.\n            wheels_dir: Path to directory where wheels are stored.\n        \"\"\"\n        wheels = []\n        with open(pip_requirements_path, \"w\") as wheels_requirements:\n            for wheel_file in os.listdir(wheels_dir):\n                if wheel_file.endswith(\".whl\"):\n                    complete_wheel_file = os.path.join(_WHEELS_FOLDER_NAME, wheel_file)\n                    wheels.append(complete_wheel_file)\n                    wheels_requirements.write(complete_wheel_file + \"\\n\")","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/models/wheeled_model.py#L261-L297","documentation":"MLflow runs `pip wheel` as a subprocess to download dependency wheels for a WheeledModel. If the subprocess exits non-zero (network failure, unresolvable dependencies, bad index), the CalledProcessError is re-raised as an MlflowException containing pip's combined stdout output.","triggerScenarios":"pip wheel failing during WheeledModel.add_libraries()/save_model/log due to unreachable package index, authentication failures on a private index, dependency resolution conflicts, no matching wheel for the platform/Python version, or disk/permission problems.","commonSituations":"Corporate proxy blocking PyPI; private index requiring credentials not configured; packages without wheels for the current Python version; conflicting pinned versions in requirements.txt; offline CI runners.","solutions":["Read e.stdout in the message to see pip's actual failure and fix the underlying pip error","Verify network/index access (PIP_INDEX_URL, proxy settings, credentials) in the environment","Resolve version conflicts in the model's requirements.txt or conda env","Ensure wheels exist for your platform/Python version or add --pre / alternative sources appropriately","Re-run after fixing; the error is a wrapper, not the root cause"],"exampleFix":"// before\nexport PIP_INDEX_URL=https://internal.example.com/simple  # 401 without creds\nWheeledModel(model_uri=uri).add_libraries()\n\n// after\nexport PIP_INDEX_URL=https://user:token@internal.example.com/simple\nWheeledModel(model_uri=uri).add_libraries()","handlingStrategy":"try-catch","validationCode":"import subprocess\n# Pre-check index reachability before wheel download\nsubprocess.run([\"pip\", \"index\", \"versions\", \"numpy\"], check=True, capture_output=True)","typeGuard":null,"tryCatchPattern":"from mlflow.exceptions import MlflowException\nimport time\nfor attempt in range(3):\n    try:\n        wheeled.add_libraries()\n        break\n    except MlflowException as e:\n        if \"downloading the dependency wheels\" in str(e) and attempt < 2:\n            time.sleep(2 ** attempt)  # transient network failures\n        else:\n            print(e)  # shows pip stdout for root cause\n            raise","preventionTips":["Inspect e.stdout in the message — it contains pip's real failure output","Verify index credentials and proxy settings before packaging","Pin resolvable, wheel-available package versions in requirements.txt"],"tags":["mlflow","pip","wheels","subprocess","network"],"backgroundTag":"pip-wheel-download-failed","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}