ModuleNotFoundError: No module named 'anyio._backends'
See original GitHub issueI’m using asks under trio, and I’m compiling it to an .exe file with PyInstaller. Every time asks is run on the compiled .exe it returns the following error:
File "site-packages\anyio\__init__.py", line 94, in _get_asynclib
KeyError: 'anyio._backends._trio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "myscript.py", line 324, in myfunction
File "site-packages\asks\base_funcs.py", line 30, in request
File "site-packages\asks\sessions.py", line 198, in request
File "site-packages\asks\sessions.py", line 365, in sema
File "site-packages\anyio\__init__.py", line 698, in create_semaphore
File "site-packages\anyio\__init__.py", line 96, in _get_asynclib
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'anyio._backends'
- Platform: Windows-10-10.0.19041-SP0
- PyInstaller: 3.6
- Python: 3.8.0
- Trio: 0.16.0
- Asks: 2.4.8
- Anyio 1.4.0
It’s already imported on the main function, I tried to hiddenimport it on a hook file and also manually when compiling, but it results the same.
Is anyio not compatible with PyInstaller? Or am I not seeing something?
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (12 by maintainers)
Top Results From Across the Web
anyio · PyPI
AnyIO is an asynchronous networking and concurrency library that works on top of either ... It will blend in with native libraries of...
Read more >ModuleNotFoundError: No module named 'anyio'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'anyio' How to remove the ModuleNotFou.
Read more >Testing with AnyIO — AnyIO 1.4.0 documentation
Any coroutine fixture that is activated by a test marked with @pytest.mark.anyio will be run with the same backend as the test itself....
Read more >How to fix "ModuleNotFoundError: No module named 'anyio'"
You must first install the package before you can use it in your code. Run the following command to install the package and...
Read more >No module named when using PyInstaller - Stack Overflow
If you are getting ModuleNotFoundError: No module named ... errors and you: ... your own backend outside of matplotlib by # referring to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
~~https://github.com/pyinstaller/pyinstaller/pull/5054~~ https://github.com/pyinstaller/pyinstaller-hooks-contrib/pull/22
I prefer the solution of collecting all backend modules automatically in the PyInstaller hook. This should not be a problem going forward.