pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

`pipenv install` errors out with `ModuleNotFoundError: No module named 'distutils.cmd'` even though it is present on the system

Open marekdedic opened this issue 2 years ago • 20 comments
trafficstars

Hi, while running pipenv install, I get a long list of errors, but I think the most important one is the following few lines:

[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/__pip-runner__.py", line 50, in <module>
[pipenv.exceptions.InstallError]:     runpy.run_module("pip", run_name="__main__", alter_sys=True)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 225, in run_module
[pipenv.exceptions.InstallError]:     return _run_module_code(code, init_globals, run_name, mod_spec)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
[pipenv.exceptions.InstallError]:     _run_code(code, mod_globals, init_globals,
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
[pipenv.exceptions.InstallError]:     exec(code, run_globals)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/__main__.py", line 35, in <module>
[pipenv.exceptions.InstallError]:     spec.loader.exec_module(pipenv)
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/__init__.py", line 63, in <module>
[pipenv.exceptions.InstallError]:     from .cli import cli
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/cli/__init__.py", line 1, in <module>
[pipenv.exceptions.InstallError]:     from .command import cli  # noqa
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/cli/command.py", line 7, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.cli.options import (
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/cli/options.py", line 3, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.project import Project
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/project.py", line 19, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.environment import Environment
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/environment.py", line 17, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.commands.install import InstallCommand
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/commands/__init__.py", line 9, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.cli.base_command import Command
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/cli/base_command.py", line 15, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.cli import cmdoptions
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/cli/cmdoptions.py", line 24, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.cli.parser import ConfigOptionParser
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/cli/parser.py", line 12, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.configuration import Configuration, ConfigurationError
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/configuration.py", line 26, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.utils.logging import getLogger
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/utils/logging.py", line 29, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.utils.misc import ensure_dir
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/utils/misc.py", line 42, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.locations import get_major_minor_version
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/locations/__init__.py", line 67, in <module>
[pipenv.exceptions.InstallError]:     from . import _distutils
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/_internal/locations/_distutils.py", line 20, in <module>
[pipenv.exceptions.InstallError]:     from distutils.cmd import Command as DistutilsCommand
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'distutils.cmd'

I have searched for the common causes of this and I can say the following:

  • I have python3-distutils and python3-apt installed, I also tried reinstalling them
  • I can import the distutils module from my system python:
    ❯ python3
    Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from distutils.cmd import Command
    >>>
    
  • I can also import the distutils module from pipenv shell:
    ❯ python
    Python 3.9.13 (main, Jun  8 2022, 09:45:57)
    [GCC 11.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from distutils.cmd import Command
    >>>
    

So.. What gives? The module is obviously there, but somehow pipenv cannot find it


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

If you're on Linux, run the following:

$ pipenv --support

Pipenv version: '2022.12.19'

Pipenv location: '/usr/lib/python3/dist-packages/pipenv'

Python location: '/usr/bin/python3'

OS Name: 'posix'

User pip version: '22.3.1'

user Python installations found:

  • 3.11.2: /usr/bin/python3
  • 3.11.2: /bin/python3
  • 3.9.13: /usr/bin/python3.9
  • 3.9.13: /bin/python3.9
  • 3.8.5: /opt/miniconda3/bin/python3
  • 3.8.5: /opt/miniconda3/bin/python3.8
  • 3.8.5: /opt/miniconda3/bin/python
  • 2.7.18: /usr/bin/python2
  • 2.7.18: /usr/bin/python2.7
  • 2.7.18: /bin/python2
  • 2.7.18: /bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.1.0-7-amd64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT_DYNAMIC Debian 6.1.20-2 (2023-04-08)',
 'python_full_version': '3.11.2',
 'python_version': '3.11',
 'sys_platform': 'linux'}

System environment variables:

  • ALACRITTY_LOG
  • ALACRITTY_SOCKET
  • ALACRITTY_WINDOW_ID
  • ANDROID_HOME
  • COLORTERM
  • CONDA_DEFAULT_ENV
  • CONDA_EXE
  • CONDA_PREFIX
  • CONDA_PROMPT_MODIFIER
  • CONDA_PYTHON_EXE
  • CONDA_SHLVL
  • DBUS_SESSION_BUS_ADDRESS
  • DESKTOP_SESSION
  • DISPLAY
  • EDITOR
  • GDMSESSION
  • GDM_LANG
  • GIO_LAUNCHED_DESKTOP_FILE
  • GIO_LAUNCHED_DESKTOP_FILE_PID
  • GJS_DEBUG_OUTPUT
  • GJS_DEBUG_TOPICS
  • GNOME_DESKTOP_SESSION_ID
  • GNOME_SETUP_DISPLAY
  • GTK_MODULES
  • HOME
  • INVOCATION_ID
  • JOURNAL_STREAM
  • JULIA_NUM_THREADS
  • LANG
  • LANGUAGE
  • LC_MEASUREMENT
  • LC_MONETARY
  • LC_NUMERIC
  • LC_PAPER
  • LC_TIME
  • LESS
  • LOGNAME
  • LSCOLORS
  • LS_COLORS
  • MANAGERPID
  • MOZ_ENABLE_WAYLAND
  • OLDPWD
  • P9K_TTY
  • PAGER
  • PATH
  • POWERLINE_COMMAND
  • PWD
  • QTWEBENGINE_DICTIONARIES_PATH
  • QT_ACCESSIBILITY
  • QT_IM_MODULE
  • SESSION_MANAGER
  • SHELL
  • SHLVL
  • SKIM_CTRL_T_COMMAND
  • SKIM_DEFAULT_COMMAND
  • SSH_AGENT_LAUNCHER
  • SSH_AUTH_SOCK
  • SYSTEMD_EXEC_PID
  • TERM
  • TERM_PROGRAM
  • TERM_PROGRAM_VERSION
  • TMUX
  • TMUX_PANE
  • TMUX_PLUGIN_MANAGER_PATH
  • USER
  • USERNAME
  • VISUAL
  • WAYLAND_DISPLAY
  • WINDOWID
  • XAUTHORITY
  • XDG_CURRENT_DESKTOP
  • XDG_MENU_PREFIX
  • XDG_RUNTIME_DIR
  • XDG_SESSION_CLASS
  • XDG_SESSION_DESKTOP
  • XDG_SESSION_TYPE
  • XMODIFIERS
  • ZSH
  • _
  • _CE_CONDA
  • _CE_M
  • _P9K_SSH_TTY
  • _P9K_TTY
  • is_vim
  • P9K_SSH
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/user/.local/bin:/opt/miniconda3/bin:/opt/miniconda3/condabin:/home/user/.local/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • SHELL: /bin/zsh
  • EDITOR: nvim
  • LANG: en_US.UTF-8
  • PWD: /home/user/project

Contents of Pipfile ('/home/user/project/Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[[source]]
name = "redacted"
url = "redacted"
verify_ssl = true

[dev-packages]
notebook = "== 6.4.12"
jupyterhub = "== 1.5.0"
jupyterlab = "== 3.3.2"
dask-labextension = "== 5.2.0"
bokeh = "== 2.4.3"
ipywidgets = "== 7.7.0"
# Research
matplotlib = "*"
scikit-learn = "*"
scipy = "*"
cryptography = ">=38.0.3"

[packages]
## DASK
kubernetes = "== 17.17.0"
dask = { extras = ["complete", "dataframe"], version = "== 2022.09.2" }
dask-kubernetes = "== 2022.9.0"
distributed = "== 2022.09.2"
click = "== 8.0.2"
# Research
aiohttp = ">=3.7.4"
fastparquet = "*"
python-snappy = "*"
pandas = "1.5.0"
pyarrow = "*"
pyathena = "*"
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
s3fs = "*"
smart_open = "*"
numpy = "*"
hypothesis = "*"
threatqsdk = { version = "*", index = "cognitive-intelligence" }
vt-py = "==0.17.3"
tldextract = "*"
aiofiles = "*"
pytest-asyncio = "*"

[requires]
python_version = "3.9"
#TODO: doens't work with jupyterhub

[pipenv]
allow_prereleases = false

Contents of Pipfile.lock ('/home/user/project/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "d743e6571b658ebc0baf48d5cc01fe2170bd3f490330ab917bec86b7c763e859"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.9"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            },
            {
                "name": "redacted",
                "url": "redacted",
                "verify_ssl": true
            }
        ]
    },
    "default": {
	}
}

marekdedic avatar May 04 '23 15:05 marekdedic

@marekdedic I am not sure as I have not seen this issue before, but noting you are on 2022.12.19 -- could you try upgrading to 2023.4.29 and see if the issue persists?

matteius avatar May 16 '23 09:05 matteius

Nope, the issue is still the same even with that version of pipenv. In the meantime, I somehow got it to work once (had to install libsnappy-dev along the way), but I cannot recreate it again :(

marekdedic avatar May 17 '23 15:05 marekdedic

Is it possible you have an old version of pipenv somewhere on the path and its getting confused when running the subprocesses?

matteius avatar May 19 '23 23:05 matteius

Also would be worth having you try the new release of pipenv that was just cut, but make sure you pip uninstall pipenv --yes multiple times until it is clearly not on the path anymore, just in case.

matteius avatar May 19 '23 23:05 matteius

same issue here:

pipenv --support

$ pipenv --support

Pipenv version: '2023.5.19'

Pipenv location: '/usr/local/lib/python3.10/dist-packages/pipenv'

Python location: '/usr/bin/python3'

OS Name: 'posix'

User pip version: '23.1.2'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.6',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.15.0-71-generic',
 'platform_system': 'Linux',
 'platform_version': '#78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023',
 'python_full_version': '3.10.6',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SUDO_GID
  • PIPENV_ACTIVE
  • SUDO_COMMAND
  • SUDO_USER
  • PWD
  • LOGNAME
  • PIP_PYTHON_PATH
  • HOME
  • LANG
  • LS_COLORS
  • VIRTUAL_ENV
  • LC_TERMINAL
  • LESSCLOSE
  • TERM
  • LESSOPEN
  • USER
  • PIP_DISABLE_PIP_VERSION_CHECK
  • LC_TERMINAL_VERSION
  • SHLVL
  • PYTHONDONTWRITEBYTECODE
  • PS1
  • PATH
  • SUDO_UID
  • MAIL
  • _
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /root/.local/share/virtualenvs/bulk-tasmota-configuration-m6np3S30/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/wilson/code/bulk-tasmota-configuration
  • VIRTUAL_ENV: /root/.local/share/virtualenvs/bulk-tasmota-configuration-m6np3S30

Contents of Pipfile ('/home/wilson/code/bulk-tasmota-configuration/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
click = "*"
requests = "*"
json5 = "*"

[requires]
python_version = "3.8"

Contents of Pipfile.lock ('/home/wilson/code/bulk-tasmota-configuration/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "c61669a9ce743977a1086ea43786f01c4a80be0479cec3697de13cbf8c492d50"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.8"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d",
                "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==2022.6.15"
        },
        "charset-normalizer": {
            "hashes": [
                "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5",
                "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==2.1.0"
        },
        "click": {
            "hashes": [
                "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e",
                "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"
            ],
            "index": "pypi",
            "version": "==8.1.3"
        },
        "idna": {
            "hashes": [
                "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
                "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
            ],
            "markers": "python_version >= '3.5'",
            "version": "==3.3"
        },
        "json5": {
            "hashes": [
                "sha256:1ff8351ee2ae80fd89d64210d9522db7e157516a7b12c72089ded6964527283f",
                "sha256:2ace77117c068c5f1f23f97e530a0d49bc09a46039521b6daa74aa39524e02a2"
            ],
            "index": "pypi",
            "version": "==0.9.9"
        },
        "requests": {
            "hashes": [
                "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
                "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
            ],
            "index": "pypi",
            "version": "==2.28.1"
        },
        "urllib3": {
            "hashes": [
                "sha256:c33ccba33c819596124764c23a97d25f32b28433ba0dedeb77d873a38722c9bc",
                "sha256:ea6e8fb210b19d950fab93b60c9009226c63a28808bc8386e05301e25883ac0a"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'",
            "version": "==1.26.11"
        }
    },
    "develop": {}
}

bdwilson avatar May 28 '23 20:05 bdwilson

What version of setuptools do you have installed?

matteius avatar May 28 '23 23:05 matteius

System python:

>>> setuptools.__version__
'67.7.2'

pipenv shell:

>>> setuptools.__version__
'66.1.1'

marekdedic avatar Jun 08 '23 19:06 marekdedic

Could this be rechecked with 2023.6.12 -- I have a hunch that the sys.path hacks I removed could have been causing this as well.

matteius avatar Jun 13 '23 17:06 matteius

Still the same with 2023.6.18 :(

marekdedic avatar Jun 21 '23 09:06 marekdedic

Same

$ pipenv --support

Pipenv version: '2023.6.18'

Pipenv location: '/home/mah/.local/lib/python3.10/site-packages/pipenv'

Python location: '/usr/bin/python3'

OS Name: 'posix'

User pip version: '23.1.2'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.12',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.1.0-9-amd64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08)',
 'python_full_version': '3.10.12',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SESSION_MANAGER
  • CAML_LD_LIBRARY_PATH
  • QT_ACCESSIBILITY
  • OCAML_TOPLEVEL_PATH
  • REMOTE_HOST
  • SSH_AGENT_LAUNCHER
  • XDG_MENU_PREFIX
  • GNOME_DESKTOP_SESSION_ID
  • LSP_USE_PLISTS
  • PKG_CONFIG_PATH
  • LC_ADDRESS
  • LC_NAME
  • SSH_AUTH_SOCK
  • DIRENV_DIR
  • INSIDE_EMACS
  • REMOTE_PATH
  • EMACS_VTERM_PATH
  • DEBFULLNAME
  • XMODIFIERS
  • DESKTOP_SESSION
  • LC_MONETARY
  • GPG_TTY
  • DIRENV_FILE
  • EDITOR
  • GTK_MODULES
  • PWD
  • XDG_SESSION_DESKTOP
  • LOGNAME
  • XDG_SESSION_TYPE
  • MANPATH
  • SYSTEMD_EXEC_PID
  • LOCAL_PATH
  • XAUTHORITY
  • OPAM_SWITCH_PREFIX
  • IM_CONFIG_CHECK_ENV
  • GJS_DEBUG_TOPICS
  • GDM_LANG
  • HOME
  • USERNAME
  • IM_CONFIG_PHASE
  • LC_PAPER
  • LANG
  • R2_ACCOUNT_ID
  • LS_COLORS
  • XDG_CURRENT_DESKTOP
  • WAYLAND_DISPLAY
  • DEBEMAIL
  • AWS_SECRET_ACCESS_KEY
  • QTWEBENGINE_DICTIONARIES_PATH
  • INVOCATION_ID
  • MANAGERPID
  • DIRENV_DIFF
  • GJS_DEBUG_OUTPUT
  • GNOME_SETUP_DISPLAY
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • LC_IDENTIFICATION
  • TERM
  • LESSOPEN
  • USER
  • DISPLAY
  • SHLVL
  • AWS_ACCESS_KEY_ID
  • LC_TELEPHONE
  • QT_IM_MODULE
  • LC_MEASUREMENT
  • XDG_RUNTIME_DIR
  • NPM_PACKAGES
  • DOCKER_HOST
  • LC_TIME
  • JOURNAL_STREAM
  • GCC_COLORS
  • XDG_DATA_DIRS
  • PATH
  • GDMSESSION
  • DBUS_SESSION_BUS_ADDRESS
  • DIRENV_WATCHES
  • FS_RSYNC_DELETE
  • COMPOSER_HOME
  • LC_NUMERIC
  • OLDPWD
  • _
  • PYTHONDONTWRITEBYTECODE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/mah/.opam/default/bin:/home/mah/bin:/home/mah/home-files/dotfiles/config/composer/vendor/bin:/home/mah/.config/composer/vendor/bin:/home/mah/.local/bin:/home/mah/.cargo/bin::/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/mah/.dotnet/tools
  • SHELL: /bin/bash
  • EDITOR: emacsclient
  • LANG: en_US.UTF-8
  • PWD: /home/mah/work/connectify/downloads

Contents of Pipfile ('/home/mah/work/connectify/downloads/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pyyaml = "*"

[dev-packages]

[requires]
python_version = "3.10"

Contents of Pipfile.lock ('/home/mah/work/connectify/downloads/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "9d964469a6061502bab38de2229c2671d277702c00c4cc488b251cc42eb6bf90"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.10"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "botocore": {
            "hashes": [
                "sha256:21d0c2cb1461f2676e41a896e6e551c7da09e923f416322182520851b179ebda",
                "sha256:44b26a5468402bb9e5028d8f9ef2eba973cde016979aa72f87db32ef9000dab4"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==1.29.156"
        },
        "jmespath": {
            "hashes": [
                "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980",
                "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==1.0.1"
        },
        "python-dateutil": {
            "hashes": [
                "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",
                "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==2.8.2"
        },
        "pyyaml": {
            "hashes": [
                "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf",
                "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293",
                "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b",
                "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57",
                "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b",
                "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4",
                "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07",
                "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba",
                "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9",
                "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287",
                "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513",
                "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0",
                "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782",
                "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0",
                "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92",
                "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f",
                "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2",
                "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc",
                "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1",
                "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c",
                "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86",
                "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4",
                "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c",
                "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34",
                "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b",
                "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d",
                "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c",
                "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb",
                "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7",
                "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737",
                "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3",
                "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d",
                "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358",
                "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53",
                "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78",
                "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803",
                "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a",
                "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f",
                "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174",
                "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"
            ],
            "index": "pypi",
            "version": "==6.0"
        },
        "s3transfer": {
            "hashes": [
                "sha256:3c0da2d074bf35d6870ef157158641178a4204a6e689e82546083e31e0311346",
                "sha256:640bb492711f4c0c0905e1f62b6aaeb771881935ad27884852411f8e9cacbca9"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==0.6.1"
        },
        "six": {
            "hashes": [
                "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
                "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==1.16.0"
        },
        "urllib3": {
            "hashes": [
                "sha256:8d36afa7616d8ab714608411b4a3b13e58f463aee519024578e062e141dce20f",
                "sha256:8f135f6502756bde6b2a9b28989df5fbe87c9970cecaa69041edcce7f0589b14"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'",
            "version": "==1.26.16"
        }
    },
    "develop": {}
}

hexmode avatar Jun 21 '23 13:06 hexmode

I had a similar issue with v2023.6.18 and v2023.6.12 both failing while v2023.6.11 worked. It may be unrelated to your issue but I eventually tracked it down to another pipenv install in my environment. The removal of the sys.path manipulation in 1cc03eaa3b13114fca0d84fcad25148f71f413ff exposes pipenv to issues with module resolution confusion.

I'm suspecting that pipenv is importing a module from a different install which is resulting in the downstream errors - this snippet in particular

[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
[pipenv.exceptions.InstallError]:     exec(code, run_globals)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3/dist-packages/pipenv/patched/pip/__main__.py", line 35, in <module>
[pipenv.exceptions.InstallError]:     spec.loader.exec_module(pipenv)

there looks like there could be 2 different venvs involved

/usr/lib/python3.9

and

/usr/lib/python3

In my case, I had a global pipenv install in my python 3.11 and another install in python 3.7 - running pipenv from a python 3.7 venv was using the install from the python 3.11 but resolving internal pipenv modules from the python 3.7 install

CNDW avatar Jun 26 '23 17:06 CNDW

Umm, @matteius why was this closed without any comment or resolution?

marekdedic avatar Sep 01 '23 21:09 marekdedic

@marekdedic Are you saying this is still an issue for you on 2023.9.1?

matteius avatar Sep 01 '23 21:09 matteius

@matteius Yes, I do:

$ pipenv install
Installing dependencies from Pipfile.lock (2f3ef0)...
[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/__pip-runner__.py", line 50, in <module>
[pipenv.exceptions.InstallError]:     runpy.run_module("pip", run_name="__main__", alter_sys=True)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 225, in run_module
[pipenv.exceptions.InstallError]:     return _run_module_code(code, init_globals, run_name, mod_spec)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
[pipenv.exceptions.InstallError]:     _run_code(code, mod_globals, init_globals,
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
[pipenv.exceptions.InstallError]:     exec(code, run_globals)
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/__main__.py", line 28, in <module>
[pipenv.exceptions.InstallError]:     spec.loader.exec_module(pipenv)
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/__init__.py", line 40, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.cli import cli  # noqa
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/cli/__init__.py", line 1, in <module>
[pipenv.exceptions.InstallError]:     from .command import cli  # noqa
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/cli/command.py", line 4, in <module>
[pipenv.exceptions.InstallError]:     from pipenv import environments
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/environments.py", line 8, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.utils.fileutils import normalize_drive
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/utils/fileutils.py", line 15, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.locations import USER_CACHE_DIR
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/locations/__init__.py", line 66, in <module>
[pipenv.exceptions.InstallError]:     from . import _distutils
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/locations/_distutils.py", line 20, in <module>
[pipenv.exceptions.InstallError]:     from distutils.cmd import Command as DistutilsCommand
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'distutils.cmd'
ERROR: Couldn't install package: {}
 Package installation failed...
/usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 153315 is still running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=4 encoding='utf-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=7 encoding='utf-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
$ pipenv --version
pipenv, version 2023.9.8

marekdedic avatar Sep 11 '23 20:09 marekdedic

@marekdedic Can you try setting env var _PIP_USE_SYSCONFIG = false -- I am not sure why this is happening for you, I haven't see this issue and had assumed what Travis was saying about a prior patch that we added back to ensure latest installed pipenv is in the sys path.

matteius avatar Sep 11 '23 22:09 matteius

Doesn't help :(

$ export _PIP_USE_SYSCONFIG=false
$ pipenv install
Installing dependencies from Pipfile.lock (2f3ef0)...
[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/__pip-runner__.py", line 50, in <module>
[pipenv.exceptions.InstallError]:     runpy.run_module("pip", run_name="__main__", alter_sys=True)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 225, in run_module
[pipenv.exceptions.InstallError]:     return _run_module_code(code, init_globals, run_name, mod_spec)
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
[pipenv.exceptions.InstallError]:     _run_code(code, mod_globals, init_globals,
[pipenv.exceptions.InstallError]:   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
[pipenv.exceptions.InstallError]:     exec(code, run_globals)
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/__main__.py", line 28, in <module>
[pipenv.exceptions.InstallError]:     spec.loader.exec_module(pipenv)
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[pipenv.exceptions.InstallError]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/__init__.py", line 40, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.cli import cli  # noqa
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/cli/__init__.py", line 1, in <module>
[pipenv.exceptions.InstallError]:     from .command import cli  # noqa
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/cli/command.py", line 4, in <module>
[pipenv.exceptions.InstallError]:     from pipenv import environments
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/environments.py", line 8, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.utils.fileutils import normalize_drive
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/utils/fileutils.py", line 15, in <module>
[pipenv.exceptions.InstallError]:     from pipenv.patched.pip._internal.locations import USER_CACHE_DIR
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/locations/__init__.py", line 66, in <module>
[pipenv.exceptions.InstallError]:     from . import _distutils
[pipenv.exceptions.InstallError]:   File "/home/user/.local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/locations/_distutils.py", line 20, in <module>
[pipenv.exceptions.InstallError]:     from distutils.cmd import Command as DistutilsCommand
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'distutils.cmd'
ERROR: Couldn't install package: {}
 Package installation failed...
/usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 311396 is still running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=4 encoding='utf-8'>
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=7 encoding='utf-8'>

marekdedic avatar Sep 12 '23 08:09 marekdedic

Having exactly the same issue, can someone help with this?

bsridatta avatar Dec 05 '23 16:12 bsridatta

I had 3.11 as my version where pipenv was installed, and 3.12 for my virtual environment for the project I could fix it with: pip install setuptools executed within the 3.12 shell

jjstrydom avatar Mar 07 '24 08:03 jjstrydom