microsoft / showwhy

MIT License
200 stars 28 forks source link

Backend API instance exiting with 1 #434

Open shahidpacmahn opened 8 months ago

shahidpacmahn commented 8 months ago

I just tried to run the docker file , all the instances are up and running except for the backend_api instance which exits with code 1. the error shown is the module not found error with tensorflow as the missing module.

MikeScavell commented 8 months ago

I seem to be having a similar issue. When running Docker Compose on the Docker File using the latest main branch I also have the backend_api instance exit with a code 1.

However, my error is different in the sense that it says: ModuleNotFoundError: No module named 'causica'. Full error is below:

Traceback (most recent call last): File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/backend/.venv/lib/python3.9/site-packages/uvicorn/main.py", line 4, in uvicorn.main() File "/backend/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/backend/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/backend/.venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/backend/.venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/backend/.venv/lib/python3.9/site-packages/uvicorn/main.py", line 404, in main run( File "/backend/.venv/lib/python3.9/site-packages/uvicorn/main.py", line 569, in run server.run() File "/backend/.venv/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete return future.result() File "/backend/.venv/lib/python3.9/site-packages/uvicorn/server.py", line 67, in serve config.load() File "/backend/.venv/lib/python3.9/site-packages/uvicorn/config.py", line 477, in load self.loaded_app = import_from_string(self.app) File "/backend/.venv/lib/python3.9/site-packages/uvicorn/importer.py", line 24, in import_from_string raise exc from None File "/backend/.venv/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string module = importlib.import_module(module_str) File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/backend/./backend/api_main.py", line 7, in from backend.discover.api.router import discover_router File "/backend/./backend/discover/api/router.py", line 5, in from backend.discover.algorithms.deci import DeciPayload, DeciRunner File "/backend/./backend/discover/algorithms/deci.py", line 10, in from causica.datasets.dataset import Dataset ModuleNotFoundError: No module named 'causica'

MikeScavell commented 7 months ago

A bit of an update to this issue. It appears that I also get the same error if I try to build from the v2.0.0 tag. My gut feel is that this isn't something to do with changes to the project itself, but rather some external repos/dependencies have changed and no longer exist at the locations expected by the showwhy scripts.

I unfortunately do not have a solution, but if anyone does (or I work one out) hopefully it winds up here!

jspiliot commented 7 months ago

I get the same issue as @shahidpacmahn, and I have one of my colleagues try to run it as well and he gets the same as @MikeScavell. I've been struggling to find the solution to it unfortunately, and since I am on a M1 it's not easy to run locally. Tried to fix the M1 issue first, but causica has massively changed between 0.1.0 and 0.36.0 that it is now and I have workign locally, so I'm not familiar with it's old interface that is being used in the code.

If anyone manages to get any solution to it, even if just to hack to make it work for the time being, it would be great.

dayesouza commented 6 months ago

Hi everyone, it's really a problem with the dependencies... I've been trying to fix the causica issue, but then I get problem with other dependencies... We are unable to fully solve the problem for the time being, but I verified that our containers on azure are working, since they've been built when the dependencies are ok. You can follow our instructions here and deploy to an azure subscription if you'd like

UbaidG commented 1 month ago

Hi everyone, it's really a problem with the dependencies... I've been trying to fix the causica issue, but then I get problem with other dependencies... We are unable to fully solve the problem for the time being, but I verified that our containers on azure are working, since they've been built when the dependencies are ok. You can follow our instructions here and deploy to an azure subscription if you'd like

I don't have a subscription and I would like to change some things in the program itself. Can you provide a stable version? A docker image which I can pull will be great.

MikeScavell commented 1 month ago

Your comment here @UbaidG reminded me of this issue, and I do have some information that you may find useful. I have managed to get ShowWhy running locally by using the prebuilt Docker images from here: https://github.com/orgs/microsoft/packages?repo_name=showwhy

I have also been able to build the latest version of the frontend (from the source code) and then have it work with the backend from the prebuilt Docker image. This approach bypasses the current issue with building the backend from source and the dependencies of Causica.

Hopefully that helps guide you, but if you need a more detailed explanation of how to get it working just let me know and I can post more detailed instructions.

UbaidG commented 1 month ago

Your comment here @UbaidG reminded me of this issue, and I do have some information that you may find useful. I have managed to get ShowWhy running locally by using the prebuilt Docker images from here: https://github.com/orgs/microsoft/packages?repo_name=showwhy

I have also been able to build the latest version of the frontend (from the source code) and then have it work with the backend from the prebuilt Docker image. This approach bypasses the current issue with building the backend from source and the dependencies of Causica.

Hopefully that helps guide you, but if you need a more detailed explanation of how to get it working just let me know and I can post more detailed instructions.

Thanks a lot @MikeScavell, are you using the latest one in this or any specific version. Also i should change docker compose like this right?

version: '3'

services:
  frontend:
    build:
      context: .
      dockerfile: Frontend.dockerfile
    ports:
      - 3000:3000
    volumes:
      - ./:/app
    profiles:
      - all

  backend_api:
    image: ghcr.io/microsoft/showwhy-backend
    environment:
      - ENABLE_CORS=http://localhost:3000
      - REDIS_URL=redis://redis:6379/0
      - STORAGE=/data
    ports:
      - 8081:8081
    depends_on:
      - redis
    profiles:
      - all
      - backend

  backend_worker:
    image: ghcr.io/microsoft/showwhy-backend
    environment:
      - REDIS_URL=redis://redis:6379/0
      - WORKER=true
      - N_PARALLEL_JOBS=2
    depends_on:
      - redis
      - backend_api
    profiles:
      - all
      - backend

  redis:
    image: redis:6-alpine
    profiles:
      - all
      - backend

UPDATE I am getting the following error if I try to do the above-mentioned docker compose

Screenshot 2024-06-13 at 10 22 10 PM

UPDATE If I use both the frontend and backend from the package then frontend exits with 127 You know what @MikeScavell I would love that more detailed explanation

MikeScavell commented 4 weeks ago

You may not need the full detailed explanation since I think you are 99% of the way to where I am. I think I can point out a couple more things that might help!

I originally got things working by using the dev-27 image for the backend and dev-19 for the frontend. This approach seemed to have no issues at all.

Then I proceeded to try what I believe you did, which was building the frontend, and then using the latest docker image for the backend. Which does work, but gives you the red screen with the "Error: Snapshot has already been released." message. However, I only got this error when trying to access through Firefox, and the error was not present when accessing through Chrome. I have no idea why this works, but I decided not to dig in to the details or argue too much with my web browser.

I hope that helps!

Ubaid-Ghante commented 3 weeks ago

It worked, thanks a bunch @MikeScavell.