Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Apple M1 Docker] (_rust_notify.WatchfilesRustInternalError: Error creating watcher: Function not implemented (os error 38)) #3

Closed
thmsrmbld opened this issue Apr 4, 2022 · 4 comments

Comments

@thmsrmbld
Copy link

Hey Adam,

Thanks for this lib - looks very useful - unfortunately I wanted to fold it into a platform I work on and I got an error that might raise its head for other users - but it's not an implementation issue on your side, more a general 'Apple M1 Docker Stuff' observation that I suspect will eventually be addressed somewhere far away from this library

In short, I think that watchfiles itself craps out on Dockerised environments that are running on Apple's M1 Silicon.

I installed the library and rebuilt my Docker containers, but got a 502 bringing the development server up. I ran docker logs for the container and it gave me the following traceback:

Traceback (most recent call last):
  File "/app/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.10/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.10/dist-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.10/dist-packages/django/core/management/base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3.10/dist-packages/django/core/management/commands/runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "/usr/lib/python3.10/dist-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3.10/dist-packages/django/core/management/commands/runserver.py", line 111, in handle
    self.run(**options)
  File "/usr/lib/python3.10/dist-packages/django/core/management/commands/runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "/usr/lib/python3.10/dist-packages/django/utils/autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "/usr/lib/python3.10/dist-packages/django/utils/autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "/usr/lib/python3.10/dist-packages/django/utils/autoreload.py", line 344, in run
    self.run_loop()
  File "/usr/lib/python3.10/dist-packages/django/utils/autoreload.py", line 350, in run_loop
    next(ticker)
  File "/usr/lib/python3.10/dist-packages/django_watchfiles/__init__.py", line 21, in tick
    for file_changes in watcher:
  File "/usr/lib/python3.10/dist-packages/watchfiles/main.py", line 85, in watch
    watcher = RustNotify([str(p) for p in paths], debug)
_rust_notify.WatchfilesRustInternalError: Error creating watcher: Function not implemented (os error 38)

The pertinent part of this seems to be:

  File "/usr/lib/python3.10/dist-packages/watchfiles/main.py", line 85, in watch
    watcher = RustNotify([str(p) for p in paths], debug)
_rust_notify.WatchfilesRustInternalError: Error creating watcher: Function not implemented (os error 38)

Which basically notes that in watchfiles, we're failing here.

This os error, I think is basically not to do with your implementation at all - this error seems quite frequent in other libraries when running certain code in Dockerised environments on Apple's M1 Silicon:

For what it's worth there are zero actions / fixes to take here - it's more for if people on the newer machines running Dockerised environments run into this, that there's a record that this can happen. There is discussion that rebuilding your Docker images to use multi-arch images can solve this, but this is not a problem for this library itself.

It is possible this could also be useful report in watchfiles itself, I just logged it here because this is the lib that I used to invoke it.

Give me a shout if anything's unclear on this - just hoping to help someone else if they wander through asking. :)

@adamchainz
Copy link
Owner

Report upstream

@adamchainz
Copy link
Owner

Also share your dockerfile... At a guess, are you using alpine linux? It has so many limitations, it may simply not have the file watching functions available. I know it makes other things worse and should generally be avoided.

@Chadys
Copy link

Chadys commented Aug 10, 2022

Fixed recently by watchfile: samuelcolvin/watchfiles#167

@adamchainz
Copy link
Owner

Thanks for the update @Chadys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants