Repository: pypa/pipenv

Issue:
Using install -r <otherfile> still reads in requirements.txt
##### Describe your environment

1. OS Type: macOS
1. Python version: 2.7.14
1. Pipenv version: 9.0.0

##### Expected result

With no environment existing yet, running `pipenv install -r requirements.in` should only read that file and not `requirements.txt`.

##### Actual result

```
Creating a virtualenv for this project…
Using /opt/local/bin/python3.6m to create virtualenv…

Virtualenv location: /Users/remram/.local/share/virtualenvs/ta2-TKPfDi3j
Requirements.txt found, instead of Pipfile! Converting…
Warning: Your Pipfile now contains pinned versions, if your requirements.txt did.
We recommend updating your Pipfile to specify the "*" version, instead.
Requirements file provided! Importing into Pipfile…
Pipfile.lock not found, creating…
```

##### Steps to replicate

Create new environment from a folder that has a `requirements.txt` and another file.

-----

I'm running into this converting from pip-tools, which uses `requirements.txt` as the lock file, and something else as input (the `setup.py` or a `requirements.in`). I'm converting over because I need to install wheels from direct URLs, which pip-tools doesn't support (but you seem to; #480). Thanks for this handy tool!


Discussion:

Resolving patch:
diff --git a/pipenv/cli.py b/pipenv/cli.py
--- a/pipenv/cli.py
+++ b/pipenv/cli.py
@@ -297,7 +297,7 @@ def import_from_code(path='.'):
         return []
 
 
-def ensure_pipfile(validate=True):
+def ensure_pipfile(validate=True, skip_requirements=False):
     """Creates a Pipfile for the project, if it doesn't exist."""
 
     global USING_DEFAULT_PYTHON
@@ -306,7 +306,7 @@ def ensure_pipfile(validate=True):
     if project.pipfile_is_empty:
 
         # If there's a requirements file, but no Pipfile...
-        if project.requirements_exists:
+        if project.requirements_exists and not skip_requirements:
             click.echo(crayons.normal(u'requirements.txt found, instead of Pipfile! Converting…', bold=True))
 
             # Create a Pipfile...
@@ -601,7 +601,7 @@ def abort():
         ensure_virtualenv(three=three, python=python, site_packages=site_packages)
 
 
-def ensure_project(three=None, python=None, validate=True, system=False, warn=True, site_packages=False, deploy=False):
+def ensure_project(three=None, python=None, validate=True, system=False, warn=True, site_packages=False, deploy=False, skip_requirements=False):
     """Ensures both Pipfile and virtualenv exist for the project."""
 
     if not project.pipfile_exists:
@@ -639,7 +639,7 @@ def ensure_project(three=None, python=None, validate=True, system=False, warn=Tr
                         sys.exit(1)
 
     # Ensure the Pipfile exists.
-    ensure_pipfile(validate=validate)
+    ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
 
 
 def ensure_proper_casing(pfile):
@@ -1212,7 +1212,9 @@ def do_purge(bare=False, downloads=False, allow_global=False, verbose=False):
         return
 
     freeze = delegator.run('"{0}" freeze'.format(which_pip(allow_global=allow_global))).out
-    installed = freeze.split()
+    
+    # Remove comments from the output, if any.
+    installed = [line for line in freeze.splitlines() if not line.lstrip().startswith('#')]
 
     # Remove setuptools and friends from installed, if present.
     for package_name in BAD_PACKAGES:
@@ -1765,10 +1767,13 @@ def install(
     if PIPENV_USE_SYSTEM:
         system = True
 
+    # Don't search for requirements.txt files if the user provides one
+    skip_requirements = True if requirements else False
+
     concurrent = (not sequential)
 
     # Ensure that virtualenv is available.
-    ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy)
+    ensure_project(three=three, python=python, system=system, warn=True, deploy=deploy, skip_requirements=skip_requirements)
 
     # Load the --pre settings from the Pipfile.
     if not pre:
diff --git a/pipenv/patched/crayons.py b/pipenv/patched/crayons.py
--- a/pipenv/patched/crayons.py
+++ b/pipenv/patched/crayons.py
@@ -18,7 +18,7 @@
 
 __all__ = (
     'red', 'green', 'yellow', 'blue',
-    'black', 'magenta', 'cyan', 'white', 'normal'
+    'black', 'magenta', 'cyan', 'white', 'normal',
     'clean', 'disable',
 )
 


Test patch: