在 Mac 上将 django 2.2.27 升级到 2.2.28 时出现问题

Problem upgrading django 2.2.27 to 2.2.28 on Mac

我有一个 Django 应用程序,我正在尝试将 Django 模块从 2.2.27 升级到 2.2.28 以关闭 SQL 注入攻击向量。我在最近的英特尔 Mac 上 运行 使用当前 OS、Python 3.7.7 进行此操作,安装和包管理由 pipenv 处理。 如果我克隆项目的存储库并且 运行 pipenv install 一切正常,我可以 运行 应用程序。如果我编辑 Pipfile 并将 django 行更改为: django = "==2.2.28" 和 运行 pipenv update 我会得到一个很长的错误显示:

Running $ pipenv lock then $ pipenv sync.
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-b7oz222d
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-a2zlgyg9
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-wnccio_d
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-qdyz7et_
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-f_ntiq_4
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-njy4pcni
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-9hanls1n
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-nh2nhv5s
INFO:pipenv.patched.notpip._internal.vcs.git:Cloning https://github.com/startwithlucy/zoomus.git (to revision v0.2.7) to /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pipenv-lodkowat-src/zoomus2
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-3tdmn4n6
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-or92fdaw
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-4afu8z2s
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-1gzv7c4l
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-_nb_ij8m
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-3mnuqo1i
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-8j29fail
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-equgr8uv
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-pyqzy2cq
INFO:pep517.envbuild:Temporary build environment: /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pep517-build-env-lw3xry9m
INFO:pipenv.patched.notpip._internal.operations.prepare:Obtaining django-drip-campaigns from git+https://github.com/startwithlucy/django-drip-campaigns.git@v0.9.0#egg=django-drip-campaigns (from -r /var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pipenvi4m0205lrequirements/pipenv-685yn2ll-constraints.txt (line 48))
INFO:pipenv.patched.notpip._internal.vcs.versioncontrol:Updating /Users/dougfarrell/.local/share/virtualenvs/cleo-backend-SIzTEXML-python/src/django-drip-campaigns clone (to revision v0.9.0)
INFO:pipenv.patched.notpip._internal.operations.prepare:Collecting rich-text-renderer==0.2.5
INFO:pipenv.patched.notpip._internal.network.download:Using cached rich_text_renderer-0.2.5.tar.gz (4.7 kB)
ERROR:pip.subprocessor:Command errored out with exit status 1:
 command: /Users/dougfarrell/.local/share/virtualenvs/cleo-backend-SIzTEXML-python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pip-resolver-cbn_1v0o/rich-text-renderer/setup.py'"'"'; __file__='"'"'/private/var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pip-resolver-cbn_1v0o/rich-text-renderer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pip-resolver-cbn_1v0o/rich-text-renderer/pip-egg-info
     cwd: /private/var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pip-resolver-cbn_1v0o/rich-text-renderer/
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/fh/jwrr3ps55v97vr65pvvc25ch0000gp/T/pip-resolver-cbn_1v0o/rich-text-renderer/setup.py", line 22, in <module>
    with open('README.rst', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'README.rst'
----------------------------------------
Traceback (most recent call last):
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/resolver.py", line 764, in <module>
    main()
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/resolver.py", line 760, in main
    dev=parsed.dev)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/resolver.py", line 741, in _main
    resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/resolver.py", line 709, in resolve_packages
    requirements_dir=requirements_dir,
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/resolver.py", line 692, in resolve
    req_dir=requirements_dir
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/utils.py", line 1403, in resolve_deps
    req_dir=req_dir,
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps
    resolver.resolve()
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/utils.py", line 823, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 180, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 268, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 383, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 229, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 351, in get_legacy_dependencies
    download_dir, ireq, wheel_cache
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 306, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 339, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 287, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 509, in prepare_linked_requirement
    req, self.req_tracker, self.finder, self.build_isolation,
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/distributions/sdist.py", line 40, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 564, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 544, in _generate_metadata
    details=self.name or "from {}".format(self.link)
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/build/metadata_legacy.py", line 118, in generate_metadata
    command_desc='python setup.py egg_info',
  File "/Users/dougfarrell/.pyenv/versions/3.7.7/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pipenv.patched.notpip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我的 Pipfile 中有这一行: rich-text-renderer = "*" 通过尝试,如果我从 Pipfile 和 运行 [=15= 中删除这一行] 同样,安装工作正常,但如果我重新添加它,pipenv update 失败。

如果有人对如何解决这个问题有任何建议或参考,我将不胜感激。

谢谢!

你的pipenv没问题,错误是rich-text-renderer的最新版本0.2.5导致的。我认为软件包作者在分发 rich-text-renderer==0.2.5 时犯了一个错误,发布 tar 文件丢失了 setup.py 将读取的文件 README.rst

# https://github.com/contentful/rich-text-renderer.py/blob/0.2.5/setup.py
readme = ''
with open('README.rst', 'r') as f:
    readme = f.read()

您可以通过从 https://pypi.org/project/rich_text_renderer/#files 下载 tar 文件来确认。 同样报错https://github.com/contentful/rich-text-renderer.py/issues/18

如果不需要最新版本rich-text-renderer==0.2.5,可以将rich-text-renderer = "*"替换为rich-text-renderer="==0.2.4",pipenv一直更新设置 * 时安装最新版本。