Repository: napalm-automation/napalm

Issue:
pip >= 10.0.0 incompatibility 
I am not going to create these for every single napalm module... but did for https://github.com/napalm-automation/napalm-ansible/issues/123 where I also saw this issue

pip 10.x no longer provides pip.req as needed in setup.py
https://github.com/pypa/pip/issues/5156



Discussion:
Hi.
I try to install napalm with python3:
```
$ pip3 install napalm
Collecting napalm
  Using cached napalm-2.3.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-hrv6t6f5/napalm/setup.py", line 6, in <module>
        from pip.req import parse_requirements
    ModuleNotFoundError: No module named 'pip.req'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hrv6t6f5/napalm/
$ pip3 -V
pip 10.0.0b2 from /usr/local/lib/python3.6/dist-packages/pip-10.0.0b2-py3.6.egg/pip (python 3.6)
```
How to fix?

Downgrade to pip9. Version 10 is still in beta and has gone through some backwards incompatible changes we have to fix.
I tried to use pip9, but on requirements: pip==10.0.0b2'.
```
pip3 install napalm
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 658, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 972, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 863, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 9.0.1 (/usr/lib/python3/dist-packages), Requirement.parse('pip==10.0.0b2'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==10.0.0b2' distribution was not found and is required by the application
```
You are going to have to figure out which package is requiring you to use the beta version of PIP10 and downgrade it (it might be `setuptools` itself).

Alternatively, you could just start over with completely new virtual environment (that has pip9 in it).
On new virtual machine installed successfully. Thanks.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,13 +1,9 @@
 """setup.py file."""
-import uuid
-
 from setuptools import setup, find_packages
 
-from pip.req import parse_requirements
-
+with open("requirements.txt", "r") as fs:
+    reqs = [r for r in fs.read().splitlines() if (len(r) > 0 and not r.startswith("#"))]
 
-install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
-reqs = [str(ir.req) for ir in install_reqs]
 
 __author__ = 'David Barroso <dbarrosop@dravetech.com>'
 


Test patch: