Reticulate is a handy way to combine Python and R code. From the reticulate help page suggests that reticulate allows for: "Calling Python from R in a variety of ways including R Markdown, sourcing ...
The import statement for mpmath is incorrect, as noted, but it is a common mistake because of the way NumPy is usually (correctly) imported. The programmer thought they were setting the dps (decimal ...