AREPL-vscode icon indicating copy to clipboard operation
AREPL-vscode copied to clipboard

Wrong version of python used

Open KikeVen opened this issue 4 years ago • 11 comments

I had imported asyncio, got the following error. Removed the import and all the associated asyncio and still getting the following error.

Sorry, AREPL has ran into an error

Traceback (most recent call last):
  File "c:\Users\k\.vscode-insiders\extensions\almenon.arepl-2.0.3\node_modules\arepl-backend\python\arepl_python_evaluator.py", line 298, in main
    return_info = exec_input(execArgs)
  File "c:\Users\k\.vscode-insiders\extensions\almenon.arepl-2.0.3\node_modules\arepl-backend\python\arepl_python_evaluator.py", line 234, in exec_input
    asyncio.set_event_loop(asyncio.new_event_loop())
  File "C:\Users\k\AppData\Local\Programs\Python\Python35\lib\asyncio\events.py", line 642, in new_event_loop
    return get_event_loop_policy().new_event_loop()
  File "C:\Users\k\AppData\Local\Programs\Python\Python35\lib\asyncio\events.py", line 617, in get_event_loop_policy
    _init_event_loop_policy()
  File "C:\Users\k\AppData\Local\Programs\Python\Python35\lib\asyncio\events.py", line 610, in _init_event_loop_policy
    from . import DefaultEventLoopPolicy
SystemError: Parent module 'asyncio' not loaded, cannot perform relative import

KikeVen avatar Jul 29 '21 02:07 KikeVen

You're on python 3.5. AREPL requires python 3.7 or greater. What version of AREPL are you on?

Almenon avatar Jul 29 '21 03:07 Almenon

I am using 3.7.4 64-bit venv. This environment is part of a workspace in vscode

Update: 9:56 am I just opened this particular folder outside of the workspace and it works. So the problem is when it is part of a workspace. The correct interpreter is being chosen in the workspace.

KikeVen avatar Jul 29 '21 13:07 KikeVen

Arepl v2.0.3 has an update that should automatically use the python path you have chosen with the python extension. Are you using arepl v2.0.3 and the python extension?

Almenon avatar Jul 29 '21 15:07 Almenon

Yes, I am running v2.0.3. As I mentioned before, mine is part of a Workspace, vscode asks which venv I want to use, the problem might be there. Not VSCode, but AREPL should be aware of it. Again when I open the project as a stand alone it works fine, only when I open the project as part of a Workspace I get the posted error.

On Thu, Jul 29, 2021 at 11:22 AM Almenon @.***> wrote:

Arepl v2.0.3 has an update that should automatically use the python path you have chosen with the python extension. Are you using arepl v2.0.3 and the python extension?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Almenon/AREPL-vscode/issues/418#issuecomment-889237572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN6OUAQCQQ727VHUDY7DE3T2FW3BANCNFSM5BFPXEBA .

KikeVen avatar Jul 29 '21 23:07 KikeVen

Can you send me a full-screen screenshot of VSCode when the error appears please?

Almenon avatar Jul 30 '21 05:07 Almenon

Sure, emailed.

Thank you

On Fri, Jul 30, 2021 at 1:07 AM Almenon @.***> wrote:

Can you send me a full-screen screenshot of VSCode when the error appears please?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Almenon/AREPL-vscode/issues/418#issuecomment-889631297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN6OUDXB6ML2VN7RD4N6ZTT2IXRBANCNFSM5BFPXEBA .

KikeVen avatar Jul 30 '21 14:07 KikeVen

KikeVen emailed me, this definitely looks like a bug. Possibly a bug with the python extension - it may be giving me the wrong path, because he has python 3.7 yet AREPL is running python 3.5

Almenon avatar Jul 30 '21 15:07 Almenon

What version of the python extension are you on?

Almenon avatar Aug 08 '21 14:08 Almenon

Nevermind, confirmed this is a issue with the latest python version. I was able to reproduce the scenario and get the wrong version of python in AREPL.

Almenon avatar Aug 08 '21 15:08 Almenon

Sorry for the tardiness, didn't have access to my system until now. I am running vscode - insider version 1.59.0 and AREPL for Python version 2.0.3

KikeVen avatar Aug 09 '21 22:08 KikeVen

Today I ran into a similar problem with importing modules and wrong detection of Python interpreter for AREPL extension. I use poetry, by the way. I think, this is due to Python extension changed setting name to python.defaultInterpreterPath in July 2021 (instead of old python.pythonPath).

Default value is python and it's not changed after selecting Python interpreter (stay `python' in settings but changed in the bottom of VS Code (status bar) . I had to set path explicitly in settings: image

Python path for AREPL extension stays blank (by default)

This helped me.
But pay attention: if you use multi-folder workspace, path to folder must be absolute path (not relative).
Or use absolute path to Python interpreter in settings (but don't forget that other workspace's folders will take this path, that's why I use place holder ${workspaceFolder}.

I work on Windows, therefore \ in paths.

UPD: And restart VS code window with this workspace :)

hotenov avatar Aug 15 '21 08:08 hotenov