Repository: pypa/pipenv

Issue:
pipenv install --deploy --system is not working when using an editable package location
### Issue description

After the latest release, the `pipenv install --deploy --system` command started to fail in the CI of a repository I am working on. 

### Expected result

I expected it to succeed without error since we haven't change the Pipfile or our CI setup anytime within the last few weeks and we've run CI multiple times since then. I verified that pinning the pipenv version to the previous version fixed the issue.

### Actual result
We get a `TypeError: expected string or bytes-like object` error. For more info please look at:
https://travis-ci.org/github/kensho-technologies/graphql-compiler/builds/692595964

### Steps to replicate
The Pipfile below is not our original CI Pipfile, but a minimal test case that still displays the issue.  I've discovered that the issue appears when we try to install from an "editable package location". (The GraphQL Compiler is the name of the repository I am working on).
```
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
# The below is necessary to make a few pylint passes work properly, since pylint expects to be able
# to run "import graphql_compiler" in the environment in which it runs.
graphql-compiler = {editable = true, path = "."}

[requires]
python_version = "3.8"
```
This is the Travis CI setup file.
```
language: python
cache: pip
dist: bionic
services:
  - docker
install:
  - pip install --upgrade pip
  - pip install --upgrade pipenv
  - pipenv install --deploy --system --verbose
matrix:
  include:
  - name: "Lint and static analysis"
    python: "3.8"
    script:
      python --version
```
`pipenv --support` output:
```
<details><summary>$ pipenv --support</summary>
Pipenv version: `'2020.5.28'`
Pipenv location: `'/home/travis/virtualenv/python3.8.1/lib/python3.8/site-packages/pipenv'`
Python location: `'/home/travis/virtualenv/python3.8.1/bin/python'`
Python installations found:
  - `3.8.1`: `/home/travis/virtualenv/python3.8.1/bin/python3`
  - `3.8.1`: `/home/travis/virtualenv/python3.8.1/bin/python3.8`
  - `3.8.1`: `/home/travis/virtualenv/python3.8.1/bin/python3`
  - `3.8.1`: `/home/travis/virtualenv/python3.8.1/bin/python3.8`
  - `3.8.1`: `/opt/pyenv/versions/3.8.1/bin/python3`
  - `3.8.1`: `/opt/pyenv/versions/3.8/bin/python3`
  - `3.7.6`: `/opt/pyenv/versions/3.7/bin/python3.7`
  - `3.7.6`: `/opt/pyenv/versions/3.7.6/bin/python3.7`
  - `3.6.10`: `/opt/pyenv/versions/3.6/bin/python3.6m`
  - `3.6.10`: `/opt/pyenv/versions/3.6.10/bin/python3.6m`
  - `3.6.9`: `/usr/bin/python3.6m`
  - `3.6.9`: `/usr/bin/python3`
  - `3.6.9`: `/usr/bin/python3.6`
  - `2.7.17`: `/usr/bin/python2`
  - `2.7.17`: `/usr/bin/python2.7`
  - `2.7.17`: `/opt/pyenv/versions/2.7.17/bin/python2`
  - `2.7.17`: `/opt/pyenv/versions/2.7/bin/python2`
PEP 508 Information:
```
{'implementation_name': 'cpython',
 'implementation_version': '3.8.1',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.0.0-1031-gcp',
 'platform_system': 'Linux',
 'platform_version': '#32-Ubuntu SMP Tue Feb 11 03:55:48 UTC 2020',
 'python_full_version': '3.8.1',
 'python_version': '3.8',
 'sys_platform': 'linux'}
```
System environment variables:
  - `PERLBREW_SHELLRC_VERSION`
  - `LC_ALL`
  - `NVM_DIR`
  - `TRAVIS_INFRA`
  - `TRAVIS_REPO_SLUG`
  - `TRAVIS_COMMIT_MESSAGE`
  - `TRAVIS_PULL_REQUEST`
  - `TRAVIS_PULL_REQUEST_SHA`
  - `TRAVIS_PRE_CHEF_BOOTSTRAP_TIME`
  - `SSH_CONNECTION`
  - `TRAVIS_JOB_WEB_URL`
  - `LANG`
  - `TZ`
  - `TRAVIS_ENABLE_INFRA_DETECTION`
  - `HISTCONTROL`
  - `TRAVIS_PULL_REQUEST_SLUG`
  - `rvm_bin_path`
  - `PYENV_ROOT`
  - `OLDPWD`
  - `TRAVIS_CMD`
  - `TRAVIS_SUDO`
  - `rvm_version`
  - `TRAVIS_EVENT_TYPE`
  - `TRAVIS_SECURE_ENV_VARS`
  - `JRUBY_OPTS`
  - `RUBY_VERSION`
  - `TRAVIS_ARCH`
  - `NVM_CD_FLAGS`
  - `GEM_HOME`
  - `TRAVIS_JOB_NAME`
  - `PYTHON_CONFIGURE_OPTS`
  - `TRAVIS_PYTHON_VERSION`
  - `JAVA_HOME`
  - `TRAVIS_INIT`
  - `TRAVIS_JOB_NUMBER`
  - `TRAVIS_STACK_NAME`
  - `CASHER_DIR`
  - `HAS_ANTARES_THREE_LITTLE_FRONZIES_BADGE`
  - `VIRTUAL_ENV`
  - `CI`
  - `COMPOSER_NO_INTERACTION`
  - `XDG_SESSION_ID`
  - `ELIXIR_VERSION`
  - `USER`
  - `TRAVIS_DIST`
  - `PAGER`
  - `TRAVIS_CPU_ARCH`
  - `TRAVIS_OSX_IMAGE`
  - `RBENV_SHELL`
  - `ANSI_CLEAR`
  - `GOPATH`
  - `TRAVIS_APP_HOST`
  - `ANSI_RED`
  - `APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE`
  - `PWD`
  - `HOME`
  - `GOROOT`
  - `TRAVIS_STACK_FEATURES`
  - `LC_CTYPE`
  - `SSH_CLIENT`
  - `MIX_ARCHIVES`
  - `TRAVIS_BUILD_WEB_URL`
  - `TRAVIS_ALLOW_FAILURE`
  - `XDG_DATA_DIRS`
  - `DEBIAN_FRONTEND`
  - `TRAVIS_BUILD_DIR`
  - `TRAVIS_APT_PROXY`
  - `TRAVIS_UID`
  - `TRAVIS_LANGUAGE`
  - `PYTHON_CFLAGS`
  - `GEM_PATH`
  - `TRAVIS_COMMIT`
  - `TRAVIS_BUILD_STAGE_NAME`
  - `CONTINUOUS_INTEGRATION`
  - `MERB_ENV`
  - `RAILS_ENV`
  - `TRAVIS_PULL_REQUEST_BRANCH`
  - `MYSQL_UNIX_PORT`
  - `TRAVIS_STACK_JOB_BOARD_REGISTER`
  - `SSH_TTY`
  - `TRAVIS_TIMER_ID`
  - `rvm_path`
  - `MAIL`
  - `PERLBREW_HOME`
  - `TRAVIS_BUILD_ID`
  - `TRAVIS_STACK_NODE_ATTRIBUTES`
  - `SHELL`
  - `TERM`
  - `TRAVIS_OS_NAME`
  - `RACK_ENV`
  - `TRAVIS_TMPDIR`
  - `NVM_BIN`
  - `TRAVIS_BUILD_NUMBER`
  - `TRAVIS_STACK_LANGUAGES`
  - `TRAVIS`
  - `rvm_prefix`
  - `PYENV_SHELL`
  - `SHLVL`
  - `LANGUAGE`
  - `TRAVIS_BRANCH`
  - `MANPATH`
  - `TRAVIS_INTERNAL_RUBY_REGEX`
  - `ANSI_RESET`
  - `PIP_PROGRESS_BAR`
  - `TRAVIS_HOME`
  - `LOGNAME`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `GIT_ASKPASS`
  - `XDG_RUNTIME_DIR`
  - `MY_RUBY_HOME`
  - `TRAVIS_ROOT`
  - `ANSI_GREEN`
  - `PATH`
  - `PS1`
  - `TRAVIS_TAG`
  - `PS4`
  - `TRAVIS_TIMER_START_TIME`
  - `TRAVIS_COMMIT_RANGE`
  - `TRAVIS_JOB_ID`
  - `HAS_JOSH_K_SEAL_OF_APPROVAL`
  - `TRAVIS_TEST_RESULT`
  - `HISTSIZE`
  - `IRBRC`
  - `HISTFILESIZE`
  - `ANSI_YELLOW`
  - `PERLBREW_ROOT`
  - `TRAVIS_STACK_TIMESTAMP`
  - `_`
  - `PYTHONDONTWRITEBYTECODE`
  - `PIP_SHIMS_BASE_MODULE`
  - `PIP_PYTHON_PATH`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`
Pipenv–specific environment variables:
Debug–specific environment variables:
  - `PATH`: `/home/travis/.rvm/gems/ruby-2.6.5/bin:/home/travis/.rvm/gems/ruby-2.6.5@global/bin:/home/travis/.rvm/rubies/ruby-2.6.5/bin:/home/travis/.rvm/bin:/home/travis/virtualenv/python3.8.1/bin:/home/travis/bin:/home/travis/.local/bin:/usr/local/lib/jvm/openjdk11/bin:/opt/pyenv/shims:/home/travis/.phpenv/shims:/home/travis/perl5/perlbrew/bin:/home/travis/.nvm/versions/node/v10.16.0/bin:/home/travis/.kiex/elixirs/elixir-1.7.4/bin:/home/travis/.kiex/bin:/home/travis/gopath/bin:/home/travis/.gimme/versions/go1.11.1.linux.amd64/bin:/usr/local/maven-3.6.3/bin:/usr/local/cmake-3.12.4/bin:/usr/local/clang-7.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/travis/.phpenv/bin:/opt/pyenv/bin:/home/travis/.yarn/bin`
  - `SHELL`: `/bin/bash`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/home/travis/build/kensho-technologies/graphql-compiler`
  - `VIRTUAL_ENV`: `/home/travis/virtualenv/python3.8.1`
---------------------------
Contents of `Pipfile` ('/home/travis/build/kensho-technologies/graphql-compiler/Pipfile'):
```toml
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[packages]
# The below is necessary to make a few pylint passes work properly, since pylint expects to be able
# to run "import graphql_compiler" in the environment in which it runs.
graphql-compiler = {editable = true, path = "."}
[requires]
python_version = "3.8"
```
Contents of `Pipfile.lock` ('/home/travis/build/kensho-technologies/graphql-compiler/Pipfile.lock'):
```json
{
    "_meta": {
        "hash": {
            "sha256": "ddec50bc88a1d4f581c04296f8b46ad653603eabcb4d12d2dec5d89aa849467e"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.8"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "arrow": {
            "hashes": [
                "sha256:a24c1de90850f6fb2033fd6bf8a11f281e84cb54825e5eabdda219e673b52aac",
                "sha256:eb5d339f00072cc297d7de252a2e75f272085d1231a3723f1026d1fa91367118"
            ],
            "version": "==0.15.6"
        },
        "cached-property": {
            "hashes": [
                "sha256:3a026f1a54135677e7da5ce819b0c690f156f37976f3e30c5430740725203d7f",
                "sha256:9217a59f14a5682da7c4b8829deadbfc194ac22e9908ccf7c8820234e80a1504"
            ],
            "version": "==1.5.1"
        },
        "funcy": {
            "hashes": [
                "sha256:75ee84c3b446f92e68a857c2267b15a1b49c631c9d5a87a5f063cd2d6761a5c4"
            ],
            "version": "==1.14"
        },
        "graphql-compiler": {
            "editable": true,
            "path": "."
        },
        "graphql-core": {
            "hashes": [
                "sha256:51f7dab06b5035515b23984f6fcb677ed909b56c672152699cca32e03624992e",
                "sha256:dfc374d3426677727772d8da9dd010e92d10305ddd9c2f7f0fc388f07cee94c4"
            ],
            "version": "==3.0.5"
        },
        "python-dateutil": {
            "hashes": [
                "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
                "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
            ],
            "version": "==2.8.1"
        },
        "pytz": {
            "hashes": [
                "sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed",
                "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"
            ],
            "version": "==2020.1"
        },
        "six": {
            "hashes": [
                "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
                "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
            ],
            "version": "==1.15.0"
        },
        "sqlalchemy": {
            "hashes": [
                "sha256:128bc917ed20d78143a45024455ff0aed7d3b96772eba13d5dbaf9cc57e5c41b",
                "sha256:156a27548ba4e1fed944ff9fcdc150633e61d350d673ae7baaf6c25c04ac1f71",
                "sha256:27e2efc8f77661c9af2681755974205e7462f1ae126f498f4fe12a8b24761d15",
                "sha256:2a12f8be25b9ea3d1d5b165202181f2b7da4b3395289000284e5bb86154ce87c",
                "sha256:31c043d5211aa0e0773821fcc318eb5cbe2ec916dfbc4c6eea0c5188971988eb",
                "sha256:65eb3b03229f684af0cf0ad3bcc771970c1260a82a791a8d07bffb63d8c95bcc",
                "sha256:6cd157ce74a911325e164441ff2d9b4e244659a25b3146310518d83202f15f7a",
                "sha256:703c002277f0fbc3c04d0ae4989a174753a7554b2963c584ce2ec0cddcf2bc53",
                "sha256:869bbb637de58ab0a912b7f20e9192132f9fbc47fc6b5111cd1e0f6cdf5cf9b0",
                "sha256:8a0e0cd21da047ea10267c37caf12add400a92f0620c8bc09e4a6531a765d6d7",
                "sha256:8d01e949a5d22e5c4800d59b50617c56125fc187fbeb8fa423e99858546de616",
                "sha256:925b4fe5e7c03ed76912b75a9a41dfd682d59c0be43bce88d3b27f7f5ba028fb",
                "sha256:9cb1819008f0225a7c066cac8bb0cf90847b2c4a6eb9ebb7431dbd00c56c06c5",
                "sha256:a87d496884f40c94c85a647c385f4fd5887941d2609f71043e2b73f2436d9c65",
                "sha256:a9030cd30caf848a13a192c5e45367e3c6f363726569a56e75dc1151ee26d859",
                "sha256:a9e75e49a0f1583eee0ce93270232b8e7bb4b1edc89cc70b07600d525aef4f43",
                "sha256:b50f45d0e82b4562f59f0e0ca511f65e412f2a97d790eea5f60e34e5f1aabc9a",
                "sha256:b7878e59ec31f12d54b3797689402ee3b5cfcb5598f2ebf26491732758751908",
                "sha256:ce1ddaadee913543ff0154021d31b134551f63428065168e756d90bdc4c686f5",
                "sha256:ce2646e4c0807f3461be0653502bb48c6e91a5171d6e450367082c79e12868bf",
                "sha256:ce6c3d18b2a8ce364013d47b9cad71db815df31d55918403f8db7d890c9d07ae",
                "sha256:e4e2664232005bd306f878b0f167a31f944a07c4de0152c444f8c61bbe3cfb38",
                "sha256:e8aa395482728de8bdcca9cc0faf3765ab483e81e01923aaa736b42f0294f570",
                "sha256:eb4fcf7105bf071c71068c6eee47499ab8d4b8f5a11fc35147c934f0faa60f23",
                "sha256:ed375a79f06cad285166e5be74745df1ed6845c5624aafadec4b7a29c25866ef",
                "sha256:f35248f7e0d63b234a109dd72fbfb4b5cb6cb6840b221d0df0ecbf54ab087654",
                "sha256:f502ef245c492b391e0e23e94cba030ab91722dcc56963c85bfd7f3441ea2bbe",
                "sha256:fe01bac7226499aedf472c62fa3b85b2c619365f3f14dd222ffe4f3aa91e5f98"
            ],
            "version": "==1.3.17"
        }
    },
    "develop": {}
}
```


Discussion:
Thanks for reporting! FYI this failure due to using a function call (`find_name()`) to determine the name of your package (which, presumably, you know as the given file belongs to only one package)

It's nearly fixed as of #4302 but I just tested and the local editable dependency doesn't actually land in the `Pipfile.lock` with the current fix.

Resolving patch:
diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py
--- a/pipenv/vendor/requirementslib/__init__.py
+++ b/pipenv/vendor/requirementslib/__init__.py
@@ -10,7 +10,7 @@
 from .models.pipfile import Pipfile
 from .models.requirements import Requirement
 
-__version__ = "1.5.10"
+__version__ = "1.5.11"
 
 
 logger = logging.getLogger(__name__)
diff --git a/pipenv/vendor/requirementslib/models/setup_info.py b/pipenv/vendor/requirementslib/models/setup_info.py
--- a/pipenv/vendor/requirementslib/models/setup_info.py
+++ b/pipenv/vendor/requirementslib/models/setup_info.py
@@ -974,6 +974,16 @@ def parse_setup_function(self):
         keys = list(setup.keys())
         if len(keys) == 1 and keys[0] is None:
             _, setup = setup.popitem()
+        keys = list(setup.keys())
+        for k in keys:
+            # XXX: Remove unresolved functions from the setup dictionary
+            if isinstance(setup[k], dict):
+                if not setup[k]:
+                    continue
+                key = next(iter(setup[k].keys()))
+                val = setup[k][key]
+                if key in function_names and val is None or val == {}:
+                    setup.pop(k)
         return setup
 
 
@@ -1204,6 +1214,16 @@ def ast_parse_setup_py(path):
     keys = list(setup.keys())
     if len(keys) == 1 and keys[0] is None:
         _, setup = setup.popitem()
+    keys = list(setup.keys())
+    for k in keys:
+        # XXX: Remove unresolved functions from the setup dictionary
+        if isinstance(setup[k], dict):
+            if not setup[k]:
+                continue
+            key = next(iter(setup[k].keys()))
+            val = setup[k][key]
+            if key in function_names and val is None or val == {}:
+                setup.pop(k)
     return setup
 
 


Test patch: