Skip to content
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

Wrong version of python used #418

Open
KikeVen opened this issue Jul 29, 2021 · 11 comments
Open

Wrong version of python used #418

KikeVen opened this issue Jul 29, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@KikeVen
Copy link

KikeVen commented Jul 29, 2021

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
@Almenon
Copy link
Owner

Almenon commented Jul 29, 2021

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

@KikeVen
Copy link
Author

KikeVen commented Jul 29, 2021

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.

@Almenon
Copy link
Owner

Almenon commented Jul 29, 2021

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?

@KikeVen
Copy link
Author

KikeVen commented Jul 29, 2021 via email

@Almenon
Copy link
Owner

Almenon commented Jul 30, 2021

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

@KikeVen
Copy link
Author

KikeVen commented Jul 30, 2021 via email

@Almenon Almenon added the bug Something isn't working label Jul 30, 2021
@Almenon
Copy link
Owner

Almenon commented Jul 30, 2021

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 Almenon changed the title SystemError: Parent module 'asyncio' not loaded, cannot perform relative impor Wrong version of python used Jul 30, 2021
@Almenon
Copy link
Owner

Almenon commented Aug 8, 2021

What version of the python extension are you on?

@Almenon
Copy link
Owner

Almenon commented Aug 8, 2021

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.

@KikeVen
Copy link
Author

KikeVen commented Aug 9, 2021

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

@hotenov
Copy link

hotenov commented Aug 15, 2021

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants