bcych / BiCEP_GUI

GUI for using the BiCEP method (Cych et al, 2021) on paleointensity data.
5 stars 3 forks source link

Win and docker not working #8

Closed MengqingWangCUG closed 5 months ago

MengqingWangCUG commented 5 months ago

Hello, I tried running your program on my Windows and Docker, but encountered the same issue, which prevents BiCEP_GUI from functioning properly. The problem occurs after clicking "Site process," and the following error appears:

Specimen Processing ./arai_data_example.csv Site:

BR06 Specimen:

BR06-3F Temperatures (Low):

0.0 (High):

580.0 Exclude Specimen

Specimen Plot Format:

pdf Site Processing n samples 3000 Sampler:

Fast, less accurate AttributeError Traceback (most recent call last) /BiCEP_functions.py in get_site_dist(a) 1911 model=model_circle_fast 1912 -> 1913 thellierData[site_wid.value].BiCEP_fit(model=model,n_samples=n_samples_wid.value) 1914 fit=thellierData[site_wid.value].fit 1915 display_sampler_diags(fit)

/BiCEP_functions.py in BiCEP_fit(self, n_samples, priorstd, model, kwargs) 426 fit_circle=model_circle.sampling ( 427 data={'I' (pTRMsList),'M' (lengths),'PTRM' ,'NRM' ,'N' ,'PTRMmax' ,'B_labs' ,'dmax' .sqrt(dmaxlist),'centroid' ,'priorstd' },iter=n_samples,warmup=int(n_samples/2), --> 428 init=[{'k_scale' .array(klist)np.array(dist_to_edgelist),'phi' ,'dist_to_edge' ,'int_real' }]4,kwargs) 429 self.fit=az.from_pystan(fit_circle) 430 #except:

/usr/local/lib/python3.7/site-packages/pystan/model.py in sampling(self, data, pars, chains, iter, warmup, thin, seed, init, sample_file, diagnostic_file, verbose, algorithm, control, n_jobs, **kwargs) 721 722 seed = pystan.misc._check_seed(seed) --> 723 fit = self.fit_class(data, seed) 724 725 m_pars = fit._get_param_names()

AttributeError: 'StanModel' object has no attribute 'fit_class'

It seems like there's an AttributeError with the 'StanModel' object not having the attribute 'fit_class'.

bcych commented 5 months ago

Hi Mengqing, I was able to reproduce this through a docker installed version of BiCEP_GUI. In the notebook try running the following: !pip install prophet. This fixed the problem for me. I'll add the prophet package to the list of pip dependencies. Thanks for the report!

bcych commented 5 months ago

I have updated the Dockerfile in the latest commit. Please do a git pull and then rebuild the docker container. It now automatically compiles the stan models for you.

As a side note, if you're using the docker container, your files won't be saved when you quit it, so you'll have to "download" them from the jupyter notebook server (the important ones are the magic files, the .redo file and the .nc files if you made any). You could look into Docker Volumes as a fix to this, but I haven't had time to try them out.

MengqingWangCUG commented 5 months ago

I have updated the Dockerfile in the latest commit. Please do a git pull and then rebuild the docker container. It now automatically compiles the stan models for you.

As a side note, if you're using the docker container, your files won't be saved when you quit it, so you'll have to "download" them from the jupyter notebook server (the important ones are the magic files, the .redo file and the .nc files if you made any). You could look into Docker Volumes as a fix to this, but I haven't had time to try them out.

Thank you very much, the new Docker is working properly. However, this is not an issue with Prophet. Installing Prophet in the old Docker did not work, and the same issue occurred on the Windows system.

bcych commented 5 months ago

You will also have to make sure that you have compiled the stan models. This can be done by running the compile_models.py script on Windows, and you need to run the !python compile_models.py line (commented out) in the old version of docker, as well as installing prophet. The new version I pushed compiles at build time so should work straight away.

MengqingWangCUG commented 5 months ago

Thank you, I didn't notice that compile_models.py failed to run. It is now working on both Windows and Docker. In case anyone encounters the same issue, I recommend referring to: https://pystan2.readthedocs.io/en/latest/windows.html