{"id":24691,"library":"tensorflow-gpu","title":"TensorFlow GPU","description":"DEPRECATED – You should install 'tensorflow' instead. Since TensorFlow 2.11, the GPU support is built into the main tensorflow package for Windows and Linux. The tensorflow-gpu package on PyPI is now a dummy package that simply installs tensorflow. It was removed entirely as of version 2.12.0. Previous breaking changes include Python 3.6 support dropped in 2.1.0 and the legacy TF 1.x API removal in 2.0.","status":"deprecated","version":"2.12.0","language":"python","source_language":"en","source_url":"https://github.com/tensorflow/tensorflow","tags":["tensorflow","gpu","deep-learning","deprecated","machine-learning"],"install":[{"cmd":"pip install tensorflow","lang":"bash","label":"Recommended install (replaces tensorflow-gpu)"},{"cmd":"pip install tensorflow-gpu==2.11.0","lang":"bash","label":"Last standalone version (if needed)"}],"dependencies":[],"imports":[{"note":"The package name is tensorflow, regardless of GPU or CPU. Use 'import tensorflow' and TF will automatically use GPU if available.","wrong":"import tensorflow-gpu as tf","symbol":"tensorflow","correct":"import tensorflow as tf"},{"note":"is_gpu_available() is deprecated since TF 2.1.0 and removed in TF 2.11. Use tf.config.list_physical_devices('GPU') instead.","wrong":"tf.test.is_gpu_available()","symbol":"tf.test.is_gpu_available","correct":"import tensorflow as tf; tf.config.list_physical_devices('GPU')"}],"quickstart":{"code":"import tensorflow as tf\nimport os\n\n# Check GPU availability\nphysical_devices = tf.config.list_physical_devices('GPU')\nif len(physical_devices) > 0:\n    print(\"GPU available:\", physical_devices)\nelse:\n    print(\"No GPU found.\")\n\n# Simple matrix multiplication\nimport numpy as np\na = tf.constant(np.random.rand(1000, 1000))\nb = tf.constant(np.random.rand(1000, 1000))\nc = tf.matmul(a, b)\nprint(\"Result shape:\", c.shape)","lang":"python","description":"Basic GPU check and matrix multiplication."},"warnings":[{"fix":"Run 'pip uninstall tensorflow-gpu' and 'pip install tensorflow'.","message":"tensorflow-gpu is no longer a separate package. Install 'tensorflow' for both CPU and GPU support.","severity":"deprecated","affected_versions":">=2.12.0"},{"fix":"Use Python 3.7 or later.","message":"Python 3.6 support was dropped in TensorFlow 2.1.0.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Migrate code to use eager execution and Keras API. See official migration guide.","message":"TensorFlow 2.0 removed legacy TF 1.x API (tf.Session, tf.Graph, etc.)","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Check official compatibility matrix at tensorflow.org/install/source#gpu","message":"CUDA and cuDNN version mismatches cause runtime errors. TensorFlow requires specific versions.","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' after installing 'tensorflow' (pip install tensorflow).","cause":"The tensorflow-gpu package has been removed from PyPI since version 2.12.0.","error":"ModuleNotFoundError: No module named 'tensorflow-gpu'"},{"fix":"Use tf.config.list_physical_devices('GPU') to check GPU availability.","cause":"tf.test.is_gpu_available() was removed in TensorFlow 2.11.","error":"ImportError: cannot import name 'is_gpu_available' from 'tensorflow.python.client'"},{"fix":"Enable TF 2.x behavior by default or rewrite using Keras API. Use tf.compat.v1 to retain v1 compatibility if necessary.","cause":"Legacy TF 1.x code using tf.Session() in TF 2.x with disabled v1 compatibility.","error":"RuntimeError: The Session graph is empty. Add operations to the graph before calling run()."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}