mesh icon indicating copy to clipboard operation
mesh copied to clipboard

Installation fails on Apple Macbook M1

Open anticdimi opened this issue 3 years ago • 21 comments

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 avatar Aug 20 '21 13:08 anticdimi

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

anticdimi avatar Aug 22 '21 20:08 anticdimi

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 avatar Sep 03 '21 03:09 KelestZ

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.

anticdimi avatar Sep 03 '21 10:09 anticdimi

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?

VimalMollyn avatar Oct 14 '21 17:10 VimalMollyn

boost/config.hpp' file not found #include <boost/config.hpp>

lucasjinreal avatar Mar 06 '22 06:03 lucasjinreal

error: Unknown endianness

error Unknown endianness

 ^

lucasjinreal avatar Mar 06 '22 06:03 lucasjinreal

error: Unknown endianness

error Unknown endianness

 ^

The same here.

xpatronum avatar Apr 29 '22 23:04 xpatronum

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..

raja-kumar avatar May 02 '22 17:05 raja-kumar

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

Someone solved this?

edoardo-conti avatar Jun 08 '22 10:06 edoardo-conti

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

jingshuangliu22 avatar Sep 07 '22 02:09 jingshuangliu22

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

aleongithub avatar Sep 15 '22 12:09 aleongithub

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 avatar Oct 25 '22 15:10 rmraaron

Is there anyone who solved this problem? Thanks!

rmraaron avatar Oct 25 '22 15:10 rmraaron

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

jingshuangliu22 avatar Oct 26 '22 02:10 jingshuangliu22

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?

rmraaron avatar Oct 27 '22 14:10 rmraaron

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.

xtliu97 avatar Feb 20 '23 15:02 xtliu97

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.

rmraaron avatar Feb 20 '23 19:02 rmraaron

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.

kapsyst avatar May 29 '23 02:05 kapsyst

@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 avatar Nov 09 '23 07:11 jackie-vifive

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')

jackie-vifive avatar Nov 09 '23 23:11 jackie-vifive