Python modules in ATS Docker Container

72 views
Skip to first unread message

Elizabeth Andrews

unread,
May 18, 2021, 1:53:42 PM5/18/21
to Amanzi-ATS Users
Hello,

I am new to ATS and have just started working in the ATS docker. I'm working through the Richard's Steady State demo problem and I converted the Jupyter notebook into a .py file so that I could run it in docker where the ATS_SRC_DIR exists. However, it can't seem to find the matplotlib module. Here is the issue I get:

amanzi_user@629cd9cdf940:~/amanzi/work$ python richards_ss.py
Traceback (most recent call last):
  File "richards_ss.py", line 5, in <module>
    import ats_xdmf
  File "/home/amanzi_user/amanzi/src/physics/ats/tools/utils/ats_xdmf.py", line 5, in <module>
    import matplotlib.collections
ModuleNotFoundError: No module named 'matplotlib'

Any advice you have on getting matplotlib into the docker container would be greatly appreciated.

Thanks!
Liz Andrews

--
Elizabeth Andrews
Ph.D. Candidate, Hydrology
Colorado School of Mines

David Moulton

unread,
May 19, 2021, 2:26:08 AM5/19/21
to Elizabeth Andrews, Amanzi-ATS Users
Hi Liz,

     We include mpi in the docker image, so for runs on your local machine you would include mpirun in the "docker run" command.  I created some documentation on the wiki


showing how to run demos and tests directly with "docker run".  Note that in most cases the demos and tests are small and intended to run in serial.  Documentation on running tests and demos from the included python scripts requires a bit more time, and a small fix in the supporting python.  I'll look at this shortly.

But for now please give this a try and let me know if it works, and what would be most helpful for you working through the demos.

Thanks, David

On Tue, May 18, 2021 at 4:54 PM Elizabeth Andrews <eandre...@gmail.com> wrote:
Hi David,

It wasn't until I ran the Richard's steady state solution inside the docker container that I got output into my local mounted directory. When I ran the mpirun script with the docker launch script, it completed but didn't provide any output other than screen output. The issue with the python notebook is that it requires an ATS_SRC_DIR to import the ATS file reader tools, like ats_xmdf. I tried to get around this by just pulling the amanzi and ats git repos into a local folder without building them. There seems to be a link between the amanzi/src/physics/ats folders that will likely only exist when they are both built though.

If you have suggestions for getting around this, or if I'm using the python notebook incorrectly, please let me know.

Thanks,
Liz

On Tue, May 18, 2021 at 1:58 PM David Moulton <moultond...@gmail.com> wrote:
Hi Liz, 

    The way we set up the Docker image is so you can use it as if it were a local executable on your system.   This means we don't intend you to be working in the image (which does not have matplotlib), but rather work on your local system in the python/jupyter environment there, and use the docker image to execute the ATS runs.  It's true we've tested and worked with more on the command line so I probably need to provide much better instructions for both command line and jupyter.     

I hope this makes sense.  Let me know if you have questions and I'll work on updating the wiki page on using Docker images. 

Thanks, David


--
You received this message because you are subscribed to the Google Groups "Amanzi-ATS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-users/7bad30af-4043-4bf4-81cd-d6c5d2b42a56n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages