Axisymmetric viscoelastic pipe flow of Oldroyd-B fluids has been recently found to be linearly unstable by Garg et al. (Phys. Rev. Lett., vol. 121, 2018, 024502). From a nonlinear point of view, this means that the flow can transition to turbulence supercritically, in contrast to the subcritical Newtonian pipe flows. Experimental evidence of subcritical and supercritical bifurcations of viscoelastic pipe flows have been reported, but these nonlinear phenomena have not been examined theoretically. In this work, we study the weakly nonlinear stability of this flow by performing a multiple-scale expansion of the disturbance around linear critical conditions. The perturbed parameter is the Reynolds number with the others being unperturbed. A third-order Ginzburg–Landau equation is derived with its coefficient indicating the bifurcation type of the flow. After exploring a large parameter space, we found that polymer concentration plays an important role: at high polymer concentrations (or small solvent-to-solution viscosity ratio
$\beta \lessapprox 0.785$
), the nonlinearity stabilizes the flow, indicating that the flow will bifurcate supercritically, while at low polymer concentrations (
$\beta \gtrapprox 0.785$
), the flow bifurcation is subcritical. The results agree qualitatively with experimental observations where critical
$\beta \approx 0.855$
. The pipe flow of upper convected Maxwell fluids can be linearly unstable and its bifurcation type is also supercritical. At a fixed value of
$\beta$
, the Landau coefficient scales with the inverse of the Weissenberg number (
$Wi$
) when
$Wi$
is sufficiently large. The present analysis provides a theoretical understanding of the recent studies on the supercritical and subcritical routes to the elasto-inertial turbulence in viscoelastic pipe flows.