POWERSHELL INSTALL COMMAND
python -m venv c:/ZLAB201/myenv201
C:/ZLAB201/myenv201/Scripts/Activate.ps1
pip install torch==2.1.0+cu121 --index-url https://download.pytorch.org/whl/cu121
pip install numpy==1.26 pandas==2.2.3
check via python notebook:
check installed packages:
import sys
import os
import numpy
def test_environment():
print("Testing Virtual Environment: myenv")
print("Python Executable:", sys.executable)
print("Python Version:", sys.version)
# Checking if numpy is installed
try:
import numpy as np
print("NumPy Version:", np.__version__)
except ImportError:
print("NumPy is not installed. Installing it now...")
os.system("pip install numpy")
import numpy as np
print("NumPy Version after installation:", np.__version__)
if __name__ == "__main__":
test_environment()
Output:
Testing Virtual Environment: myenv
Python Executable: c:\ZML1\myenv1\Scripts\python.exe
Python Version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
NumPy Version: 1.26.0
check CUDA:
import torch
print("Torch Version:", torch.__version__)
print("CUDA Available:", torch.cuda.is_available())
print("CUDA Version:", torch.version.cuda)
print("GPU:", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "None")
Output:
Torch Version: 2.1.0+cu121
CUDA Available: True
CUDA Version: 12.1
GPU: NVIDIA GeForce RTX 3050 Ti Laptop GPU