The vertex PI index $PI(G) = sum_{xy in E(G)} [n_{xy}(x) + n_{xy}(y)]$ is a distance-based molecular structure descriptor, where $n_{xy}(x)$ denotes the number of vertices which are closer to the vertex $x$ than to the vertex $y$ and which has been the considerable research in computational chemistry dating back to Harold Wiener in 1947. A connected graph is a cactus if any two of its cycles have at most one common vertex. In this paper, we completely determine the extremal graphs with the greatest and smallest vertex PI indices mong all cacti with a fixed number of vertices. As a consequence, we obtain the sharp bounds with corresponding extremal cacti and extend a known result.