Intellij IDEA Ultimate: unable to create virtual environment
Hi -
I'm trying to create a virtual environment for various Python projects, using IDEA's graphical UIs, and I'm getting the following error message:
"Failed to Created Interpreter"
'Failed to create a virtual environment'
and the following in the IntelliJ log:
2022-05-16 10:44:56,949 [ 122693] INFO - #c.j.p.p.PyPackageManagerImpl - Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/__main__.py", line 167, in <module>
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/__main__.py", line 163, in run
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/__main__.py", line 18, in run
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/run/__init__.py", line 32, in cli_run
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/run/session.py", line 46, in run
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/run/session.py", line 53, in _create
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/creator.py", line 171, in run
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 101, in create
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/via_global_ref/api.py", line 89, in create
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/via_global_ref/api.py", line 92, in install_patch
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py", line 27, in env_patch_text
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/create/via_global_ref/api.py", line 103, in env_patch_text
File "/usr/local/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/app_data/base.py", line 58, in ensure_extracted
File "/usr/local/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/app_data/via_disk_folder.py", line 83, in extract
File "/home/bridger/.local/share/JetBrains/IntelliJIdea2022.1/python/helpers/virtualenv.pyz/virtualenv/util/zipapp.py", line 22, in extract
File "/usr/local/lib/python3.8/zipfile.py", line 1441, in getinfo
raise KeyError(
KeyError: "There is no item named 'ualenv/create/via_global_ref/_virtualenv.py' in the archive"
Is this a simple configuration problem, or is this a bug? I'm currently working around this with the command line, but thought I would ask if this was a known issue. I didn't find anything immediately in YouTrack.
Thanks for your help!
Best,
Bridger
Please sign in to leave a comment.
It is a bug in virtualenv when i install jetbraintoolbox with scoop. The
full_path
is not the realpath of it but a link. So i add that in red box and now work normally.Could you try creating a virtualenv using another interpreter as a base?
Does the same error appear?
Hi Sergey Karpov -
Thanks for your suggestion (and apologies for the slow response).
I've added Python v3.9 and have tried creating the virtualenv with it as the base, but get the same error:
Any other suggestions? Should I create a YouTrack ticket for this?
Does running python3 -S /path/to/virtualenv.pyz /destination/folder also fail in the command line?
If so, check if it works with the same virtualenv version (PyCharm currently uses 20.13.0) installed from PyPI.
Hi Sergey Karpov - thanks for the continued help.
I've tried your suggestion with both python3.8 (my default `python3`) and python3.9, and both commands are successful; e.g.
and
Hmm, interesting.
Could you indeed file a bug to https://youtrack.jetbrains.com/issues/PY and attach your idea.log file from Help | Show Log in...?
It will be easier to continue the investigation there as the forum doesn't allow file attachments.
Sergey Karpov - apologies for the slow response. Between the creation of this thread and Monday, I applied a system update and now this doesn't seem to be a problem any more. I'm not exactly sure what changed, but this seems to be resolved. Thank you again for the help trying to triage the problem!