pycuda
Python wrapper for Nvidia CUDA
Decision gist · record as of 2026-08-14
Yes, if you have an Nvidia GPU and need direct, low-level access to CUDA from Python. The high install friction (compiled C++ component, CUDA toolkit requirement) and active maintenance make it suitable for serious GPU computing work. Skip it if you need quick prototyping without system-level setup, or if you can use higher-level frameworks like CuPy or PyTorch instead.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Nvidia CUDA toolkit installed on the system and a compatible Nvidia GPU; compilation during install needs a C++ compiler and CUDA headers.
- Installation friction is high—the package requires a compiled C++ component and CUDA toolkit presence on the system.
- Maintenance is active with recent commits and a stable release cadence since 2008, but the high barrier to entry means setup demands careful environment preparation.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution. You can integrate PyCUDA into commercial or proprietary projects without licensing obligations.
last release 2026-01-15 (211 days) · last repo commit 2026-07-16 · 2,050 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 86,454 downloads/mo, #13,862 on PyPI
Alternatives
Verify before relying
pip install pycuda
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
mod = SourceModule("""__global__ void add(float *a, float *b) { ... }""")
add = mod.get_function("add")- Whether the package works with recent CUDA versions (12.x+) or has known compatibility gaps.
- Performance characteristics compared to alternatives like CuPy or Numba for typical workloads.
- Whether the C++ base layer introduces significant overhead for small kernels or memory transfers.
What it is and what it does
PyCUDA is a Python wrapper around Nvidia's CUDA driver API that lets you write GPU-accelerated code without leaving Python. It abstracts away low-level CUDA complexity while exposing the full power of the driver API when needed. The package uses RAII (Resource Acquisition Is Initialization) to tie GPU memory and context cleanup to Python object lifetimes, eliminating manual resource management and preventing leaks. It includes high-level abstractions like SourceModule for compiling CUDA kernels and GPUArray for working with GPU memory, plus automatic error translation from CUDA errors into Python exceptions.
The core layer is written in C++, so the convenience abstractions carry minimal overhead. PyCUDA depends on pytools, platformdirs, and mako for code generation and utility functions. It requires Python 3.8+ and an Nvidia GPU with the CUDA toolkit installed; installation involves compiling C++ code, making setup more involved than pure-Python packages. The project is actively maintained with a long history since 2008 and carries no known security vulnerabilities.
Use it for
- Accelerate numerical simulations and scientific computing by offloading compute-intensive kernels to GPU.
- Build custom CUDA kernels for machine learning preprocessing or inference steps not covered by high-level frameworks.
- Prototype GPU algorithms in Python before optimizing them in C++ or CUDA.
- Interoperate between Python code and existing CUDA libraries or OpenGL graphics pipelines.
- Manage GPU memory and multi-GPU coordination in research or data-processing pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have an Nvidia GPU and need direct, low-level access to CUDA from Python.
The high install friction (compiled C++ component, CUDA toolkit requirement) and active maintenance make it suitable for serious GPU computing work. Skip it if you need quick prototyping without system-level setup, or if you can use higher-level frameworks like CuPy or PyTorch instead.
Install
pycuda on PyPI
Before you install
Installation friction is high—the package requires a compiled C++ component and CUDA toolkit presence on the system. Maintenance is active with recent commits and a stable release cadence since 2008, but the high barrier to entry means setup demands careful environment preparation.
Requires Nvidia CUDA toolkit installed on the system and a compatible Nvidia GPU; compilation during install needs a C++ compiler and CUDA headers.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution. You can integrate PyCUDA into commercial or proprietary projects without licensing obligations.
Quickstart
pip install pycuda
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
mod = SourceModule("""__global__ void add(float *a, float *b) { ... }""")
add = mod.get_function("add")
Verify before relying
- Whether the package works with recent CUDA versions (12.x+) or has known compatibility gaps.
- Performance characteristics compared to alternatives like CuPy or Numba for typical workloads.
- Whether the C++ base layer introduces significant overhead for small kernels or memory transfers.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release ~=3.8 |
| Install friction | High. Source build required |
| Runtime dependencies | 3 packagespytoolsplatformdirsmako |
| Maintenance | Actively maintained 211 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 86,454 / month, #13,862 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Other AudienceIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: C++Programming Language :: PythonProgramming Language :: Python :: 3Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: PhysicsTopic :: Scientific/Engineering :: Visualization |
Evidence: pycuda-2026.1.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also nvidia-cuda-runtime · pyopencl · cuda-python · nvidia-cuda-crt · nvidia-cuda-runtime-cu11 · nvshmem4py-cu13 · cuda-core · nvidia-cuda-runtime-cu12 · nvidia-ml-py3 · nvidia-ml-py