pypa / pipenv

Python Development Workflow for Humans.

Home Page:https://pipenv.pypa.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipenv fails to write its own /var/ crash report, after unhandled NoneType error in project.py

MatthewRalston opened this issue · comments

Pipenv 11.9.0
Python 3.12.2 (main, Apr  8 2024, 10:50:12) [GCC 9.4.0] on linux

Issue description

I expect the pipenv tool to parse the requirements.txt, given a target python version, and create a virutalenv

Expected result

I expect the pipenv tool to not choke on internal tasks, such as determining locations for crash reports on the filesystem (no /var/crash director exists), or even simply not choking on 'NoneType' issues in the Python3 internals. I would be happy to file this report for the primary/original exception with the Python3 team.

Actual result

>pipenv install --python 3.12
Creating a virtualenv for this project…
Using /usr/local/bin/python3 (3.12.2) to create virtualenv…
⠋RuntimeError: failed to query /usr/local/bin/python3 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\'\n'
Error while trying to remove the /home/matt/.local/share/virtualenvs/kdb-sj-FIAv9 env: 
No such file or directory

Virtualenv location: 
requirements.txt found, instead of Pipfile! Converting…
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 349, in install
    core.do_install(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1755, in do_install
    ensure_project(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 636, in ensure_project
    ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 265, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 518, in create_pipfile
    'python_version': python_version(required_python)[: len('2.7')]
TypeError: 'NoneType' object is not subscriptable
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_pipenv.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 349, in install
    core.do_install(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1755, in do_install
    ensure_project(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 636, in ensure_project
    ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 265, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 518, in create_pipfile
    'python_version': python_version(required_python)[: len('2.7')]
TypeError: 'NoneType' object is not subscriptable


Steps to replicate

Install Python3.12.2 for source, using default .configure && make && sudo make install. No parameters. Default install.

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=20.3
DISTRIB_CODENAME=una
DISTRIB_DESCRIPTION="Linux Mint 20.3 Una"

pipenv --suport
no such option: --support

@MatthewRalston you appear to be running an ancient pipenv -- 11.9.0 is from 2018 -- please try uninstalling that and installing from pypi.

Sounds good. Will try updating pipenv using pip on system level.