ModuleNotFoundError: No module named 'typing.io'; 'typing' is not a packageSee original GitHub issue
OS: Windows 10 Professional x64, Build 1909 Python: 3.8.10 VSCode: 1.58.2 AREPL: 2.0.2
importlib.resources, AREPL generates the error:
File "C:\Program Files\Python38\lib\importlib\resources.py", line 13, in <module> from typing.io import BinaryIO, TextIO ModuleNotFoundError: No module named 'typing.io'; 'typing' is not a package
python 3.8.10virtual environment with
venvin project folder:
py -m venv .venv
- Create VSCode user settings to point AREPL to virtual environment:
- Create file
demo.pyin project folder
import importlib.resources as rsrc
- Click cat button for AREPL to run repl
AREPL uses virtual environment and is able to import
- Created a year ago
- Comments:13 (4 by maintainers)
Top GitHub Comments
I believe this is related to AREPL’s typescript code.
The Typescript code doesn’t have much to do with the python code outside of spawning the process and pipe I/O. The issue is more likely to be with the AREPL python code, which does some funky stuff around importing so there is a fresh state each time. https://github.com/Almenon/AREPL-backend/blob/master/python/arepl_python_evaluator.py
One thing that’s pretty weird is that I don’t get this bug with python 3.9, only 3.8 and 3.10 (haven’t checked 3.11). I also can’t reproduce the issue in a unit test. @adam-grant-hendry do you get this issue with 3.9?
Also, adding “typing.io” to the modules_to_keep variable in
C:\Users\<yourUser>\.vscode\extensions\almenon.arepl-2.0.3\node_modules\arepl-backend\python\arepl_python_evaluator.py (insert after line 27) fixes the issue on my end. Does it fix the issue for you?
Hello, can you please explain how exactly did you fixed it ? Do i need to do it on VS code. Where can i find the ressource.py file ?
Sorry for a late reply. For what it’s worth, the resources.py file is a part of the importlib library. On my mac it’s located at /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/resources.py.