-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
AttributeError: 'NoneType' object has no attribute 'flush' #24047
Comments
cc @LysandreJik maybe |
Hello, I have encountered the same problem as you, did you solve it? |
Hi! I also encountered this error. I'm building a package with
|
You can add this code before your transformers import |
if by chance you have this error and you have a Virtualenv, remember to generate the pyinstaller exe from inside the virtual environment, I solved it like this |
System Info
System info
transformers
version: 4.29.2Issue
**After creating virtual environment and installing requirements.txt, carried out following steps to convert
.py
file into.exe
** using pyinstaller librarystep 1 :
pip install pyinstaller
step 2 :
pyinstaller --name GrammarCorrector --onefile --windowed new_gram1_Tkinter.py --hidden-import cymem.cymem
Then i got this AttributeError:
Traceback (most recent call last):
File "new_gram1_Tkinter.py", line 271, in
File "new_gram1_Tkinter.py", line 142, in init
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "transformers_init.py", line 26, in
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "transformers\dependency_versions_check.py", line 17, in
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "transformers\utils_init.py", line 30, in
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "transformers\utils\generic.py", line 29, in
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "transformers\utils\import_utils.py", line 36, in
File "transformers\utils\logging.py", line 124, in get_logger
File "transformers\utils\logging.py", line 88, in _configure_library_root_logger
AttributeError: 'NoneType' object has no attribute 'flush'
I raised issue in
pyinstaller
repository, and i got answer as followed below from @bwoodsend who is a maintainerYou should be able to get the same error without
PyInstaller
if you run your source code usingpythonw
instead of justpython
. Raise a bug totransformers
if they have their own windowed-mode-naive logger. https://github.com/orgs/pyinstaller/discussions/7689#discussion-5270292Who can help?
@sgugger
@ArthurZucker
@LysandreJik
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
I want my
.py
file in.exe
file and when i am doing that usingpyinstaller
it is giving Attribute error when i askedpyinstaller
developers on repository they suggested me to raise bug report ontransformers
saying that if they have their own windowed-mode-naive logger.Expected behavior
i want
.exe
file from.py
The text was updated successfully, but these errors were encountered: