lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
223 stars 292 forks source link

Problem with Python wrapper in Ubuntu 20.04 #457

Open margiofabiolad opened 2 years ago

margiofabiolad commented 2 years ago

Hi, I run make all and the class code install correctly, but when I try to install the Python wrapper the output says:

home/marz/anaconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lmvec
collect2: error: ld returned 1 exit status
error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1
make: *** [Makefile:195: classy] Error 1

This happens without modifying the Makefile. Some solution? My OS is Ubuntu 20.04.

Cheers!

JCGoran commented 2 years ago

It seems the Anaconda-provided linker is unable to find the vector math library. Have you tried updating Anaconda before running make all? Alternatively, I think the culprit is this line here: https://github.com/lesgourg/class_public/blob/af4e589ba34518b535a73933d88215c6c23e8ce7/python/setup.py#L21 You could change it so it reads liblist += ["m"] instead, and re-run make all to see if it works.

Finally, if that doesn't work either, you could try using the default Ubuntu-provided compiler and linker instead of the Anaconda one. To do so, just disable Anaconda and run make all. In case of the bash: python: command not found error, just modify the Makefile around this line: https://github.com/lesgourg/class_public/blob/af4e589ba34518b535a73933d88215c6c23e8ce7/Makefile#L33 so it reads PYTHON ?= python3 and re-run make all. Note that the wrapper may not be visible in Anaconda if you install it this way (there may be some PATH hack to get it to work, but I don't use Anaconda so can't help you there).

mmgamboa commented 2 years ago

Hi all! I have Linux Mint 20.3 and I use Conda --version == 4.11.0. I had the very same error that @margiofabiolad had. I followed the first tip @JCGoran suggested: change liblist = ["mvec","m"] by liblist = ["m"] and it worked for me.

Thanks :)! Martín

KarthikaBhuvanendran commented 2 years ago

Thank you @JCGoran change liblist = ["mvec","m"] by liblist += ["m"] this worked for me too.. Cheers, Karthika