I am facing a problem when trying to use TensorFlow and TensorFlow Datasets in my virtual environment on Windows. When I try to import these packages, I receive the following error: ModuleNotFoundError: No module named 'resource'.
I understand that the 'resource' module is not required on Windows, so I'm not sure why this error occurs. Here are the details of my environment and what I've already tried:
My question is this: How can I resolve this "No module named 'resource'" error when using TensorFlow and TensorFlow Datasets on Windows? Is there anything specific I need to do to correctly configure these packages on Windows?
Thanks in advance for any help.
The bug was introduced here: https://github.com/tensorflow/datasets/commit/8f44c895c4115ac75d4c2ca4847ebf441e5450d4
And fixed here: https://github.com/tensorflow/datasets/commit/82215c7cf4b3e6df706a72c9b7ad8cede09f4d84
As of time of writing the bug fix has not been released, so you can just downgrade your tensorflow_datasets package
pip3 uninstall tensorflow_datasets; pip3 install tensorflow_datasets==4.9.2
The Python standard library resource
is not available on windows. But as the code that produces this error "only" tries to increase the number of allowed file handles it probably will not cause any trouble in most cases if it is missing.
In the file \Lib\site-packages\tensorflow_datasets\core\shuffle.py I just replaced the body of the method _increase_open_files_limit()
with a pass
and removed the line import resource
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With