beat
beat copied to clipboard
beat sample Laquila error
Hello,
I am trying to complete Example 3[https://hvasbath.github.io/beat/examples/Rectangular.html] from the tutorial.
I have completed part of the tutorial, however, when I attempt to run beat sample Laquila
I get an error message that I have trouble interpreting. The message is quite long, and in addition to pasting it below, I have attached it in a text file if that is easier to read.
I have also included my config_geometry.yaml file if that helps.
I am using a Mac running Mojave 10.14.6.
Please let me know where to start fixing this, and how I can help troubleshoot!
Here is the full message: (beat) MT-109587:BEATexamples rzinke$ beat sample Laquila config - INFO All hierarchicals ok! config - INFO All hyperparameters ok! config - INFO All priors ok! models - INFO ... Initialising Geometry Optimizer ...
models - INFO Analysing problem ... models - INFO ---------------------
geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! geodetic - INFO Fit residual ramp selected! heart - INFO Consistent number of datasets and targets in any_P_0 wavemap! heart - INFO Number of seismic datasets for wavemap: any_P_0: 35 models - INFO ... Building model ...
models - INFO Optimization for 3 hyperparameters in total! geodetic - INFO Geodetic optimization on: depth, dip, east_shift, length, north_shift, rake, slip, strike, width
You can find the C code in this temporary file: /var/folders/5c/g4x7qt9s26gc2x5yj1dtynmh0000gp/T/theano_compilation_error_ybz83ftz
Traceback (most recent call last):
File "/Users/rzinke/opt/miniconda3/envs/beat/bin/beat", line 33, in
I never had that issue before. Theano cannot compile the function is what the error is saying. Similar to your earlier issues with compiling the fomosto programs it is likely a problem with finding and or linking your compiler. In this case gcc ... Can you run gcc successfully in your commandline?
Hi @hvasbath, yes it appears so:
(beat) MT-109587:BEATexamples rzinke$ gcc
clang: error: no input files
It also seems that Theano works properly:
(beat) MT-109587:beat rzinke$ THEANO_FLAGS=mode=FAST_RUN,device=cpu,floatX=float32 python3 test/gpu_test.py
[Elemwise{exp,no_inplace}(<TensorType(float32, vector)>)]
Looping 1000 times took 0.874465 seconds
Result is [1.2317803 1.6187934 1.5227807 ... 2.2077181 2.2996776 1.6232328]
Used the cpu
There were also some directory paths in the config_geometry.yaml file that I was unsure of. For example, where should
geodetic_config: !beat.GeodeticConfig
datadir: /home/vasyurhm/BEATS/RectangularStatic/insar
names:
- Laquila_dscxn
- Laquila_ascxn
point? I cannot find any files named Laquila_dscxn/ascxn. Should those already exist?
They are stored in the pickle file in the data geodetic_data.pkl. See https://hvasbath.github.io/beat/getting_started/import_data.html#insar. If you for some reason want the kite container data we uploaded them here: https://github.com/braunfuss/laquila_kite_container
To me this does not some like a beat issue but a installation issue on your side.
So gcc seems to be working fine and theano also compiles the simple example. What theano version are you using?
In [1]: import theano
In [2]: theano.version.full_version
Out[2]: '1.0.4'
Can you also please try to clear your theano cache with theano-cache purge
My theano version is 1.0.4
After running theano-cahce purge
in the shell, then rerunning beat sample Laquila, I still get the same error message.
hm I dont know- you will need to do some digging yourself in the theano forum and issues on github. I think its a compiler issue and goes in line with all these other compiler issues you reported ... You are the first one to report these ... its really strange
Okay, thanks for your assistance looking into this @hvasbath. I'll let you know what I find out.
Here is an issue another person had, but already during import. Nevertheless you might be able to find some hints. https://github.com/Theano/Theano/issues/6645
Also there is this theano google group you could search for similar issues: https://groups.google.com/u/1/g/theano-users
Thanks, Hannes. I'll take a look!
Hi @rzinke - I was just wondering whether you found the solution to this issue, as I get the exact same compilation error when trying to run Example 3 of BEAT on Mac OS 12.0.1 Monterey? I installed BEAT through the Anaconda package manager following the website instructions, and everything else seems to work ok
Looks like it is something to do with Theano and not BEAT directly, but I cannot work out what it might be.
Hi @samwimpenny ,
does your gcc compiler work? Did you try some of the suggestions that are linked in the theano issue? Apparently, the theano version hosted on anaconda is mixing up the system linkers to different C compilers on macOS.
Proposed solutions: Try installing theano through pip (please make sure to uninstall the conda installed theano and to have the environment activated) then:
pip install theano
For others creating symbolic links to the correct library helped:
https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15/58349403#58349403
My gcc compiler seems to work fine:
(beat) MacBook-Pro-2:SLIPMODELS samwimpenny$ gcc
clang: error: no input files
I first tried installing theano through pip. To remove theano from the conda environment I first just tried conda remove theano
, but that wanted to remove a whole load of other dependencies, so I used conda remove theano --force
.
I then ran pip install theano==1.0.4
, which threw up a dependency warning:
... Successfully built theano ERROR: beat 1.1.1 has requirement matplotlib<=3.1.1, but you'll have matplotlib 3.3.4 which is incompatible. Installing collected packages: theano Successfully installed theano-1.0.4
Then trying to run beat sample Laquila
just gives the same error as before.
I also tried the solutions from https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15/58349403#58349403 after removing and reinstalling beat from scratch through Anaconda. Sym-linking the C header library to /usr/include
and explicitly setting the $CPATH
to the directory with the C headers didn't seem to work either for me - I just get the same error @rzinke got again.
Not sure what else to do, but I'll keep looking.
I have a colleague who successfully installed it on anaconda with MAC I will ask him ...
Hi @samwimpenny unfortunately I didnt hear back from my colleague yet. Next week I will have a zoom call with him- I hope to ask him then. Do you have any update on that issue?
No problem. I haven't made any progress yet, as I've been away for a couple of weeks. I'll be sure to let you know if I can get a workaround going.
We have been looking into that in more detail. Apparently, it has to do with newer MACs and clang as the default C compiler. We did not succeed getting it running. Likely theano is getting to old. The solution is to update BEAT to use pymc4. However, thats a major endeavour, but is needed for also other features that are planned. So eventually its going to happen at some point in time ... stay tuned.
One user @JJaraG managed to install it on M1 using:
- I create an environment using python3.8
- I have installed everything always using CXX=g++ CC=gcc LD=g++ (in my case gcc-12): pip and python
- I have installed numpy==1.22.4 and wheel
- I have installed pyrocko (through pyrocko install script)
- I have installed Theano
- I have installed beat, using pip
- I have created in my home the .theanorc with the following commands:
[global]
cxx=/opt/homebrew/bin/g++
BEAT version 2 should be now easy and straightforward to be installed and executed. Theano dependency was dropped.