{"id":7448,"library":"neptune","title":"Neptune Client","description":"Neptune is an MLOps platform for experiment tracking and model management, focusing on machine learning metadata. The `neptune-client` Python library provides the interface to log, store, display, and compare MLOps artifacts and metadata directly from your code. It is currently at version 1.14.0.post2, with active development including an upcoming 2.x branch, and releases frequent updates.","status":"active","version":"1.14.0.post2","language":"en","source_language":"en","source_url":"https://github.com/neptune-ai/neptune-client","tags":["MLOps","experiment tracking","machine learning","logging","model management"],"install":[{"cmd":"pip install neptune","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"`neptune.init()` was the entry point in versions <1.0.0 and is now deprecated. Use `neptune.init_run()` for current versions.","wrong":"import neptune\nrun = neptune.init(...)","symbol":"init_run","correct":"import neptune\nrun = neptune.init_run(...)"},{"note":"Can be used for type hinting or direct instantiation if desired, though `neptune.init_run()` is the primary way to get a Run object.","symbol":"Run","correct":"from neptune import Run"}],"quickstart":{"code":"import neptune\nimport os\nimport random\n\n# Initialize a new Neptune run\n# Replace 'YOUR_WORKSPACE/YOUR_PROJECT_NAME' with your actual project name, e.g., 'common/quickstart-python'\n# Set NEPTUNE_API_TOKEN and NEPTUNE_PROJECT as environment variables for production use.\nrun = neptune.init_run(\n    project=os.environ.get(\"NEPTUNE_PROJECT\", \"common/quickstart-python\"),\n    api_token=os.environ.get(\"NEPTUNE_API_TOKEN\", \"YOUR_NEPTUNE_API_TOKEN\"), # Replace with your token if not using env var\n    name=\"Minimal Example\",\n    tags=[\"quickstart\", \"example\"]\n)\n\n# Log some parameters\nparams = {\"learning_rate\": 0.001, \"optimizer\": \"Adam\"}\nrun[\"parameters\"] = params\n\n# Log some metrics\nfor i in range(10):\n    run[\"train/loss\"].append(random.uniform(0.1, 0.9))\n    run[\"train/accuracy\"].append(random.uniform(0.5, 0.99))\n\n# Log a model checkpoint placeholder (e.g., a path or a link)\nrun[\"model_checkpoints/best_model\"].track_files(\"s3://my-bucket/models/best_model.pth\")\n\n# Stop the run\nrun.stop()\n\nprint(f\"Neptune run URL: {run.get_url()}\")","lang":"python","description":"This quickstart initializes a Neptune run, logs basic parameters and metrics, tracks a placeholder for a model checkpoint, and then stops the run. Ensure you have your `NEPTUNE_API_TOKEN` and `NEPTUNE_PROJECT` (e.g., 'your_workspace/your_project') set as environment variables or passed directly to `init_run`."},"warnings":[{"fix":"Upgrade your Python environment to 3.8 or a later compatible version (e.g., 3.9, 3.10, 3.11).","message":"Python 3.7 is no longer supported. Ensure your environment uses Python 3.8 or newer.","severity":"breaking","affected_versions":">=1.12.0"},{"fix":"Refer to Neptune's official documentation for updated methods to manage models and model versions using the `neptune.init_model()` and `neptune.init_model_version()` functions.","message":"The `model` and `model_version` endpoints within the Neptune API are deprecated. Users should migrate to the new `Model` and `ModelVersion` objects.","severity":"deprecated","affected_versions":">=1.12.0"},{"fix":"Replace all instances of `neptune.init()` with `neptune.init_run()` for initializing experiment runs.","message":"The `neptune.init()` function is deprecated. Using it will lead to warnings and potentially errors in future versions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For smaller HTML objects, especially with Neptune SaaS, pass `include_plotlyjs='cdn'` to the `upload()` or `as_html()` method, which loads Plotly.js from a CDN.","message":"When uploading HTML objects with `run['path'].upload()` or using `File.as_html()`, the default behavior is to embed the entire Plotly.js library (approx. 3MB) within the HTML. For Neptune SaaS users, this can significantly increase object size.","severity":"gotcha","affected_versions":">=1.13.0"},{"fix":"Define `NEPTUNE_API_TOKEN` and `NEPTUNE_PROJECT` in your environment or explicitly pass `api_token` and `project` arguments to `neptune.init_run()`.","message":"You must set the `NEPTUNE_API_TOKEN` and `NEPTUNE_PROJECT` environment variables or pass them directly to `neptune.init_run()` to connect to your Neptune project. Forgetting to do so is a common cause of connection errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Set the `NEPTUNE_API_TOKEN` environment variable with your personal API token (found in Neptune UI, Account Settings -> API Tokens), or pass `api_token='YOUR_API_TOKEN'` directly to `neptune.init_run()`.","cause":"The Neptune API token is not configured.","error":"NeptuneMissingApiTokenException: 'NEPTUNE_API_TOKEN' environment variable not found. Please set it or pass `api_token` to `neptune.init_run()`."},{"fix":"Set the `NEPTUNE_PROJECT` environment variable to your project's identifier (e.g., 'your_workspace/your_project'), or pass `project='your_workspace/your_project'` directly to `neptune.init_run()`.","cause":"The target Neptune project is not specified.","error":"NeptuneMissingProjectException: 'NEPTUNE_PROJECT' environment variable not found. Please set it or pass `project` to `neptune.init_run()`."},{"fix":"Update your code to use `neptune.init_run()` instead of `neptune.init()`.","cause":"Attempting to use the old `neptune.init()` function which has been replaced.","error":"AttributeError: module 'neptune' has no attribute 'init'"}]}