Forums

BlockingIOError: [Errno 11] write could not complete without blocking

Here is my Traceback. I am trying to create an API with flask and part of my api I need to load a neural network model and use it to evaluate certain text inputs for the API. To do this I need to load the model which is 3.5g, my available storage is 10gb. Whenever I try I get this error saying write could nto be completed without some "blocking" error. Any ieas what I could do to fix this.

2023-01-17 15:25:02,652: ***************************************************
2023-01-17 15:25:02,652: If you're seeing an import error and don't know why,
2023-01-17 15:25:02,653: we have a dedicated help page to help you debug: 
2023-01-17 15:25:02,653: https://help.pythonanywhere.com/pages/DebuggingImportError/
2023-01-17 15:25:02,653: ***************************************************
2023-01-17 15:25:03,065: Error running WSGI application
2023-01-17 15:25:03,066: BlockingIOError: [Errno 11] write could not complete without blocking
2023-01-17 15:25:03,066:   File "/var/www/syazvinski_pythonanywhere_com_wsgi.py", line 16, in <module>
2023-01-17 15:25:03,066:     from flask_app import app as application  # noqa
2023-01-17 15:25:03,067: 
2023-01-17 15:25:03,067:   File "/home/syazvinski/mysite/flask_app.py", line 2, in <module>
2023-01-17 15:25:03,067:     import backend
2023-01-17 15:25:03,067: 
2023-01-17 15:25:03,067:   File "/home/syazvinski/mysite/backend.py", line 24, in <module>
2023-01-17 15:25:03,067:     model = GPT2LMHeadModel.from_pretrained(model_id)
2023-01-17 15:25:03,067: 
2023-01-17 15:25:03,067:   File "/home/syazvinski/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2137, in from_pretrained
2023-01-17 15:25:03,068:     resolved_archive_file = cached_file(pretrained_model_name_or_path, filename, **cached_file_kwargs)
2023-01-17 15:25:03,068: 
2023-01-17 15:25:03,068:   File "/home/syazvinski/.local/lib/python3.9/site-packages/transformers/utils/hub.py", line 409, in cached_file
2023-01-17 15:25:03,068:     resolved_file = hf_hub_download(
2023-01-17 15:25:03,068: 
2023-01-17 15:25:03,068:   File "/home/syazvinski/.local/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
2023-01-17 15:25:03,068:     return fn(*args, **kwargs)
2023-01-17 15:25:03,069: 
2023-01-17 15:25:03,069:   File "/home/syazvinski/.local/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1242, in hf_hub_download
2023-01-17 15:25:03,069:     http_get(
2023-01-17 15:25:03,069: 
2023-01-17 15:25:03,069:   File "/home/syazvinski/.local/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 497, in http_get
2023-01-17 15:25:03,069:     progress.update(len(chunk))
2023-01-17 15:25:03,069: 
2023-01-17 15:25:03,069:   File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1225, in update
2023-01-17 15:25:03,070:     self.refresh(lock_args=self.lock_args)
2023-01-17 15:25:03,070: 
2023-01-17 15:25:03,070:   File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1326, in refresh
2023-01-17 15:25:03,070:     self.display()
2023-01-17 15:25:03,070: 
2023-01-17 15:25:03,070:   File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 1467, in display
2023-01-17 15:25:03,070:     self.sp(self.__repr__() if msg is None else msg)
2023-01-17 15:25:03,070: 
2023-01-17 15:25:03,071:   File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 348, in print_status
2023-01-17 15:25:03,071:     fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0)))
2023-01-17 15:25:03,071: 
2023-01-17 15:25:03,071:   File "/usr/local/lib/python3.9/site-packages/tqdm/std.py", line 341, in fp_write
2023-01-17 15:25:03,071:     fp.write(_unicode(s))
2023-01-17 15:25:03,071: 
2023-01-17 15:25:03,071:   File "/usr/local/lib/python3.9/site-packages/tqdm/utils.py", line 143, in inner
2023-01-17 15:25:03,072:     return func(*args, **kwargs)

There appears to be a download of something happening in that stack trace and it is trying to log the progress of the download. If you disable the download or do it outside of your web app (which is probably the better idea), then it will not be trying to write to the log file when it's expecting to write to a terminal.

I fixed it. Thanks.