pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.8k stars 1.86k forks source link

AssertionError when running pipenv from systemd service unit #4393

Closed charliesneath closed 4 years ago

charliesneath commented 4 years ago

Issue description

Seeing an AssertionError when running a command using sudo pipenv run within a systemd service unit on a Raspberry Pi Zero W. I have the same setup with a few other RPi devices and don't see the error, so I think it is possibly caused by trying to install Pip separately for some unrelated scripts I was testing.

This isn't blocking as I can flash the SD card, but if possible, I would like to understand the cause of the issue to avoid in the future.

Let me know what other debugging information would be helpful in debugging this. Thank you1

Expected result

No error output.

Actual result

Running my command within the service unit:

sudo pipenv run python3.7 /opt/project/main.py

I see the following error output in journalctl but the script still executes as expected:

Using /usr/bin/python3 (3.7.3) to create virtualenv…
usage: __main__.py [-h] [-p PYTHON] [-i PACKAGES] [-r REQUIREMENTS] [-d]
                   [-a PROJECT]
                   envname
__main__.py: error: the following arguments are required: envname
Virtualenv location:
Creating a Pipfile for this project…
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 602, in run
    core.do_run(command=command, args=args, three=three, python=python)
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 2196, in do_run
    ensure_project(three=three, python=python, validate=False)
  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 289, in ensure_pipfile
    project.create_pipfile(python=python)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 475, in create_pipfile
    config_parser = ConfigOptionParser(name=self.name)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/baseparser.py", line 149, in __init__
    assert self.name
AssertionError

Steps to replicate

Pipfile:

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

[dev-packages]

[packages]
requests = "*"
getch = "*"
Flask = "*"
astral = "*"
isodate = "*"
colorama = "*"
google-auth = "*"

[requires]
python_version = "3.7"

[packages.rpi-ws281x]
version = "*"
sys_platform = "== 'linux'"

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

I get Error: no such option: --support when running this command.

frostming commented 4 years ago

This was an old bug introduced in 2018.11.26 and was already fixed in the latest release, closing it now.

charliesneath commented 4 years ago

Thanks for taking a look. I've already tried updating through sudo apt install --upgrade pipenv and I'm on the latest version of Pipenv. Anything else I should be trying?

But when I'm trying to update pipenv through pip, I see the following. Is this caused by competing installs/uninstalls of pip?

$ sudo apt install --upgrade pipenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
pipenv is already the newest version (11.9.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo pip install --upgrade pipenv
sudo: pip: command not found
$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (18.1-5+rpt1).
python3-pip set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.