Home > Software engineering >  Problem upgrading django 2.2.27 to 2.2.28 on Mac
Problem upgrading django 2.2.27 to 2.2.28 on Mac

Time:05-15

I have a Django application that I'm trying to upgrade the django module from 2.2.27 to 2.2.28 to close a SQL injection attack vector. I'm running this on a recent intel Mac with a current OS, Python 3.7.7, and the installation and package management are handled by pipenv. If I clone the repository for the project and run pipenv install things work fine and I can run the application. If I edit the Pipfile and change django line to this: django = "==2.2.28" and run pipenv update I get a long error display:

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/[email protected]#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.

I have this line in my Pipfile: rich-text-renderer = "*" Through just trying things out, if I remove this line from the Pipfile and run pipenv update again, the installation works, but if I add it back in, the pipenv update fails.

If anyone has any suggestions or references about how to address this problem, I'd very much appreciate it.

Thanks!

CodePudding user response:

You pipenv is ok, the error is caused by the latest version 0.2.5 of rich-text-renderer. I think the package author had a mistake when distributing rich-text-renderer==0.2.5, the release tar file lost the file README.rst which the setup.py will read.

# 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()

You can confirm it by download the tar file from https://pypi.org/project/rich_text_renderer/#files. The same error is reported https://github.com/contentful/rich-text-renderer.py/issues/18

If you do not need the latest version rich-text-renderer==0.2.5, you can replace rich-text-renderer = "*" to rich-text-renderer = "==0.2.4", pipenv update always install the latest version when * is set.

  • Related