OSError on M1 via docker

Hello everyone!

I attempted to containerize my application on a MacBook M1 and encountered an error.

Here is the Dockerfile:

FROM python:3.9-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .


RUN pip3 install --no-cache-dir -r requirements.txt \
    && rm requirements.txt
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install transformers>=4.35.2
RUN pip3 install sentence-transformers>=2.2.2

COPY src/ /app/src/
COPY media/ /app/media/
COPY all_v1/ /app/all_v1/

ENV PATH="/usr/local/bin:$PATH"

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

ENTRYPOINT ["streamlit", "run", "src/gui.py", "--server.port=8501", "--server.address=0.0.0.0"]

And this is the error I received:

<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.

Traceback (most recent call last):
  File "/usr/local/bin/streamlit", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/cli.py", line 233, in main_run
    _main_run(target, args, flag_options=kwargs)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/cli.py", line 269, in _main_run
    bootstrap.run(file, command_line, args, flag_options)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/bootstrap.py", line 411, in run
    _install_pages_watcher(main_script_path)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/bootstrap.py", line 386, in _install_pages_watcher
    watch_dir(
  File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/path_watcher.py", line 153, in watch_dir
    return _watch_path(
  File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/path_watcher.py", line 128, in _watch_path
    watcher_class(
  File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/event_based_path_watcher.py", line 92, in __init__
    path_watcher.watch_path(
  File "/usr/local/lib/python3.9/site-packages/streamlit/watcher/event_based_path_watcher.py", line 170, in watch_path
    folder_handler.watch = self._observer.schedule(
  File "/usr/local/lib/python3.9/site-packages/watchdog/observers/api.py", line 301, in schedule
    emitter.start()
  File "/usr/local/lib/python3.9/site-packages/watchdog/utils/__init__.py", line 92, in start
    self.on_thread_start()
  File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify.py", line 119, in on_thread_start
    self._inotify = InotifyBuffer(path, self.watch.is_recursive)
  File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_buffer.py", line 37, in __init__
    self._inotify = Inotify(path, recursive)
  File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 167, in __init__
    Inotify._raise_error()
  File "/usr/local/lib/python3.9/site-packages/watchdog/observers/inotify_c.py", line 432, in _raise_error
    raise OSError(err, os.strerror(err))
OSError: [Errno 38] Function not implemented

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.