If your MinerU environment reports something like this after checking PyTorch:
|
|
You can basically confirm that the current environment has the CPU-only PyTorch build installed, so MinerU will not use the NVIDIA GPU. Even if the machine has an RTX 4060, MinerU can only run on CPU as long as torch in that Python environment is the CPU build.
The fix is straightforward: in the same .venv, replace torch and torchvision with the CUDA build. For PyTorch 2.8.0, the official CUDA 12.8 wheels are available, so you can install the cu128 build directly.
First check the NVIDIA driver
Run this in PowerShell:
|
|
Normally, you should see something like:
|
|
The CUDA Version shown here is the highest CUDA version supported by the current graphics driver. As long as nvidia-smi can detect the GPU, you usually do not need to install the full CUDA Toolkit separately.
If nvidia-smi cannot detect the GPU at all, do not start with PyTorch. Update or reinstall the NVIDIA driver first.
Enter the virtual environment used by MinerU
Go to the MinerU project directory. Here C:\Work\test is used as an example:
|
|
If the project uses .venv, activate it:
|
|
Confirm the current Python path:
|
|
It should point to a path like:
|
|
This step matters. You need to replace PyTorch in the Python environment that MinerU actually uses, not the system Python, another Conda environment, or a random interpreter selected by VS Code.
Uninstall the CPU PyTorch build
After confirming that .venv is active, uninstall the current CPU build:
|
|
If you do not use uv, regular pip can also work, but it is better not to mix tools inside the same environment. This guide continues with uv pip.
Install the CUDA 12.8 PyTorch build
Install the CUDA 12.8 build matching PyTorch 2.8.0:
|
|
The official version pairing is:
|
|
The CUDA PyTorch download can be large, often several GB. Be patient if the network is slow.
If uv says the package is already installed but your check still shows the CPU build, force a reinstall:
|
|
Verify that CUDA is available
Run:
|
|
The correct result should look like:
|
|
The most important line is:
|
|
If it is still False, PyTorch still cannot use CUDA. Common causes include installing into the wrong environment, still having the CPU build of torch, a broken NVIDIA driver, or using a Python interpreter different from MinerU’s .venv.
Run a real GPU computation
Seeing CUDA available: True is useful, but you can also run a real CUDA tensor operation:
|
|
A normal result looks like:
|
|
This means PyTorch not only detects the GPU, but can actually run CUDA computation on the RTX 4060.
Watch the GPU while running MinerU
Open a second PowerShell window and monitor the GPU:
|
|
Then run MinerU in the first window:
|
|
If the virtual environment is not activated, call the executable inside .venv directly:
|
|
Watch nvidia-smi. If the following signs appear, MinerU is very likely using the RTX 4060:
python.exeappears.- VRAM usage increases.
GPU-Utilrises during inference.- VRAM is released after MinerU exits.
How to think about RTX 4060 and MinerU modes
RTX 4060 belongs to NVIDIA’s 40 series, the Ada Lovelace architecture, which is within the hardware range supported by MinerU GPU acceleration. After the correct CUDA PyTorch build is installed, the normal mineru command can use the GPU.
If you explicitly specify:
|
|
it is more focused on stability and compatibility, and is also suitable for CPU fallback or low-VRAM cases. If you want to use modes such as hybrid-engine or vlm-engine, which depend more on VLM, it is even more important to confirm that CUDA PyTorch is installed correctly.
Common pitfalls
First, installing into the wrong environment. The most common issue is installing CUDA PyTorch into one Python environment while MinerU actually runs in another .venv. Always check:
|
|
Second, checking only the driver, not PyTorch. A normal nvidia-smi only proves that the driver sees the GPU. It does not prove that PyTorch inside Python supports CUDA. The final check is still:
|
|
Third, confusing CUDA Toolkit with PyTorch CUDA. For most normal use cases, you do not need to install the full CUDA Toolkit separately. If the NVIDIA driver works, installing the official PyTorch CUDA wheel is enough.
Fourth, VRAM may be occupied by other programs. RTX 4060 8GB can run these workloads, but the margin is not huge. Before running MinerU, close games, browser hardware acceleration, other AI inference programs, and software that occupies VRAM.
One-line summary
If you see:
|
|
then MinerU cannot use the RTX 4060 in the current environment. The correct approach is to uninstall the CPU builds of torch and torchvision in the same .venv, then install:
|
|
When the verification changes to:
|
|
run MinerU again and use nvidia-smi -l 1 to watch python.exe, VRAM, and GPU utilization. That is how you confirm whether GPU acceleration is really active.