PyPlot on remote server

Hello, I am used to the Python Matplotlib package for plotting figures, which is packaged as PyPlot in Julia. When I want to use it for plotting on a remote server, which does not support GUI, I want to save the plot to a file. However, when I type “using PyPlot”, Julia says:

Unable to init server: Could not connect: Connection refused

even if I put backend: Agg to avoid using GUI in “~/.config/matplotlib/matplotlibrc”.
Does anyone know how to solve the problem?
Thanks!