pipenv: Recent versions fail setup with "AttributeError: 'String' object has no attribute 'update'"
Issue description
Using github CI, with the latest version v2023.9.7 (and recent versions?), our ci is failing during environment setup/installation with “AttributeError: ‘String’ object has no attribute ‘update’”.
Our requirements setup:
pip install pip --upgrade
pip install "pipenv>2021.11.15"
pipenv lock
pipenv sync --dev
Updating the pipenv installation to ‘pip install “pipenv>2021.11.15,<2023.8.19”’ resolves the issue and allows installation to proceed.
Expected result
Installation succeeds.
Actual result
Run source .venv/bin/activate && make requirements && python setup.py install
source .venv/bin/activate && make requirements && python setup.py install
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.17/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
Python[2](https://github.com/zappa/Zappa/actions/runs/6116185784/job/16601008295#step:8:2)_ROOT_DIR: /opt/hostedtoolcache/Python/[3](https://github.com/zappa/Zappa/actions/runs/6116185784/job/16601008295#step:8:3).7.17/x6[4](https://github.com/zappa/Zappa/actions/runs/6116185784/job/16601008295#step:8:4)
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.7.17/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.17/x64/lib
pip install pip --upgrade
Requirement already satisfied: pip in ./.venv/lib/python3.7/site-packages (23.0.1)
Collecting pip
Using cached pip-23.2.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.0.1
Uninstalling pip-23.0.1:
Successfully uninstalled pip-23.0.1
Successfully installed pip-23.2.1
pip install pipenv>2021.11.1[5](https://github.com/zappa/Zappa/actions/runs/6116185784/job/16601008295#step:8:5)
pipenv lock
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
Success!
Traceback (most recent call last):
File "/home/runner/work/Zappa/Zappa/.venv/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/cli/options.py", line 58, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/cli/command.py", line 346, in lock
categories=state.installstate.categories,
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/routines/lock.py", line 76, in do_lock
old_lock_data=old_lock_data,
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/utils/resolver.py", line 865, in venv_resolve_deps
project, results, pipfile, lockfile[lockfile_section], old_lock_data
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/utils/locking.py", line 140, in prepare_lockfile
lockfile_entry = get_locked_dep(project, dep, pipfile, current_entry)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/utils/locking.py", line 123, in get_locked_dep
lockfile_entry = clean_resolved_dep(project, dep, is_top_level, current_entry)
File "/home/runner/work/Zappa/Zappa/.venv/lib/python3.7/site-packages/pipenv/utils/dependencies.py", line 300, in clean_resolved_dep
current_entry.update(lockfile)
AttributeError: 'String' object has no attribute 'update'
Steps to replicate
Running in github CI:
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- name: Checkout Code Repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip${{ matrix.python }}-${{ hashFiles('Pipfile') }}
restore-keys: ${{ runner.os }}-pip${{ matrix.python }}-
- name: make sure we have version tags
run: git fetch --unshallow --tags
- name: Setup Virtualenv
run: python -m venv .venv
- name: Install
run: source .venv/bin/activate && make requirements && python setup.py install
Fails during “make requirements”.
requirements section of Makefile:
requirements:
pip install pipenv>2021.11.15
pipenv lock
pipenv sync --dev
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 20 (11 by maintainers)
Commits related to this issue
- :fire: remove `pipenv` from Pipfile (as recommended by pipenv dev team (https://github.com/pypa/pipenv/issues/5927) — committed to zappa/Zappa by storkwrangler 10 months ago
- Prepare CHANGELOG/VERSION for 0.58.0 release (#1271) * ✏️ update version 0.57.0 -> 0.58.0 ✏️ update CHANGELOG.md with issues addressed in 0.58.0 * :wrench: attempt to fix "AttributeError: 'String... — committed to zappa/Zappa by monkut 10 months ago
- stop using Pipenv it's broken and has no tests or type annotations see https://github.com/pypa/pipenv/issues/5927 — committed to gnmerritt/ha-solar-history by gnmerritt 8 months ago
I am receiving the same error too but there was no pipenv in my Pipfile. What should I do?
Same as above! I am on
pipenv/2023.10.24
and getting the below log:No problem, since your build went green without the version restriction after the change, I believe this is resolved.
@monkut I haven’t tried your full example yet, but one thing I notice is you shouldn’t be pinning/installing pipenv with pipenv – I noticed pipenv in the Pipfile, but it should likely be removed and could possibly be causing this issue.