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

Interpreter lookup fails on Arch Linux #2164

Closed
rpigott opened this issue Aug 9, 2021 · 1 comment
Closed

Interpreter lookup fails on Arch Linux #2164

rpigott opened this issue Aug 9, 2021 · 1 comment
Labels

Comments

@rpigott
Copy link

rpigott commented Aug 9, 2021

When trying to create a virtualenv, I get the following result:

$ virtualenv -p python2.7 tmp -vvv --with-traceback
44 setup logging to NOTSET [DEBUG report:43]
59 find interpreter for spec PythonSpec(implementation=CPython, major=2, minor=7) [INFO builtin:62]
59 proposed PythonInfo(spec=CPython3.9.6.final.0-64, exe=/usr/bin/python, platform=linux, version='3.9.6 (default, Jun 30 2021, 10:22:16) \n[GCC 11.1.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
59 discover PATH[0]=/home/ronan/.local/bin [DEBUG builtin:114]
59 filesystem is case-sensitive [DEBUG info:28]
60 discover PATH[1]=/usr/local/sbin [DEBUG builtin:114]
60 discover PATH[2]=/usr/local/bin [DEBUG builtin:114]
60 discover PATH[3]=/usr/bin [DEBUG builtin:114]
60 discover PATH[4]=/var/lib/flatpak/exports/bin [DEBUG builtin:114]
60 discover PATH[5]=/usr/lib/jvm/default/bin [DEBUG builtin:114]
60 discover PATH[6]=/usr/bin/site_perl [DEBUG builtin:114]
60 discover PATH[7]=/usr/bin/vendor_perl [DEBUG builtin:114]
61 discover PATH[8]=/usr/bin/core_perl [DEBUG builtin:114]
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 33, in <module>
    sys.exit(load_entry_point('virtualenv==20.7.0', 'console_scripts', 'virtualenv')())
  File "/usr/lib/python3.9/site-packages/virtualenv/__main__.py", line 65, in run_with_catch
    run(args, options, env)
  File "/usr/lib/python3.9/site-packages/virtualenv/__main__.py", line 18, in run
    session = cli_run(args, options, env)
  File "/usr/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 30, in cli_run
    of_session = session_via_cli(args, options, setup_logging, env)
  File "/usr/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 48, in session_via_cli
    parser, elements = build_parser(args, options, setup_logging, env)
  File "/usr/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 72, in build_parser
    raise RuntimeError("failed to find interpreter for {}".format(discover))
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python2.7'

I see something similar has been reported and addressed in #1643/#1910, but distutils is available on my installation and I get the error regardless. Some more info:

$ head -1 /etc/os-release
NAME="Arch Linux"
$ pacman -Qo python virtualenv
/usr/bin/python is owned by python 3.9.6-1
/usr/bin/virtualenv is owned by python-virtualenv 20.7.0-1
$ python -c 'import disutils; print(distutils.__file__)' | pacman -Qo -
/usr/lib/python3.9/distutils/__init__.py is owned by python 3.9.6-1

The behavior is the same for every python version I tested, with the exception of 3.9.6 which the only version installed on my machine.

@rpigott rpigott added the bug label Aug 9, 2021
@gaborbernat
Copy link
Contributor

As detailed by https://virtualenv.pypa.io/en/latest/user_guide.html#creators virtualenv out of the box is only able to create virtual environments for python versions that are already installed globally on your OS. So it's working as expected. If you'd like to create python2.7 environment you need to install first python27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants