MPI-IS / mesh

MPI-IS Mesh Processing Library
Other
673 stars 155 forks source link

Installation fails on Apple Macbook M1 #61

Open anticdimi opened 3 years ago

anticdimi commented 3 years ago

Hi, I've tried to install the package following the README installation with the command BOOST_INCLUDE_DIRS=/opt/homebrew/Cellar/boost/1.76.0/include/ make all.

I got an error:

...
In file included from mesh/src/aabb_normals.cpp:10:
    In file included from mesh/src/AABB_n_tree.h:9:
    In file included from /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/build/temp.macosx-11.0-arm64-3.8/CGAL-4.7/include/CGAL/AABB_tree.h:26:
    In file included from /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/build/temp.macosx-11.0-arm64-3.8/CGAL-4.7/include/CGAL/internal/AABB_tree/AABB_traversal_traits.h:24:
    In file included from /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/build/temp.macosx-11.0-arm64-3.8/CGAL-4.7/include/CGAL/internal/AABB_tree/AABB_node.h:24:
    In file included from /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/build/temp.macosx-11.0-arm64-3.8/CGAL-4.7/include/CGAL/Profile_counter.h:53:
    /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/build/temp.macosx-11.0-arm64-3.8/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness
    #  error Unknown endianness
...

Some warnings here in the middle followed by:

...
error: command 'gcc' failed with exit status 1
    Running setup.py install for psbody-mesh ... error
ERROR: Command errored out with exit status 1: /Users/dimi/miniforge3/envs/rvh/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/setup.py'"'"'; __file__='"'"'/private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-req-build-8mnvgqzh/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/9g/8khxl7b90plffzrxrvsryn3m0000gn/T/pip-record-7vgow2ox/install-record.txt --single-version-externally-managed --compile --install-headers /Users/dimi/miniforge3/envs/rvh/include/python3.8/psbody-mesh --boost-location=/opt/homebrew/Cellar/boost/1.76.0/include/ Check the logs for full command output.
make: *** [all] Error 1
...

I know it's a tough shot, but can you maybe provide a hint of what could be the problem?

Thanks!

anticdimi commented 3 years ago

Hi, After trying a couple of "hacks" with dependencies, I did manage to install the package. I will close this issue. :)

KelestZ commented 3 years ago

Hi, After trying a couple of "hacks" with dependencies, I did manage to install the package. I will close this issue. :)

Hi, I am facing the same issue. Could you please share how you solve it?

anticdimi commented 3 years ago

Hi @KelestZ, I've actually just skipped the installation of the requirements. Install numpy and scipy from conda-forge channel and then just comment out numpy, scipy in requirements.txt, I think there happens an "error" because both of them are being installed via pip (in the provided installation steps), and apparently, that's the issue for M1 architecture (apart from the error that I've posted above which is related to the underlying CGAL package). I'm really not proficient in these things, but this is what I've figured out so far 😂

This way command meshviewer view path_to_some_obj_file result in error ModuleNotFoundError: No module named 'psbody.mesh.serialization.loadobj', but at least Mesh class can be used. Not sure whether all the functionalities work properly.

Maybe someone who is working on this project can give us some sort of help on how to fix this problem so we can use all the functionalities.

VimalMollyn commented 3 years ago

Hi @KelestZ, I've actually just skipped the installation of the requirements. Install numpy and scipy from conda-forge channel and then just comment out numpy, scipy in requirements.txt, I think there happens an "error" because both of them are being installed via pip (in the provided installation steps), and apparently, that's the issue for M1 architecture (apart from the error that I've posted above which is related to the underlying CGAL package). I'm really not proficient in these things, but this is what I've figured out so far 😂

This way command meshviewer view path_to_some_obj_file result in error ModuleNotFoundError: No module named 'psbody.mesh.serialization.loadobj', but at least Mesh class can be used. Not sure whether all the functionalities work properly.

Maybe someone who is working on this project can give us some sort of help on how to fix this problem so we can use all the functionalities.

I'm facing the same issue, what was the fix for the CGAL package?

lucasjinreal commented 2 years ago

boost/config.hpp' file not found

include <boost/config.hpp>

lucasjinreal commented 2 years ago

error: Unknown endianness

error Unknown endianness

 ^
xpatronum commented 2 years ago

error: Unknown endianness

error Unknown endianness

 ^

The same here.

raja-kumar commented 2 years ago

Hi, After trying a couple of "hacks" with dependencies, I did manage to install the package. I will close this issue. :)

Hi, I am facing the same issue. Could you please share how you solve it?

@KelestZ were you able to resolve it? I am facing the same issue..

edoardo-conti commented 2 years ago

I'm facing the same issue, what was the fix for the CGAL package?

Someone solved this?

jingshuangliu22 commented 2 years ago

I got the same error. I changed another conda with Python 3.9 and then it worked out.

aleongithub commented 2 years ago

I switched to Python 3.9, installed dependencies separately and I still get the same error. Any help?

rmraaron commented 2 years ago

I got the same error. I changed another conda with Python 3.9 and then it worked out.

Which conda are you using? Thanks!

rmraaron commented 2 years ago

Is there anyone who solved this problem? Thanks!

jingshuangliu22 commented 2 years ago

I got the same error. I changed another conda with Python 3.9 and then it worked out.

Which conda are you using? Thanks!

This is my conda info, hopefully it can help you. conda version : 4.12.0 conda-build version : 3.21.8 python version : 3.9.12.final.0

rmraaron commented 2 years ago

I got the same error. I changed another conda with Python 3.9 and then it worked out.

Which conda are you using? Thanks!

This is my conda info, hopefully it can help you. conda version : 4.12.0 conda-build version : 3.21.8 python version : 3.9.12.final.0

Thank you! Can I also ask which version of Boost are you using?

xtliu97 commented 1 year ago

Hi, I also got the same problem these days and I found a solution worked for me.

According to the log, the error occurs at <temp_file_dir>/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness And I checked the code, the error was caused by missing include file of endian.h on Mac with M1/M2 chip.

Here's a simple way I fix it: After the error occurred, you could find extracted temp file in build folder, take me for example it is ./build/temp.macosx-11.1-arm64-cpython-38/CGAL-4.7

Then, modify the include path at line 243 in include/CGAL/config.h I simply delete line 243 to 266 and add one line #include <machine/endian.h>

so it will looks like

image

Hope this helps.

rmraaron commented 1 year ago

Hi, I also got the same problem these days and I found a solution worked for me.

According to the log, the error occurs at <temp_file_dir>/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness And I checked the code, the error was caused by missing include file of endian.h on Mac with M1/M2 chip.

Here's a simple way I fix it: After the error occurred, you could find extracted temp file in build folder, take me for example it is ./build/temp.macosx-11.1-arm64-cpython-38/CGAL-4.7

Then, modify the include path at line 243 in include/CGAL/config.h I simply delete line 243 to 266 and add one line #include <machine/endian.h>

so it will looks like image

Hope this helps.

Thank you for your solution! It worked for me as well.

kapsyst commented 1 year ago

Thanks

Hi, I also got the same problem these days and I found a solution worked for me.

According to the log, the error occurs at <temp_file_dir>/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness And I checked the code, the error was caused by missing include file of endian.h on Mac with M1/M2 chip.

Here's a simple way I fix it: After the error occurred, you could find extracted temp file in build folder, take me for example it is ./build/temp.macosx-11.1-arm64-cpython-38/CGAL-4.7

Then, modify the include path at line 243 in include/CGAL/config.h I simply delete line 243 to 266 and add one line #include <machine/endian.h>

so it will looks like image

Hope this helps.

Thanks, ridiculous we have to go to such lengths, but it worked for me too.

jackie-vifive commented 1 year ago

@xtliu97 @kapsyst @rmraaron The build folder is removed upon a failed build attempt. How did you isolate the config.h file of CGAL to edit it? I am getting this at the end of each build.

Removed build tracker: '/private/var/folders/66/q3r8rf4d1gl7lgwnnbgy1fw00000gn/T/pip-req-tracker-hls0kcdg'
make: *** [all] Error 1

and this

   /private/var/folders/66/q3r8rf4d1gl7lgwnnbgy1fw00000gn/T/pip-req-build-r4o1z2ch/build/temp.macosx-10.9-universal2-cpython-39/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness
    #  error Unknown endianness
       ^
jackie-vifive commented 1 year ago

Resolved the issue programmatically by adding these lines to setup.py so that we alter config.h during the build

        config_file_path = os.path.join(CGAL_dir_deflate, 'CGAL-4.7', 'include', 'CGAL', 'config.h')
        if os.path.exists(config_file_path):
            with open(config_file_path, 'r') as file:
                config_lines = file.readlines()

            with open(config_file_path, 'w') as file:
                for i, line in enumerate(config_lines):
                    if 243 <= i + 1 <= 266:  
                        if i + 1 == 243:
                            file.write('#include <machine/endian.h>\n')
                        continue
                    file.write(line)
        else:
            log.warn('[CGAL] config.h not found')
Sherlock1956 commented 3 weeks ago

Hi, I also got the same problem these days and I found a solution worked for me.

According to the log, the error occurs at <temp_file_dir>/CGAL-4.7/include/CGAL/config.h:265:4: error: Unknown endianness And I checked the code, the error was caused by missing include file of endian.h on Mac with M1/M2 chip.

Here's a simple way I fix it: After the error occurred, you could find extracted temp file in build folder, take me for example it is ./build/temp.macosx-11.1-arm64-cpython-38/CGAL-4.7

Then, modify the include path at line 243 in include/CGAL/config.h I simply delete line 243 to 266 and add one line #include <machine/endian.h>

so it will looks like image

Hope this helps.

This really work out !! even though I didn't know what happened when I do so.