Both CLASS and Hi_class installing error

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
TUMURTUSHAA GANSUKH
Posts: 6
Joined: June 22 2020
Affiliation: Jeju National University

Both CLASS and Hi_class installing error

Post by TUMURTUSHAA GANSUKH » June 23 2020

Dear All,

I have the same installing problem with both CLASS and Hi_Class. Please, refer to the attached image for an error message that I got. Previously, I had no problem with the installation of both codes, but this time I do not know what I have been doing wrong. Could anyone help or provide me with a solution to the error.

Thank you in advance.

P.S: I have been trying to install on macOS Catalina (10.15.5), where gcc-4.9 is also installed.


Best,
Gansukh. T
Attachments
Screen Shot 2020-06-23 at 13.40.29.png
Screen Shot 2020-06-23 at 13.40.29.png (562.51 KiB) Viewed 1138 times

Tanvi Karwal
Posts: 10
Joined: April 10 2020
Affiliation: University of Pennsylvania

Re: Both CLASS and Hi_class installing error

Post by Tanvi Karwal » June 24 2020

Do you have cython installed? If you do

Code: Select all

python -c "import cython"
in your terminal, does it give you an error or does it succeed?

TUMURTUSHAA GANSUKH
Posts: 6
Joined: June 22 2020
Affiliation: Jeju National University

Re: Both CLASS and Hi_class installing error

Post by TUMURTUSHAA GANSUKH » June 24 2020

First of all, thank you for your comment.

Yes, I have "Cython version 0.29.20" installed as you can see in the attached image, and "python -c "import cython" seems to be okay since it does not compile to an error.

Do you think there is some incompatibility kind of issue with upgraded macOS?
Attachments
Screen Shot 2020-06-24 at 15.03.22.png
Screen Shot 2020-06-24 at 15.03.22.png (196.93 KiB) Viewed 1108 times

Tanvi Karwal
Posts: 10
Joined: April 10 2020
Affiliation: University of Pennsylvania

Re: Both CLASS and Hi_class installing error

Post by Tanvi Karwal » June 27 2020

The error seems to come from

Code: Select all

from Cython.Distutils import build_ext
right?

Does that command work for your python? If not, you could try updating your cython / using anaconda python.
If you don't need the python wrapper, you can check that CLASS itself works, without the python wrapper - instead of 'make', run 'make class'.

TUMURTUSHAA GANSUKH
Posts: 6
Joined: June 22 2020
Affiliation: Jeju National University

Re: Both CLASS and Hi_class installing error

Post by TUMURTUSHAA GANSUKH » June 29 2020

Dear Tanvi Karwal,

Thank you for your kind help.

At first,

Code: Select all

from Cython.Distutils import build_ext 
compiled into an error hence I took your advice and have updated the Cython using anaconda. Now it seems there is no python related error because

Code: Select all

make clean; make

command gives the following lines at the end:

Code: Select all

2 warnings generated.
creating build/lib.macosx-10.9-x86_64-3.7
gcc -bundle -undefined dynamic_lookup -L/opt/anaconda3/lib -arch x86_64 -L/opt/anaconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.9-x86_64-3.7/Users/R1007/Documents/hi_class_public/python/../python/classy.o -L/Users/R1007/Documents/hi_class_public/python/.. -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/lib/darwin19.5.0 -lclass -o build/lib.macosx-10.9-x86_64-3.7/classy.cpython-37m-darwin.so -lgomp
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/lib/darwin19.5.0'
running install_lib
copying build/lib.macosx-10.9-x86_64-3.7/classy.cpython-37m-darwin.so -> /opt/anaconda3/lib/python3.7/site-packages
running install_egg_info
Removing /opt/anaconda3/lib/python3.7/site-packages/classy-2.7.2-py3.7.egg-info
Writing /opt/anaconda3/lib/python3.7/site-packages/classy-2.7.2-py3.7.egg-info
rm python/autosetup.py
However, when I try "import classy" from python, I got the following error message

Code: Select all

 
$ python
Python 3.7.7 (default, Mar 10 2020, 15:43:33) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import classy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'classy'
>>> import classy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'classy'
>>>  
and do you have any idea what could possibly be causing it?

Thank you in advance.

Gansukh T

Tanvi Karwal
Posts: 10
Joined: April 10 2020
Affiliation: University of Pennsylvania

Re: Both CLASS and Hi_class installing error

Post by Tanvi Karwal » June 29 2020

I'm not sure, but more quick things to check:
- Check if this file actually exists

Code: Select all

/opt/anaconda3/lib/python3.7/site-packages/classy-2.7.2-py3.7.egg-info
- Check if you're calling classy from the same python that you used to build it - i.e.

Code: Select all

which python
should return the anaconda3 installation.

I'm also surprised you got class to install using clang? Maybe it's because I tried on a much older Mac, but clang wouldn't cooperate with openmpi for me and I had to get gcc. But that's neither here nor there. Have you looked through the issues on GitHub for any matches of your problem?

TUMURTUSHAA GANSUKH
Posts: 6
Joined: June 22 2020
Affiliation: Jeju National University

Re: Both CLASS and Hi_class installing error

Post by TUMURTUSHAA GANSUKH » June 30 2020

Thank you for your prompt reply. I have just checked the suggestions you made.

Yes, there exists

Code: Select all

/opt/anaconda3/lib/python3.7/site-packages/classy-2.7.2-py3.7.egg-info
and it seems I am calling classy from

Code: Select all

/usr/local/lib/python3.7/site-packages (0.0.9.2)
while "which python" returns to

Code: Select all

/opt/anaconda3/bin/python
I think it is worth mentioning that I had installed python 3.7 prior to installing anaconda (which I just did yesterday). So, I suspect there might be a path defining issue when it calls python (and its libraries). Here, I am not sure whether I am calling classy is from previously installed python 3.7 or from anaconda3.

If that matters, I am using the MacBook (Late 2013). It is the same here that the clang does not cooperate with OPENMPI hence I also use GCC and GCC version that I am using is:

Code: Select all

$ gcc --version
gcc-4.9 (Homebrew GCC 4.9.4_2) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For me, GCC seems to be fine because there is no issue with "make class".

Lastly, I followed Github issues and, as you may know, there were no issues related to classy mentioned. To me, it seems there is an issue with my python and I am not being able to figure that out...

TUMURTUSHAA GANSUKH
Posts: 6
Joined: June 22 2020
Affiliation: Jeju National University

Re: Both CLASS and Hi_class installing error

Post by TUMURTUSHAA GANSUKH » June 30 2020

I think the problem is solved. I was messed up with python versions. Finally, I set up my python as anaconda and updated my gcc to gcc-7 and it worked.

Thank you for your kind help!

Post Reply