You can install any non-standard modules on the Jobe server first (probably just a one-line command) and then you can import it as usual.
Or, if you have the non-standard module available in a suitable form, you can add it to a question or question prototype as a support file and import it from the working directory. That saves having to install it on the Jobe server, and is more maintainable. One of our standard in-house question type has a module as a .zip support file which we unzip and import in the template.
But the use of matplotlib is questionable. How are you going to capture, grade and display the output from matplotlib?
Richard