{"record":{"id":"3f1fb5f9c3f6cca5","repo":"mlflow/mlflow","slug":"you-need-to-set-either-johnsnowlabs-env-healthca","errorCode":null,"errorMessage":"You need to set either {_JOHNSNOWLABS_ENV_HEALTHCARE_SECRET} or {_JOHNSNOWLABS_ENV_VISUAL_SECRET} environment variable. Please contact John Snow Labs to get one.","messagePattern":"You need to set either (.+?) or (.+?) environment variable\\. Please contact John Snow Labs to get one\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"mlflow/johnsnowlabs/__init__.py","lineNumber":148,"sourceCode":"    # if json license is detected, we parse it and set the env vars\n    loaded_license = json.loads(os.environ[_JOHNSNOWLABS_ENV_JSON_LICENSE_KEY])\n    os.environ.update({k: str(v) for k, v in loaded_license.items() if v is not None})\n\n\ndef get_default_pip_requirements():\n    \"\"\"\n    Returns:\n        A list of default pip requirements for MLflow Models produced by this flavor.\n        Calls to :func:`save_model()` and :func:`log_model()` produce a pip environment\n        that, at minimum, contains these requirements.\n    \"\"\"\n    from johnsnowlabs import settings\n\n    if (\n        _JOHNSNOWLABS_ENV_HEALTHCARE_SECRET not in os.environ\n        and _JOHNSNOWLABS_ENV_VISUAL_SECRET not in os.environ\n    ):\n        raise Exception(\n            f\"You need to set either {_JOHNSNOWLABS_ENV_HEALTHCARE_SECRET} \"\n            f\"or {_JOHNSNOWLABS_ENV_VISUAL_SECRET} environment variable. \"\n            f\"Please contact John Snow Labs to get one.\"\n        )\n\n    _SPARK_NLP_JSL_WHEEL_URI = (\n        \"https://pypi.johnsnowlabs.com/{secret}/spark-nlp-jsl/spark_nlp_jsl-\"\n        + f\"{settings.raw_version_medical}-py3-none-any.whl\"\n    )\n\n    _SPARK_NLP_VISUAL_WHEEL_URI = (\n        \"https://pypi.johnsnowlabs.com/{secret}/spark-ocr/\"\n        f\"spark_ocr-{settings.raw_version_ocr}-py3-none-any.whl\"\n    )\n\n    deps = [\n        f\"johnsnowlabs_for_databricks=={settings.raw_version_jsl_lib}\",\n        _get_pinned_requirement(\"pyspark\"),","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/johnsnowlabs/__init__.py#L130-L166","documentation":"get_default_pip_requirements needs to build a wheel URI for the John Snow Labs healthcare/visual NLP libraries, which requires an JSL secret. It raises when neither the healthcare secret nor the visual secret environment variable is set, telling the user to obtain one from John Snow Labs.","triggerScenarios":"Calling get_default_conda_env / get_default_pip_requirements (indirectly via save_model/log_model metadata) without either secret env var set.","commonSituations":"Saving a JSL model without healthcare/visual NLP credentials; shared environments where only the license.json was provided but not the download secret.","solutions":["Set the healthcare secret env var (from John Snow Labs)","Or set the visual NLP secret env var if using Visual NLP","Contact John Snow Labs to obtain a secret if you don't have one"],"exampleFix":"// before\nmlflow.johnsnowlabs.save_model(...)\n// after\nexport JOHNSNOWLABS_HEALTHCARE_SECRET=xxxx\nmlflow.johnsnowlabs.save_model(...)","handlingStrategy":"validation","validationCode":"import os\nif not (os.environ.get(\"JOHNSNOWLABS_HEALTHCARE_SECRET\") or os.environ.get(\"JOHNSNOWLABS_VISUAL_SECRET\")):\n    raise RuntimeError(\"Set either the JSL healthcare or visual NLP secret env var\")","typeGuard":null,"tryCatchPattern":"try:\n    requirements = mlflow.johnsnowlabs.get_default_pip_requirements()\nexcept Exception as e:\n    if \"environment variable\" in str(e):\n        raise RuntimeError(\"Provide a JSL healthcare/visual secret from John Snow Labs\") from e\n    raise","preventionTips":["Inject both license and secret env vars together in CI/Docker","Know which JSL product (healthcare vs visual) you use and set the matching secret","Contact John Snow Labs early to obtain secrets for new environments"],"tags":["johnsnowlabs","env-var","license","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}