mincong-h / finance-toolkit

Finance Toolkit
3 stars 1 forks source link

Cannot build Docker image in Apple M1 #43

Open jingwen-z opened 2 years ago

jingwen-z commented 2 years ago
jingwenzheng@jingwens-macbook-pro finance-toolkit % ./bin/docker-build.sh
[+] Building 4.8s (4/8)
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 299B                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 99B                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/python:3.7                                                                                                                         1.6s
 => [1/4] FROM docker.io/library/python:3.7@sha256:da8d42bcd839e362c5bf0aff8c6b40e0b5af50c74ecb80a4a943d2a1876af41f                                                                   3.1s
 => => resolve docker.io/library/python:3.7@sha256:da8d42bcd839e362c5bf0aff8c6b40e0b5af50c74ecb80a4a943d2a1876af41f                                                                   0.0s
 => => sha256:7a578e1e1a0c6d58ae33aa24eb4843ace2b1e2042af66fc758df0d7cb6d0bf0f 2.22kB / 2.22kB                                                                                        0.0s
[+] Building 27.0s (8/8) FINISHED                                                             => [internal] load build definition from Dockerfile                                    0.0ss
 => => transferring dockerfile: 299B                                                    0.0sk => [internal] load .dockerignore                                                       0.0ss
 => => transferring context: 99B                                                        0.0s6 => [internal] load metadata for docker.io/library/python:3.7                           1.6ss
 => [1/4] FROM docker.io/library/python:3.7@sha256:da8d42bcd839e362c5bf0aff8c6b40e0b5  18.1sM => => resolve docker.io/library/python:3.7@sha256:da8d42bcd839e362c5bf0aff8c6b40e0b5a  0.0ss
 => => sha256:7a578e1e1a0c6d58ae33aa24eb4843ace2b1e2042af66fc758df0d7c 2.22kB / 2.22kB  0.0s6 => => sha256:da8d42bcd839e362c5bf0aff8c6b40e0b5af50c74ecb80a4a943d2a1 1.86kB / 1.86kB  0.0ss
 => => sha256:8b33ce19923138c53d0e4d30e15e200cc4a49510992f998086c4f0d2 9.24kB / 9.24kB  0.0s6 => => sha256:260ad8146ed2447d5587608b10fed4f80de80cdc559e619f3a235d 53.62MB / 53.62MB  8.9ss
 => => sha256:1399f445da611be3789923cf26d158e3f4f80449b7295fa069a8eaec 4.94MB / 4.94MB  0.5s. => => sha256:6cd9e43777fa6c09c341f3aa922f47b5b3ace26de1d779124afd2f 10.66MB / 10.66MB  1.2ss
 => => sha256:0f81267e40a2df9e572fe797e45dbc086008422eb2216df18b7a91 54.67MB / 54.67MB  9.4s  => => sha256:460c4ae3ed9f0c0fe1ee94e09cfb3993206231793fc9e841ad8f 189.45MB / 189.45MB  8.0ss
 => => sha256:f2e4b4b8cdbb17fbc52bfe1519318c84bda09216da0f7ba9001c5191 6.16MB / 6.16MB  8.4s  => => sha256:cfcc745745cd96d76d40875096d82d3fd0a5d6c1bd10af77816e6b 15.21MB / 15.21MB  9.1ss
 => => extracting sha256:260ad8146ed2447d5587608b10fed4f80de80cdc559e619f3a235d3ba09ea  1.4s
 => => sha256:5c8cfbf4480c0162c689cfc284548c0c7ce2a720529546944f77791a35e7 238B / 238B  9.1s
 => => sha256:80135ebb04002275b66d20b00394fb1faab15505b9ed2ac4afd61aed 2.87MB / 2.87MB  9.3s
 => => extracting sha256:1399f445da611be3789923cf26d158e3f4f80449b7295fa069a8eaecaaf13  0.1s
 => => extracting sha256:6cd9e43777fa6c09c341f3aa922f47b5b3ace26de1d779124afd2f1d43573  0.2s
 => => extracting sha256:0f81267e40a2df9e572fe797e45dbc086008422eb2216df18b7a91f1cf13e  1.5s
 => => extracting sha256:460c4ae3ed9f0c0fe1ee94e09cfb3993206231793fc9e841ad8f0975895dd  4.5s
 => => extracting sha256:f2e4b4b8cdbb17fbc52bfe1519318c84bda09216da0f7ba9001c5191fa9ba  0.2s
 => => extracting sha256:cfcc745745cd96d76d40875096d82d3fd0a5d6c1bd10af77816e6b717a161  0.4s
 => => extracting sha256:5c8cfbf4480c0162c689cfc284548c0c7ce2a720529546944f77791a35e76  0.0s
 => => extracting sha256:80135ebb04002275b66d20b00394fb1faab15505b9ed2ac4afd61aedfa7b6  0.1s
 => [internal] load build context                                                       0.0s
 => => transferring context: 45.26kB                                                    0.0s
 => [2/4] WORKDIR /app/finance-toolkit/                                                 0.1s
 => [3/4] COPY . /app/finance-toolkit/                                                  0.0s
 => ERROR [4/4] RUN python setup.py install                                             7.1s
------

then receive errors:

#8 0.859 Running PyYAML-5.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-wtq2d_rp/PyYAML-5.1.2/egg-dist-tmp-d6ke0nx8
#8 0.970 In file included from ext/_yaml.c:596:
#8 0.970 ext/_yaml.h:10: warning: "PyString_CheckExact" redefined
#8 0.970    10 | #define PyString_CheckExact PyBytes_CheckExact
#8 0.970       |
#8 0.970 ext/_yaml.c:486: note: this is the location of the previous definition
#8 0.970   486 |   #define PyString_CheckExact          PyUnicode_CheckExact
#8 0.970       |
#8 0.972 ext/_yaml.c: In function ‘__pyx_pf_5_yaml_get_version_string’:
#8 0.972 ext/_yaml.c:1888:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
#8 0.972  1888 |   __pyx_v_value = yaml_get_version_string();
#8 0.972       |                 ^
#8 0.975 ext/_yaml.c: In function ‘__pyx_pf_5_yaml_7CParser___init__’:
#8 0.976 ext/_yaml.c:3388:52: warning: passing argument 2 of ‘yaml_parser_set_input’ from incompatible pointer type [-Wincompatible-pointer-types]
#8 0.976  3388 |     yaml_parser_set_input((&__pyx_v_self->parser), __pyx_f_5_yaml_input_handler, ((void *)__pyx_v_self));
#8 0.976       |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#8 0.976       |                                                    |
#8 0.976       |                                                    int (*)(void *, char *, size_t,  size_t *) {aka int (*)(void *, char *, long unsigned int,  long unsigned int *)}
#8 0.976 In file included from ext/_yaml.h:2,
#8 0.976                  from ext/_yaml.c:596:
#8 0.976 /usr/include/yaml.h:1370:30: note: expected ‘int (*)(void *, unsigned char *, size_t,  size_t *)’ {aka ‘int (*)(void *, unsigned char *, long unsigned int,  long unsigned int *)’} but argument is of type ‘int (*)(void *, char *, size_t,  size_t *)’ {aka ‘int (*)(void *, char *, long unsigned int,  long unsigned int *)’}
#8 0.976  1370 |         yaml_read_handler_t *handler, void *data);
#8 0.976       |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
#8 0.976 In file included from /usr/local/include/python3.7m/Python.h:98,
#8 0.976                  from ext/_yaml.c:4:
#8 0.976 /usr/local/include/python3.7m/bytesobject.h:87:57: warning: pointer targets in passing argument 2 of ‘yaml_parser_set_input_string’ differ in signedness [-Wpointer-sign]
#8 0.976    87 | #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
#8 0.976       |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
#8 0.976       |                                                         |
#8 0.976       |                                                         char *
#8 0.976    88 |                                 (((PyBytesObject *)(op))->ob_sval))
#8 0.976       |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#8 0.976 ext/_yaml.h:11:29: note: in expansion of macro ‘PyBytes_AS_STRING’
#8 0.976    11 | #define PyString_AS_STRING  PyBytes_AS_STRING
#8 0.976       |                             ^~~~~~~~~~~~~~~~~

then

#8 5.587 Installed /usr/local/lib/python3.7/site-packages/PyYAML-5.1.2-py3.7-linux-aarch64.egg
#8 5.598 Searching for pandas==1.2.0
#8 5.598 Reading https://pypi.org/simple/pandas/
#8 5.968 Downloading https://files.pythonhosted.org/packages/75/bc/abf2e8cc6a9d918008774b958613cfdbd3a8c135cffb0757f78fabd8268f/pandas-1.2.0.tar.gz#sha256=e03386615b970b8b41da6a68afe717626741bb2431cec993640685614c0680e4
#8 6.829 Best match: pandas 1.2.0
#8 6.829 Processing pandas-1.2.0.tar.gz
#8 7.030 Writing /tmp/easy_install-n_1xcafp/pandas-1.2.0/setup.cfg
#8 7.031 Running pandas-1.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-n_1xcafp/pandas-1.2.0/egg-dist-tmp-xoiusih1
#8 7.078 Traceback (most recent call last):
#8 7.078   File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 152, in save_modules
#8 7.078     yield saved
#8 7.078   File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 193, in setup_context
#8 7.078     yield
#8 7.078   File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 254, in run_setup
#8 7.078     _execfile(setup_script, ns)
#8 7.078   File "/usr/local/lib/python3.7/site-packages/setuptools/sandbox.py", line 43, in _execfile
#8 7.078     exec(code, globals, locals)
#8 7.078   File "/tmp/easy_install-n_1xcafp/pandas-1.2.0/setup.py", line 20, in <module>
#8 7.078 ModuleNotFoundError: No module named 'numpy'
#8 7.078
#8 7.078 During handling of the above exception, another exception occurred:
jingwen-z commented 2 years ago

Cannot install numpy from pip neither:

      error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/jingwenzheng/github/finance-toolkit/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-10.14-arm64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/alloc.c -o build/temp.macosx-10.14-arm64-3.8/numpy/core/src/multiarray/alloc.o -MMD -MF build/temp.macosx-10.14-arm64-3.8/numpy/core/src/multiarray/alloc.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects