Repository: pypa/pipenv

Issue:
NameError: name 'unicode' is not defined
### Issue description
```

[hadoop@ip-192-168-0-84 sales-forecast]$ pipenv install --python 3
Virtualenv already exists!
Removing existing virtualenv...
Creating a virtualenv for this project...
Pipfile: /home/hadoop/sales-forecast/Pipfile
Using /usr/bin/python3.4 (3.4.8) to create virtualenv...
⠼ Creating virtual environment...Using base prefix '/usr'
New python executable in /home/hadoop/.local/share/virtualenvs/sales-forecast-ZYWIRznP/bin/python3.4
Also creating executable in /home/hadoop/.local/share/virtualenvs/sales-forecast-ZYWIRznP/bin/python
Installing setuptools, pip, wheel...done.
Running virtualenv with interpreter /usr/bin/python3.4

✔ Successfully created virtual environment!
Virtualenv location: /home/hadoop/.local/share/virtualenvs/sales-forecast-ZYWIRznP
requirements.txt found, instead of Pipfile! Converting...
✔ Success!
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
✘ Locking Failed!
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/usr/local/lib/python2.7/site-packages/pipenv/utils.py", line 700, in resolve_deps
    from .vendor.requirementslib.models.requirements import Requirement
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/__init__.py", line 14, in <module>
    from .models.pipfile import Pipfile
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/models/pipfile.py", line 23, in <module>
    from ..environment import MYPY_RUNNING
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/environment.py", line 17, in <module>
    MYPY_RUNNING = os.environ.get("MYPY_RUNNING", is_type_checking())
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/environment.py", line 10, in is_type_checking
    from typing import TYPE_CHECKING
  File "/usr/local/lib/python2.7/site-packages/typing.py", line 624, in <module>
    AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined
File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/usr/local/lib/python2.7/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/usr/local/lib/python2.7/site-packages/pipenv/utils.py", line 700, in resolve_deps
    from .vendor.requirementslib.models.requirements import Requirement
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/__init__.py", line 14, in <module>
    from .models.pipfile import Pipfile
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/models/pipfile.py", line 23, in <module>
    from ..environment import MYPY_RUNNING
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/environment.py", line 17, in <module>
    MYPY_RUNNING = os.environ.get("MYPY_RUNNING", is_type_checking())
  File "/usr/local/lib/python2.7/site-packages/pipenv/vendor/requirementslib/environment.py", line 10, in is_type_checking
    from typing import TYPE_CHECKING
  File "/usr/local/lib/python2.7/site-packages/typing.py", line 624, in <module>
    AnyStr = TypeVar('AnyStr', bytes, unicode)
NameError: name 'unicode' is not defined

```

-------------------------------------------------------------------------------
<details><summary>$ pipenv --support</summary>

Pipenv version: `'2018.11.26'`

Pipenv location: `'/usr/local/lib/python2.7/site-packages/pipenv'`

Python location: `'/usr/bin/python2.7'`

Python installations found:

  - `3.4.8`: `/usr/bin/python3`
  - `2.7.14`: `/usr/bin/python2.7`
  - `3.4.8`: `/usr/bin/python3.4m`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.14.72-68.55.amzn1.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Fri Sep 28 21:14:54 UTC 2018',
 'python_full_version': '2.7.14',
 'python_version': '2.7',
 'sys_platform': 'linux2'}
```

System environment variables:

  - `AWS_PATH`
  - `PYTHONDONTWRITEBYTECODE`
  - `LESSOPEN`
  - `SSH_CLIENT`
  - `LOGNAME`
  - `USER`
  - `HOME`
  - `PATH`
  - `PS1`
  - `LANG`
  - `LESS_TERMCAP_se`
  - `TERM`
  - `SHELL`
  - `EC2_AMITOOL_HOME`
  - `LESS_TERMCAP_me`
  - `LESS_TERMCAP_md`
  - `LESS_TERMCAP_mb`
  - `HISTSIZE`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`
  - `AWS_ELB_HOME`
  - `JAVA_HOME`
  - `EC2_HOME`
  - `LESS_TERMCAP_ue`
  - `AWS_AUTO_SCALING_HOME`
  - `PIP_PYTHON_PATH`
  - `_`
  - `AWS_DEFAULT_REGION`
  - `SSH_CONNECTION`
  - `AWS_CLOUDWATCH_HOME`
  - `SSH_TTY`
  - `OLDPWD`
  - `HOSTNAME`
  - `HISTCONTROL`
  - `SHLVL`
  - `PWD`
  - `LESS_TERMCAP_us`
  - `PIP_SHIMS_BASE_MODULE`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `MAIL`
  - `LS_COLORS`

Pipenv–specific environment variables:


Debug–specific environment variables:

  - `PATH`: `/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin`
  - `SHELL`: `/bin/bash`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/home/hadoop/sales-forecast`


---------------------------

Contents of `Pipfile` ('/home/hadoop/sales-forecast/Pipfile'):

```toml
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
numpy = "*"
scipy = "*"
scikit-learn = "==0.19.1"
statsmodels = "*"
xgboost = "*"
pystan = "*"
fbprophet = "*"
matplotlib = "==2.2.3"
seaborn = "*"
redis = "*"
sqlalchemy = "*"
mysqlclient = "*"
pyarrow = "==0.11.1"
hdfs = "*"
hdfs3 = "*"
s3fs = "*"
python-dateutil = "*"
chinesecalendar = "*"
pandas = "*"
h5py = "*"
lxml = "*"
openpyxl = "*"
xlrd = "*"
click = "*"
pathlib2 = "*"
python-dotenv = "*"
environs = "*"
joblib = "*"
tqdm = "*"
dask = {extras = ["complete"],version = "*"}

[requires]
python_version = "3.4"

```

</details>



Discussion:
You are using python2, but it raises ```unicode``` not defined error. I have no clue...
Wondering if it's actually running Python 3 but the paths are screwed up so it's importing from the 2.7 directories?
Hmmm, this only happens with the combination of "Pipenv installed under 2.7" and "virtualenv python<3.5" because python<3.5 doesn't have `typing` module. It is a good catch.
Python2 has typing module. I suspect this is because the python installation is messed up and probably it is not a bug with pipenv.
@jxltom Let me elaborate it:

User installed pipenv under python2.7, with the dependencies of `typing`(which only works under python2.7), then work in a virtualenv of Python 3.4, which doesn't have `typing` module. However, `pipenv lock` will use the virtualenv interpreter(python3.4) to call `resolver.py`, and import the wrong `typing` module(this is expected because the Pipenv interpreter site-packages is also in `PYTHONPATH`).

With Python >= 3.5, this isn't a problem because the stdlib `typing` module takes priority to Python 2 `typing` module.
@frostming Sounds reasonable 👍 

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -27,8 +27,7 @@
     "setuptools>=36.2.1",
     "virtualenv-clone>=0.2.5",
     "virtualenv",
-    'enum34; python_version<"3"',
-    'typing; python_version<"3.5"'
+    'enum34; python_version<"3"'
 ]
 
 


Test patch: