Problems with using getdist plots and launching the GetDistGUI

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Forrest Lee
Posts: 4
Joined: January 05 2022
Affiliation: University of Chinese Academy of Science

Problems with using getdist plots and launching the GetDistGUI

Post by Forrest Lee » January 14 2022

Hi, everyone,
I have installed CosmoMC (the latest version cloned from Github, including getdist inside) and it successfully generated MCMC chains for a test. The generated files consist of [test.ranges, test.likelihoods, test.paramnames, test.inputparams, test_1.txt, test_1.data, ……test_8.txt, test_8.data]. Then I ran getdist by the command "./getdist distparams.ini" , it produced some files [test.py, test_tri.py, test_3D.py, test.margestats, test.likestats, test.covmat, test.corr]. However when I tried to make plots by "python test.py", I got the following error [ No module named 'getdist.chain_grid']

Code: Select all

[test@single outout]$ python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import getdist.plots as plots, os
  File "/home/myname/CosmoMC-master/python/getdist/plots.py", line 27, in <module>
    from getdist.chain_grid import is_grid_object, get_chain_root_files, ChainDirGrid, load_supported_grid
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'getdist.chain_grid'
Again, when I try to lunch the GetDistGUI by "python GetDistGUI.py", it display the same error [No module named 'getdist.chain_grid']

Code: Select all

(py39forge) [test@single python]$ python GetDistGUI.py
Traceback (most recent call last):
  File "/home/myname/CosmoMC-master/python/GetDistGUI.py", line 12, in <module>
    getdist_gui()
  File "/home/myname/CosmoMC-master/python/getdist/command_line.py", line 337, in getdist_gui
    from getdist.gui.mainwindow import run_gui
  File "/home/myname/CosmoMC-master/python/getdist/gui/mainwindow.py", line 40, in <module>
    from getdist import plots, IniFile, chains
  File "/home/myname/CosmoMC-master/python/getdist/plots.py", line 27, in <module>
    from getdist.chain_grid import is_grid_object, get_chain_root_files, ChainDirGrid, load_supported_grid
ModuleNotFoundError: No module named 'getdist.chain_grid'
I wonder what happend to the getdist.chain_grid module. Could you give me some clue to fix this problem?

Antony Lewis
Posts: 1936
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Problems with using getdist plots and launching the GetDistGUI

Post by Antony Lewis » January 14 2022

Check getdist folder is in your python path, that getdist.chain_grid.py does actually exist in your getdist folder, and that you don't have any old version of getdist pip installed.

You can also ignore the cosmomc getdist version (remove from path), and just install getdist from pip.

Forrest Lee
Posts: 4
Joined: January 05 2022
Affiliation: University of Chinese Academy of Science

Re: Problems with using getdist plots and launching the GetDistGUI

Post by Forrest Lee » January 14 2022

Problem solved. The CosmoMC package at Github https://github.com/cmbant/CosmoMC ommited the "chain_grid.py" file under the path CosmoMC/python/getdist/. People who clones the CosmoMC codes from Github should note that.

btw, "chain_grid.py" can be found at https://github.com/cmbant/getdist/tree/master/getdist .

Thanks for your attention.

Forrest Lee
Posts: 4
Joined: January 05 2022
Affiliation: University of Chinese Academy of Science

Re: Problems with using getdist plots and launching the GetDistGUI

Post by Forrest Lee » January 14 2022

Antony Lewis wrote:
January 14 2022
Check getdist folder is in your python path, that getdist.chain_grid.py does actually exist in your getdist folder, and that you don't have any old version of getdist pip installed.

You can also ignore the cosmomc getdist version (remove from path), and just install getdist from pip.
Dear Prof. Lewis,

Thanks for your reply.
The CosmoMC package at Github https://github.com/cmbant/CosmoMC ommited the "chain_grid.py" file under the path CosmoMC/python/getdist/. My getdist works after adding "chain_grid.py" to getdist path. It'd be great if you could supply "chain_grid.py" for CosmoMC at Github.

Post Reply