Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify additional steps to utilize GPU for Linux users #2299

Merged
merged 15 commits into from
Sep 5, 2024
46 changes: 44 additions & 2 deletions site/en/install/pip.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,25 @@ The following NVIDIA® software are only required for GPU support.
nvidia-smi
```

### 3. Install TensorFlow
### 3. Create a virtual environment with [venv](https://docs.python.org/3/library/venv.html){:.external}

The venv module is part of Python’s standard library and is the officially recommended way to create virtual environments.

Navigate to your desired virtual environments directory and create a new venv environment named `tf` with the following command.

```bash
python3 -m venv tf
```

You can activate it with the following command.

```bash
source tf/bin/activate
```

Make sure that the virtual environment is activated for the rest of the installation.

### 4. Install TensorFlow

TensorFlow requires a recent version of pip, so upgrade your pip
installation to be sure you're running the latest version.
Expand All @@ -211,7 +229,31 @@ The following NVIDIA® software are only required for GPU support.
pip install tensorflow
```

### 4. Verify the installation
**Note:** Do not install TensorFlow with `conda`. It may not have the latest stable version. `pip` is recommended since TensorFlow is only officially released to PyPI.

### 5. Virtual environment configuration

You can skip this section if you only run TensorFlow on the CPU.

Note: Symbolic links are only necessary in case the intended way doesn't work, i.e. the components aren't being
MarkDaoust marked this conversation as resolved.
Show resolved Hide resolved
detected, and/or conflict with the existing system CUDA installation.

* Create symbolic links to NVIDIA shared libraries:

```bash
pushd $(dirname $(python -c 'print(__import__("tensorflow").__file__)'))
ln -svf ../nvidia/*/lib/*.so* .
popd
```

* Create a symbolic link to ptxas:

```bash
ln -sf $(find $(dirname $(dirname $(python -c "import nvidia.cuda_nvcc;
print(nvidia.cuda_nvcc.__file__)"))/*/bin/) -name ptxas -print -quit) $VIRTUAL_ENV/bin/ptxas
```

### 6. Verify the installation

Verify the CPU setup:

Expand Down