Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on local build #25

Open
ClaudioNahmad opened this issue Sep 12, 2023 · 2 comments
Open

error on local build #25

ClaudioNahmad opened this issue Sep 12, 2023 · 2 comments

Comments

@ClaudioNahmad
Copy link

Hello,

I'm installing kcap on a local computer since i want to run some montepython MCMCs with the Cosebis likelihood. Im using ubuntu 20.04 LTS, within a conda environment with:

python 3
future
pyyaml
numpy
scipy
astropy
pip
emcee
mpi4py

i clone the repository and enter:

git clone https://github.com/KiDS-WL/kcap.git
cd kcap

then i try to build with:
python build.py

but the following error occurs:

Collecting cosmosis-standalone
  Cloning https://bitbucket.org/tilmantroester/cosmosis.git (to revision kcap) to /tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59
  Running command git clone --filter=blob:none --quiet https://bitbucket.org/tilmantroester/cosmosis.git /tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59
  warning: filtering not recognized by server, ignoring
  Running command git checkout -b kcap --track origin/kcap
  Switched to a new branch 'kcap'
  Branch 'kcap' set up to track remote branch 'kcap' from 'origin'.
  Resolved https://bitbucket.org/tilmantroester/cosmosis.git to commit bab22e07db58905a311397f1e69c347d8821c9c5
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pyyaml in /home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages (from cosmosis-standalone) (6.0)
Requirement already satisfied: future in /home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages (from cosmosis-standalone) (0.18.3)
Requirement already satisfied: emcee in /home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages (from cosmosis-standalone) (3.1.4)
Requirement already satisfied: numpy in /home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages (from cosmosis-standalone) (1.21.5)
Requirement already satisfied: scipy in /home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages (from cosmosis-standalone) (1.10.1)
Building wheels for collected packages: cosmosis-standalone
  Building wheel for cosmosis-standalone (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      running bdist_wheel
      running build
      /tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis
      make: Entering directory '/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis'
      make[1]: Entering directory '/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis/datablock'
      python generate_sections.py section_names.txt fortran cosmosis_f90/cosmosis_section_names.F90
      python generate_sections.py section_names.txt c section_names.h
      g++ -O3 -g -fPIC -I/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis/.. -Wall -Wextra -pedantic -std=c++14   -c -o datablock.o datablock.cc
      make[1]: g++: Command not found
      make[1]: *** [<builtin>: datablock.o] Error 127
      make[1]: Leaving directory '/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis/datablock'
      make: *** [/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis/config/subdirs.mk:11: all] Error 2
      make: Leaving directory '/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/cosmosis'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/setup.py", line 142, in <module>
          setup(name = 'cosmosis-standalone',
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands
          self.run_command(cmd)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/setup.py", line 122, in run
          compile_library(env)
        File "/tmp/pip-install-td9yh5ot/cosmosis-standalone_65ac9e7a5e1b4a59bb5113adfb881c59/setup.py", line 82, in compile_library
          subprocess.check_call(["make"], env=env, cwd="cosmosis")
        File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cosmosis-standalone
  Running setup.py clean for cosmosis-standalone
Failed to build cosmosis-standalone
ERROR: Could not build wheels for cosmosis-standalone, which is required to install pyproject.toml-based projects
Traceback (most recent call last):
  File "/home/hikuri/physics/COSMO/kcap/build.py", line 15, in check_cosmosis
    import cosmosis
ModuleNotFoundError: No module named 'cosmosis'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hikuri/physics/COSMO/kcap/build.py", line 102, in <module>
    build(mpi=not args.no_mpi)
  File "/home/hikuri/physics/COSMO/kcap/build.py", line 67, in build
    cosmosis_env = check_cosmosis(mpi)
  File "/home/hikuri/physics/COSMO/kcap/build.py", line 26, in check_cosmosis
    install_cosmosis(env)
  File "/home/hikuri/physics/COSMO/kcap/build.py", line 34, in install_cosmosis
    subprocess.check_call([sys.executable, "-m", "pip", "install", cosmosis_source], env=env)
  File "/home/hikuri/software/anaconda3/envs/class3-2/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/hikuri/software/anaconda3/envs/class3-2/bin/python', '-m', 'pip', 'install', 'git+https://bitbucket.org/tilmantroester/cosmosis.git@kcap#egg=cosmosis-standalone']' returned non-zero exit status 1.

what could be happening? i'm new to this KCAP, thanks in advance for your comments.

Greetings

@cheymans
Copy link
Collaborator

cheymans commented Sep 13, 2023

Hello @ClaudioNahmad

The fastest solution might be for you to move to CosmoSIS v3 as this now has most of the functionality of KCAP and is well maintained. We recently worked with Joe Zuntz to include COSEBIs in the latest version. It doesn't have Montepython as far as I know, but it does have polychord, multinest and nautilus which are all good alternatives.

Have a look at https://github.com/joezuntz/cosmosis-standard-library/blob/main/examples/des-y3_and_kids-1000.ini

which runs the recent DES+KiDS joint cosmic shear analysis

cosmosis examples/des-y3_and_kids-1000.ini runtime.sampler='polychord'

And incase you're new to CosmoSIS to, here are the installation instructions:
https://cosmosis.readthedocs.io/en/latest/intro/installation.html

@tilmantroester
Copy link
Collaborator

make[1]: g++: Command not found suggests you're missing the compiler.

As Catherine said, I'd suggest using the latest cosmosis installation. We're also working on a python-only implementation of the relevant modules, to circumvent these kind of compilation issues in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants