Search code examples
python-3.xpsycopg2pipenv

Pipenv failing to lock with psycopg2-binary


I am attempting to create a virtual environment for django development. I was successfully able to install psycopg2-binary in another project, but have not been able to reproduce a successful installation.

Environment:

  1. Python 3.8.1
  2. Pipenv version 2018.11.26

Steps to install:

mkdir test && cd test
pipenv install django psycopg2-binary==2.8.4

On run:

Installing psycopg2-binary==2.8.4…
Adding psycopg2-binary to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock (24bc11) out of date, updating to (a6086c)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Traceback (most recent call last):
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 118, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system,
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 78, in _main
    results = resolve(
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 61, in resolve
    return resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 718, in resolve_deps
    resolved_tree, hashes, markers_lookup, resolver = actually_resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 211, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 470, in run_egg_info
    call_subprocess(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 703, in call_subprocess
    raise InstallationError(
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\OPTIPL~1\AppData\Local\Temp\tmp3guv6vnobuild\psycopg2-binary\
File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 118, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system,
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 78, in _main
    results = resolve(
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 61, in resolve
    return resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 718, in resolve_deps
    resolved_tree, hashes, markers_lookup, resolver = actually_resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 211, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 470, in run_egg_info
    call_subprocess(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 703, in call_subprocess
    raise InstallationError(
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\OPTIPL~1\AppData\Local\Temp\tmp3guv6vnobuild\psycopg2-binary\

Attempted solutions:

Deleting the cache in %LOCALDATA%\AppData\Local\pipenv\pipenv

pipenv lock --clear
pipenv lock -v

Output of pipenv lock -v:

Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  django
  psycopg2-binary==2.8.4

Finding the best candidates:
  found candidate django==3.0.3 (constraint was <any>)
  found candidate psycopg2-binary==2.8.4 (constraint was ==2.8.4)

Finding secondary dependencies:
  django==3.0.3 not in cache, need to check index
  django==3.0.3             requires asgiref~=3.2, pytz, sqlparse>=0.2.2
  psycopg2-binary==2.8.4 not in cache, need to check index
Traceback (most recent call last):
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 118, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system,
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 78, in _main
    results = resolve(
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 61, in resolve
    return resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 718, in resolve_deps
    resolved_tree, hashes, markers_lookup, resolver = actually_resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 211, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 470, in run_egg_info
    call_subprocess(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 703, in call_subprocess
    raise InstallationError(
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\OPTIPL~1\AppData\Local\Temp\tmpzbo1k1mpbuild\psycopg2-binary\
Using pip: -i https://pypi.org/simple
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  django
  psycopg2-binary==2.8.4

Finding the best candidates:
  found candidate django==3.0.3 (constraint was <any>)
  found candidate psycopg2-binary==2.8.4 (constraint was ==2.8.4)

Finding secondary dependencies:
  django==3.0.3 not in cache, need to check index
  django==3.0.3             requires asgiref~=3.2, pytz, sqlparse>=0.2.2
  psycopg2-binary==2.8.4 not in cache, need to check index
Traceback (most recent call last):
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 118, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system,
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 78, in _main
    results = resolve(
  File "c:/users/optiplex 3020/appdata/local/programs/python/python38-32/lib/site-packages/pipenv/resolver.py", line 61, in resolve
    return resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 718, in resolve_deps
    resolved_tree, hashes, markers_lookup, resolver = actually_resolve_deps(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 211, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 470, in run_egg_info
    call_subprocess(
  File "c:\users\optiplex 3020\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 703, in call_subprocess
    raise InstallationError(
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\OPTIPL~1\AppData\Local\Temp\tmpzbo1k1mpbuild\psycopg2-binary\

Has anyone else had a similar problem? I'm leaning toward it being an issue with how I'm attempting to resolve the pipenv locking, as I didn't have this problem yesterday.


Solution

  • I resolved this using this thread: https://github.com/pypa/pipenv/issues/3468

    The general consensus was that pipenv was not supporting 3.8.1, I have since downgraded to 3.7.6 and will use that until support is given.