ecos-python icon indicating copy to clipboard operation
ecos-python copied to clipboard

Failure to install on Apple M1 on Mac OS Monterey

Open sunilshah opened this issue 3 years ago • 5 comments

Ecos version 2.0.8 fails to install on Apple M1 on Mac OS 12.0.1, python 3.9.9 (homebrew installed). It fails to upgrade from ecos 2.0.7.post1.

 pip3 install -U ecos       
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: ecos in /opt/homebrew/lib/python3.9/site-packages (2.0.7.post1)
Collecting ecos
  Downloading ecos-2.0.8.tar.gz (135 kB)
     |████████████████████████████████| 135 kB 2.0 MB/s            
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.6 in /opt/homebrew/lib/python3.9/site-packages (from ecos) (1.21.4)
Requirement already satisfied: scipy>=0.9 in /opt/homebrew/lib/python3.9/site-packages (from ecos) (1.7.3)
Building wheels for collected packages: ecos
  Building wheel for ecos (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/homebrew/opt/[email protected]/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/setup.py'"'"'; __file__='"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/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'"'"'))' bdist_wheel -d /private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-wheel-cf9ksghb
       cwd: /private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/
  Complete output (32 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-12-arm64-3.9
  creating build/lib.macosx-12-arm64-3.9/ecos
  copying src/ecos/version.py -> build/lib.macosx-12-arm64-3.9/ecos
  copying src/ecos/__init__.py -> build/lib.macosx-12-arm64-3.9/ecos
  copying src/ecos/ecos.py -> build/lib.macosx-12-arm64-3.9/ecos
  running build_ext
  building '_ecos' extension
  creating build/temp.macosx-12-arm64-3.9
  creating build/temp.macosx-12-arm64-3.9/ecos
  creating build/temp.macosx-12-arm64-3.9/ecos/ecos_bb
  creating build/temp.macosx-12-arm64-3.9/ecos/external
  creating build/temp.macosx-12-arm64-3.9/ecos/external/amd
  creating build/temp.macosx-12-arm64-3.9/ecos/external/amd/src
  creating build/temp.macosx-12-arm64-3.9/ecos/external/ldl
  creating build/temp.macosx-12-arm64-3.9/ecos/external/ldl/src
  creating build/temp.macosx-12-arm64-3.9/ecos/src
  creating build/temp.macosx-12-arm64-3.9/src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -DPYTHON -DDLONG -DLDL_LONG -DCTRLC=1 -Iecos/include -Iecos/external/amd/include -Iecos/external/ldl/include -Iecos/external/SuiteSparse_config -I/opt/homebrew/include -I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/sqlite/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I/opt/homebrew/lib/python3.9/site-packages/numpy/core/include -c ecos/ecos_bb/ecos_bb.c -o build/temp.macosx-12-arm64-3.9/ecos/ecos_bb/ecos_bb.o
  ecos/ecos_bb/ecos_bb.c:100:77: warning: format specifies type 'unsigned int' but the argument has type 'idxint' (aka 'long') [-Wformat]
          PRINTTEXT("Node info %u: %u : %.2f : %.2f : %u : %.2f Partial id:", i, prob->nodes[i].status, prob->nodes[i].L, prob->nodes[i].U, (int)prob->nodes[i].split_idx, prob->nodes[i].split_val);
                               ~~                                             ^
                               %ld
  ecos/ecos_bb/ecos_bb.c:388:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
      memcpy(problem->tmp_branching_bool_node_id, get_bool_node_id(node_idx, problem), bool_node_size);
      ^
  ecos/ecos_bb/ecos_bb.c:388:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
  1 warning and 1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for ecos
  Running setup.py clean for ecos
Failed to build ecos
Installing collected packages: ecos
  Attempting uninstall: ecos
    Found existing installation: ecos 2.0.7.post1
    Uninstalling ecos-2.0.7.post1:
      Successfully uninstalled ecos-2.0.7.post1
    Running setup.py install for ecos ... error
    ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/[email protected]/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/setup.py'"'"'; __file__='"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/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/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-record-vuid19bg/install-record.txt --single-version-externally-managed --compile --install-headers /opt/homebrew/include/python3.9/ecos
         cwd: /private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/
    Complete output (34 lines):
    running install
/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build/lib.macosx-12-arm64-3.9
    creating build/lib.macosx-12-arm64-3.9/ecos
    copying src/ecos/version.py -> build/lib.macosx-12-arm64-3.9/ecos
    copying src/ecos/__init__.py -> build/lib.macosx-12-arm64-3.9/ecos
    copying src/ecos/ecos.py -> build/lib.macosx-12-arm64-3.9/ecos
    running build_ext
    building '_ecos' extension
    creating build/temp.macosx-12-arm64-3.9
    creating build/temp.macosx-12-arm64-3.9/ecos
    creating build/temp.macosx-12-arm64-3.9/ecos/ecos_bb
    creating build/temp.macosx-12-arm64-3.9/ecos/external
    creating build/temp.macosx-12-arm64-3.9/ecos/external/amd
    creating build/temp.macosx-12-arm64-3.9/ecos/external/amd/src
    creating build/temp.macosx-12-arm64-3.9/ecos/external/ldl
    creating build/temp.macosx-12-arm64-3.9/ecos/external/ldl/src
    creating build/temp.macosx-12-arm64-3.9/ecos/src
    creating build/temp.macosx-12-arm64-3.9/src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -DPYTHON -DDLONG -DLDL_LONG -DCTRLC=1 -Iecos/include -Iecos/external/amd/include -Iecos/external/ldl/include -Iecos/external/SuiteSparse_config -I/opt/homebrew/include -I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/sqlite/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I/opt/homebrew/lib/python3.9/site-packages/numpy/core/include -c ecos/ecos_bb/ecos_bb.c -o build/temp.macosx-12-arm64-3.9/ecos/ecos_bb/ecos_bb.o
    ecos/ecos_bb/ecos_bb.c:100:77: warning: format specifies type 'unsigned int' but the argument has type 'idxint' (aka 'long') [-Wformat]
            PRINTTEXT("Node info %u: %u : %.2f : %.2f : %u : %.2f Partial id:", i, prob->nodes[i].status, prob->nodes[i].L, prob->nodes[i].U, (int)prob->nodes[i].split_idx, prob->nodes[i].split_val);
                                 ~~                                             ^
                                 %ld
    ecos/ecos_bb/ecos_bb.c:388:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
        memcpy(problem->tmp_branching_bool_node_id, get_bool_node_id(node_idx, problem), bool_node_size);
        ^
    ecos/ecos_bb/ecos_bb.c:388:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
    1 warning and 1 error generated.
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
  Rolling back uninstall of ecos
  Moving to /opt/homebrew/lib/python3.9/site-packages/_ecos.cpython-39-darwin.so
   from /private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-uninstall-xqao81g_/_ecos.cpython-39-darwin.so
  Moving to /opt/homebrew/lib/python3.9/site-packages/ecos-2.0.7.post1.dist-info/
   from /opt/homebrew/lib/python3.9/site-packages/~cos-2.0.7.post1.dist-info
  Moving to /opt/homebrew/lib/python3.9/site-packages/ecos/
   from /opt/homebrew/lib/python3.9/site-packages/~cos
ERROR: Command errored out with exit status 1: /opt/homebrew/opt/[email protected]/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/setup.py'"'"'; __file__='"'"'/private/var/folders/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-install-o7xtfekc/ecos_79d1b425adfe4d40a5153c49dea204d9/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/sj/0mpllhrn5dgbk_sjm6l34jl40000gn/T/pip-record-vuid19bg/install-record.txt --single-version-externally-managed --compile --install-headers /opt/homebrew/include/python3.9/ecos Check the logs for full command output.

sunilshah avatar Dec 13 '21 19:12 sunilshah

Same issue on M1 MacOS, Python 3.10. I ran poetry add ecos, and it fails with:

      ecos/ecos_bb/ecos_bb.c:388:5: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
          memcpy(problem->tmp_branching_bool_node_id, get_bool_node_id(node_idx, problem), bool_node_size);
          ^
      ecos/ecos_bb/ecos_bb.c:388:5: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
      1 warning and 1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1

Any ideas on how to fix that?

xcrzx avatar Dec 15 '21 23:12 xcrzx

Installing 2.0.5 version worked for me in Mac M1 processor. Looks to be some issue with the latest version. pip install ecos==2.0.5

thirumalairajr avatar Dec 19 '22 15:12 thirumalairajr

@thirumalairajr could you share on which Python version you are? I'm trying to help a colleague with M1 but cannot get this to work with Python 3.9 nor building it

jacopofar avatar Feb 15 '23 16:02 jacopofar

Hey, I have the same issue with M1 mac and python 3.9

baslia avatar Apr 21 '23 12:04 baslia

@thirumalairajr could you share on which Python version you are? I'm trying to help a colleague with M1 but cannot get this to work with Python 3.9 nor building it

I am using Python 3.11.2

thirumalairajr avatar May 10 '23 04:05 thirumalairajr