{"id":27452,"library":"tf-estimator-nightly","title":"TensorFlow Estimator (Nightly)","description":"Nightly build of TensorFlow Estimator, a high-level TensorFlow API that simplifies machine learning model training and evaluation. Current version 2.16.0.dev2024012409, released nightly. Should only be used with matching TensorFlow nightly builds.","status":"active","version":"2.16.0.dev2024012409","language":"python","source_language":"en","source_url":"https://github.com/tensorflow/estimator","tags":["tensorflow","estimator","nightly","machine-learning"],"install":[{"cmd":"pip install tf-estimator-nightly","lang":"bash","label":"Install nightly estimator"}],"dependencies":[{"reason":"Companion TensorFlow nightly build required; version mismatch may cause import errors or runtime crashes.","package":"tf-nightly","optional":false}],"imports":[{"note":"The correct import path is from tensorflow, not direct import of tf_estimator.","wrong":"import tf_estimator as estimator","symbol":"estimator","correct":"import tensorflow.compat.v1.estimator as estimator"}],"quickstart":{"code":"import tensorflow.compat.v1 as tf\ntf.disable_v2_behavior()\nimport tensorflow.compat.v1.estimator as estimator\n\n# Define a simple linear regressor\nfeature_columns = [tf.feature_column.numeric_column('x', shape=[1])]\nregressor = estimator.LinearRegressor(feature_columns=feature_columns)\n\n# Mock input function\ndef input_fn():\n    return {'x': [[1.0], [2.0], [3.0]]}, [1.0, 2.0, 3.0]\n\n# Train\nregressor.train(input_fn=input_fn, steps=100)\n\n# Predict\npredictions = regressor.predict(input_fn=input_fn)\ntry:\n    for i, p in enumerate(predictions):\n        print(p['predictions'])\n        if i > 2:\n            break\nexcept StopIteration:\n    pass","lang":"python","description":"Minimal example using tf.compat.v1.estimator with TF nightly."},"warnings":[{"fix":"Install both nightly packages from the same date: pip install tf-nightly tf-estimator-nightly","message":"tf-estimator-nightly requires a matching tf-nightly version. Mixing releases will cause import failures like 'cannot import name'.","severity":"breaking","affected_versions":"All"},{"fix":"Consider migrating to tf.keras or Keras 3 for active development.","message":"TensorFlow Estimator is in maintenance mode; Keras is the preferred high-level API. New features are only added to Keras.","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Use from tensorflow.compat.v1 import estimator","message":"Importing directly from tf_estimator (e.g., import tf_estimator) will fail because the package is a namespace package inside TensorFlow.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import tensorflow.compat.v1.estimator as estimator","cause":"Attempting to import tf_estimator directly instead of using the TensorFlow submodule.","error":"ModuleNotFoundError: No module named 'tf_estimator'"},{"fix":"Use import tensorflow.compat.v1.estimator as estimator","cause":"Using TensorFlow 2.x without compat.v1; estimator is removed from TF2 core.","error":"AttributeError: module 'tensorflow' has no attribute 'estimator'"},{"fix":"Reinstall both packages with matching dates: pip install --upgrade tf-nightly tf-estimator-nightly","cause":"Version mismatch between tf-estimator and tf-nightly.","error":"ImportError: cannot import name 'LinearRegressor' from 'tensorflow_estimator.python.estimator.canned.linear' (unknown location)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}