Skip to content
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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