question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

20b1: "RuntimeError: failed to detect cpython3.6.8-64|..."

See original GitHub issue

this is breaking some tests for pre-commit

this is similar to #1514 but involves absolute paths

here’s a minimal reproduction:

set -euxo pipefail
rm -rf venv1 venv2
virtualenv venv1
venv1/bin/pip install virtualenv --upgrade --pre
"$PWD/venv1/bin/python" -mvirtualenv venv2 -p "$PWD/venv1/bin/python"
$ bash t.sh 
+ rm -rf venv1 venv2
+ virtualenv venv1
Using real prefix '/usr'
Path not in prefix '/home/asottile/opt/venv/include/python3.6m' '/usr'
New python executable in /home/asottile/workspace/pre-commit/venv1/bin/python3
Also creating executable in /home/asottile/workspace/pre-commit/venv1/bin/python
Installing setuptools, pip, wheel...
done.
+ venv1/bin/pip install virtualenv --upgrade --pre
Collecting virtualenv
  Using cached virtualenv-20.0.0b1-py2.py3-none-any.whl (4.6 MB)
Collecting appdirs<2,>=1.4.3
  Using cached appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
Collecting filelock<4,>=3.0.0
  Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
  Using cached importlib_metadata-1.4.0-py2.py3-none-any.whl (29 kB)
Collecting importlib-resources<2,>=1.0; python_version < "3.7"
  Using cached importlib_resources-1.0.2-py2.py3-none-any.whl (32 kB)
Collecting six<2,>=1.12.0
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting zipp>=0.5
  Using cached zipp-2.1.0-py3-none-any.whl (4.6 kB)
Installing collected packages: appdirs, filelock, zipp, importlib-metadata, importlib-resources, six, virtualenv
Successfully installed appdirs-1.4.3 filelock-3.0.12 importlib-metadata-1.4.0 importlib-resources-1.0.2 six-1.14.0 virtualenv-20.0.0b1 zipp-2.1.0
+ /home/asottile/workspace/pre-commit/venv1/bin/python -mvirtualenv venv2 -p /home/asottile/workspace/pre-commit/venv1/bin/python
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/__main__.py", line 27, in <module>
    run()
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/__main__.py", line 16, in run
    run_via_cli(args)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/run/__init__.py", line 21, in run_via_cli
    session = session_via_cli(args)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/run/__init__.py", line 35, in session_via_cli
    CreatorSelector(interpreter, parser),
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/run/plugin/creators.py", line 15, in __init__
    creators, self.key_to_meta, self.describe, self.builtin_key = self.for_interpreter(interpreter)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/run/plugin/creators.py", line 26, in for_interpreter
    meta = creator_class.can_create(interpreter)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 33, in can_create
    for src in cls.sources(interpreter):
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 54, in sources
    for host_exe, targets in cls._executables(interpreter):
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/create/via_global_ref/builtin/cpython/common.py", line 31, in _executables
    host_exe = Path(interpreter.system_executable)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/discovery/py_info.py", line 203, in system_executable
    result = self.find_exe_based_of(inside_folder=env_prefix)
  File "/home/asottile/workspace/pre-commit/venv1/lib/python3.6/site-packages/virtualenv/discovery/py_info.py", line 225, in find_exe_based_of
    "failed to detect {} in {}".format(what, os.pathsep.join(possible_folders))
RuntimeError: failed to detect cpython3.6.8-64|cpython3.6.8|cpython3.6-64|cpython3.6|cpython3-64|cpython3|cpython-64|cpython|CPython3.6.8-64|CPython3.6.8|CPython3.6-64|CPython3.6|CPython3-64|CPython3|CPython-64|CPython|CPYTHON3.6.8-64|CPYTHON3.6.8|CPYTHON3.6-64|CPYTHON3.6|CPYTHON3-64|CPYTHON3|CPYTHON-64|CPYTHON|python3.6.8-64|python3.6.8|python3.6-64|python3.6|python3-64|python3|python-64|python|PYTHON3.6.8-64|PYTHON3.6.8|PYTHON3.6-64|PYTHON3.6|PYTHON3-64|PYTHON3|PYTHON-64|PYTHON in /usr/bin:/usr
$ uname -a
Linux asottile-MacBookPro 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic
$ venv1/bin/python --version --version
Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]
$ venv1/bin/pip freeze --all
appdirs==1.4.3
filelock==3.0.12
importlib-metadata==1.4.0
importlib-resources==1.0.2
pip==20.0.2
setuptools==45.1.0
six==1.14.0
virtualenv==20.0.0b1
wheel==0.34.1
zipp==2.1.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Jan 29, 2020

here’s a Dockerfile:

$ tail -n999 Dockerfile t.sh 
==> Dockerfile <==
FROM ubuntu:bionic
RUN : \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        git-core \
        python3-distutils \
        python3.6=3.6.8-1~18.04.3 \
        python3.6-minimal=3.6.8-1~18.04.3 \
        libpython3.6-minimal=3.6.8-1~18.04.3 \
        libpython3.6-stdlib=3.6.8-1~18.04.3 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
RUN curl https://asottile.github.io/get-virtualenv.py | python3.6 - /venv
RUN : \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python3.6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
COPY t.sh /t.sh

==> t.sh <==
#!/usr/bin/env bash
set -euxo pipefail
rm -rf venv2
/venv/bin/pip install git+https://github.com/gaborbernat/virtualenv@1515
/venv/bin/python -mvirtualenv venv2 -vv

t.sh is chmod +x

0reactions
asottilecommented, Jan 31, 2020

via #1522

Read more comments on GitHub >

github_iconTop Results From Across the Web

error when creating a pipenv virtual environment with python 3.7
10-distutils The error message was RuntimeError: failed to query /usr/bin/python3.10 with code 1 err: '/usr/lib/python3/dist-packages/virtualenv ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found