Greetings again :-)
I'm mostly just feeling tired and responding somewhat at random. It's been a while because I got distracted by another project for several weeks. I've read enough tutorials, and explored enough code to be able, at the very least, to find most of the codes that the particular example I'm trying to run actually uses. One thing is very clear now: I'm a python novice. At least by the standards of this software. The only word I can use to describe the architecture so far is "extremely sophisticated", and I can claim at best a vague understanding of what it's doing. I think I had maybe one course on object oriented programming way back when, and haven't needed it since. I'm still at the stage of working my way through the "user interface". I was last looking at the __init__ of the "Solution" class, for example. It motivated me to attempt running the code and injecting print-statements so that it'll tell me what the different variables actually are, allowing me to trace what it's going to do. Assuming that that works.
..so I tracked down instructions on how to run the examples from the command-line. I followed the installation instructions way back when, and the examples it told me to run seemed to work. ..now.. (it's been a while)
the instruction is the following:
$ cd clawpack/pyclaw/examples/acoustics_1d_homogeneous
$ python acoustics.py iplot=1
In my case, acoustics doesn't exist, but acoustics_1d does.
it gives me the following:
(base) eriadar@eriadar-Latitude-E7440:~/clawpack/pyclaw/examples/acoustics_1d_homogeneous$ python acoustics_1d.py iplot=1
Traceback (most recent call last):
File "/home/eriadar/clawpack/pyclaw/examples/acoustics_1d_homogeneous/acoustics_1d.py", line 22, in <module>
from clawpack import riemann
ModuleNotFoundError: No module named 'clawpack'
..so I assume I must have a non-standard installation somehow.
for kicks, I also tried your instructions,
"> from clawpack import pyclaw
> pyclaw.ClawSolver1D"
and got..
(base) eriadar@eriadar-Latitude-E7440:~$ python
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from clawpack import pyclaw
>>> pyclaw.ClawSolver1D
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'clawpack.pyclaw' has no attribute 'ClawSolver1D'
>>>
..I'm in anaconda -> [you can see the (base)], would that mess things up?
I found ClawSolver1D somehow.. I think maybe grep helped me with that..
it's in:
/clawpack/pyclaw/src/pyclaw/classic ..though of course you know that.. (it's a class, right?)
..I've now gone back to the top of the "testing a pyclaw installation", and tried running:
cd pyclaw/examples
nosetests
, seeing as my browser seemed to indicated that I had previously only tested the fortran installation. I ended up having to install nosetests again (is there a different version for python than for fortran?), and now it's giving me:
(base) eriadar@eriadar-Latitude-E7440:~/clawpack/pyclaw/examples$ nosetests
E
======================================================================
ERROR: Failure: ImportError (No module named numpy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/eriadar/clawpack/pyclaw/examples/__init__.py", line 1, in <module>
from .advection_1d import advection_1d
File "/home/eriadar/clawpack/pyclaw/examples/advection_1d/advection_1d.py", line 19, in <module>
import numpy as np
ImportError: No module named numpy
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
...so.. maybe I need to install numpy for this particular virtual environment of anaconda?
(base) eriadar@eriadar-Latitude-E7440:~/clawpack/pyclaw/examples$ python
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(base) eriadar@eriadar-Latitude-E7440:~/clawpack/pyclaw/examples$ pip3 install numpy
Requirement already satisfied: numpy in /home/eriadar/anaconda3/lib/python3.11/site-packages (1.26.3)
..I see in the list of directories a mention of python 2.7. ..does that mean I should install python2? If I were convinced of that, I'd try it, but I'm not. The whole point of virtual environments, as I understand it, is to keep these versions separate..
..I'll keep poking it. I'll probably figure it out in a few days.. :-)