pranjal-joshi / Screeni-py

A Python-based stock screener to find stocks with potential breakout probability from NSE India.
MIT License
552 stars 195 forks source link

Docker run command error on MacOs with apple silicon #195

Closed adityaladwa closed 11 months ago

adityaladwa commented 12 months ago

Describe the bug

Seeing the following error when running docker run -it joshipranjal/screeni-py:latest run_screenipy.sh

❯ docker run -it joshipranjal/screeni-py:latest run_screenipy.sh
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
/opt/program/run_screenipy.sh: line 3: cd: src: No such file or directory
The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.
qemu: uncaught target signal 6 (Aborted) - core dumped
/opt/program/run_screenipy.sh: line 4:     8 Aborted                 python3 screenipy.py

To Reproduce Steps to reproduce the behavior:

  1. On MacOs with apple silicon with Docker version 20.10.22, build 3a2c30b
  2. run docker pull joshipranjal/screeni-py:latest
  3. run docker run -it joshipranjal/screeni-py:latest run_screenipy.sh

Expected behavior

Should not error out

Screenshot 2023-09-19 at 7 47 03 PM
adityaladwa commented 12 months ago

docker version output as follows

❯ docker version
Client:
 Cloud integration: v1.0.35+desktop.4
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:28:49 2023
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.23.0 (120376)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:36 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
pranjal-joshi commented 12 months ago

Hi @adityaladwa

It's mentioned in the release page that dockers are built for x86/x86_64 CPUs only as the base Tensorflow image is compiled for AVX instructions which is not applicable for Apple sillicon (M1/M2)

Looking for a solution to use the existing dependencies version with the base image that is not specific to CPU architecture.

pranjal-joshi commented 11 months ago

Hi @adityaladwa

Docker support for multi-arch CPUs is in progress. Can you test if this works on your system now?

docker pull joshipranjal/screeni-py:multi
docker run -it joshipranjal/screeni-py:multi run_screenipy.sh

Note: multi tag will be delete later and latest will start supporting multiple CPU architectures.

adityaladwa commented 11 months ago

yes, this works @pranjal-joshi 👍

https://github.com/pranjal-joshi/Screeni-py/assets/4971240/43124ac1-97d8-4608-9def-30060a895585

pranjal-joshi commented 11 months ago

Thanks, @adityaladwa for confirming this 🎉

Fixed in 0f86825 - Will be merged with the main branch via new-features while rolling out the next update and docker tags :latest, :dev will be supported with multi-arch builds.