pyscf / pyscf/gpu4pyscf

Bug: cusolver.py fails to find library in wsl2 miniconda3/conda environments using nvidia-cusolver-cu12

Open
#646 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cuda
Stars
351
Forks
84
Avg merge
3d 2h
Merged PRs (30d)
35

Description

It actually isn't an issue, but a concern I want to raise for the devs of GPU4Pyscf.

The current implementation uses ctypes.util.find_library('cusolver'). In many modern Python environments (like Conda on WSL2), libraries installed via pip install nvidia-cusolver-cu12 are located inside the site-packages/nvidia/ subdirectories. find_library does not scan these paths, leading to an ImportError or AttributeError regarding missing symbols (e.g., cusolverDnDsygvd_bufferSize).

This leads to "lubcusolver.so.11 not found error " even when it is explicitly installed in isolated modern wsl2/conda environments where the packages are in a different subfolder system.

This legacy find_library works perfectly fine for non-isolated systems, but fails in modern isolated containers/conda environments adn others....

Suggested Fix for the devs: Instead of find_library, use a relative path lookup from the nvidia.cusolver module or use importlib.resources to locate the .so file within the package directory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting cusolver.py and reproducing the import in a WSL2 Conda environment with nvidia-cusolver-cu12 installed. Check how the current library lookup behaves when the shared library is under the nvidia package directories. Done means the library is found and symbols such as cusolverDnDsygvd_bufferSize load without an ImportError or AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.