{"id":1121,"hash":"82beabc79dcddc024cb099df8f59ff95bc14e9c921543331d876952010569903","pattern":"error when creating a pipenv virtual environment with python 3.7","full_message":"My OS is ubuntu 20.04 and my default python is 3.8.2. I'm trying to create a virtual environment with pipenv and python 3.7. The following error occurs when I run pipenv install --python 3.7:\n\nCreating a virtualenv for this project…\nUsing /usr/bin/python3.7m (3.7.0) to create virtualenv…\n⠋RuntimeError: failed to query /usr/bin/python3.7m with code 1 err: 'Traceback (most recent call last):\\n  File \"/usr/lib/python3/dist-packages/virtualenv/discovery/py_info.py\", line 16, in <module>\\n    from distutils.command.install import SCHEME_KEYS\\nModuleNotFoundError: No module named \\'distutils.command\\'\\n'\nError while trying to remove the /home/yuhao/.local/share/virtualenvs/electrode-mimic-j_E-dTLW env: \nNo such file or directory\n\nVirtualenv location: \nWarning: Your Pipfile requires python_version 3.7, but you are using None (/bin/python).\n  $ pipenv check will surely fail.\nCreating a virtualenv for this project…\nUsing /usr/bin/python3 (3.8.2) to create virtualenv…\n⠙created virtual environment CPython3.8.2.final.0-64 in 162ms\n  creator CPython3Posix(dest=/home/yuhao/.local/share/virtualenvs/electrode-mimic-j_E-dTLW, clear=False, global=False)\n  seeder FromAppData(download=False, progress=latest, msgpack=latest, pytoml=latest, packaging=latest, setuptools=latest, contextlib2=latest, retrying=latest, pip=latest, pep517=latest, idna=latest, CacheControl=latest, appdirs=latest, requests=latest, pkg_resources=latest, webencodings=latest, distlib=latest, certifi=latest, distro=latest, ipaddr=latest, wheel=latest, six=latest, pyparsing=latest, urllib3=latest, chardet=latest, colorama=latest, lockfile=latest, html5lib=latest, via=copy, app_data_dir=/home/yuhao/.local/share/virtualenv/seed-app-data/v1.0.1.debian)\n  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator\n\nVirtualenv location: /home/yuhao/.local/share/virtualenvs/electrode-mimic-j_E-dTLW\nPipfile.lock not found, creating…\nLocking [dev-packages] dependencies…\n^C\nAborted!\n\nWhy is this happening?","ecosystem":"pypi","package_name":"python-3.x","package_version":null,"solution":"Did you install the python3-distutils package ?\nIf not you can install it with :\n\n sudo apt-get install python3-distutils\n\nIf you need it for a python3 version that is not the system default, specify the python 3 version :\n\nsudo apt-get install python3.X-distutils\n\nexample: python3.8-distutils","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/64234182/error-when-creating-a-pipenv-virtual-environment-with-python-3-7","votes":14,"created_at":"2026-04-19T04:52:22.559265+00:00","updated_at":"2026-04-19T04:52:22.559265+00:00"}