Solved: disable gpu in jupyter notebook in tensorflow

GPU is a powerful tool for accelerating computations on large data sets. However, disabling the GPU can sometimes be necessary in order to improve performance. One common reason for disabling the GPU is when using TensorFlow on a laptop or desktop computer with limited resources. Disabling the GPU can also improve performance when using TensorFlow on a mobile device.

import os

The first line imports the os module. The second line sets the environment variable CUDA_VISIBLE_DEVICES to -1. This tells TensorFlow not to use any GPUs.

Jupyter Notebook

Jupyter Notebook is a web application that allows you to create and share documents with others in a collaborative environment. It includes features such as rich text formatting, live code editing, and automatic document generation.


TensorFlow is a library for data analysis and machine learning. It allows you to create custom models and algorithms to accelerate the training of those models. TensorFlow can be used in Python, which makes it easy to get started.


GPU in Python is a powerful tool that can be used for a variety of tasks, including graphics processing, machine learning, and scientific computing. GPUs are specialized microprocessors that are designed for high-performance graphics rendering and deep learning. Python provides a convenient wrapper for the CUDA library, which makes it easy to access GPU resources.

Related posts:

Leave a Comment