Repository: streamlink/streamlink

Issue:
Streamlink 0.8.1 does not work with standalone python.
I had been using Streamlink 0.7.0 for so long and thought it was time to update but if I do, Streamlink no longer works.

When trying to launch streamlink gives out these errors.

```
Traceback (most recent call last):
  File "C:\Users\Jesus\AppData\Local\Programs\Python\Python36\Scripts\streamlink-script.py", line 6, in <module>
    from pkg_resources import load_entry_point
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3017, in <module>
    @_call_aside
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3030, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 659, in _build_master
    ws.require(__requires__)
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 967, in require
    needed = self.resolve(parse_requirements(requirements))
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 853, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'PySocks!=1.5.7,>=1.5.6; extra == "socks"' distribution was not found and is required by requests
```


### Checklist

- [x] This is a bug report.
- [ ] This is a feature request.
- [ ] This is a plugin (improvement) request.
- [x] I have read the contribution guidelines.

### Description

Streamlink does not work after 0.8.1 update.

### Reproduction steps

1. Install python 3.6.3 x64
2. Install Streamlink via pip
3. Streamlink fails to launch

### Environment details

Operating system and version: Windows 10 x64 v1709 build 16299.19
Streamlink and Python version: Streamlink v0.8.1 together with python x64 v3.6.3 or v3.6.2 (Have not tried any other versions)

### Log

```
PS C:\WINDOWS\system32> streamlink --version
streamlink 0.7.0
PS C:\WINDOWS\system32> streamlink
usage: streamlink [OPTIONS] <URL> [STREAM]

Use -h/--help to see the available options or read the manual at https://streamlink.github.io
PS C:\WINDOWS\system32> pip install --upgrade streamlink
Collecting streamlink
  Using cached streamlink-0.8.1.tar.gz
Requirement already up-to-date: requests!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0,>=2.2 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from streamlink)
Requirement already up-to-date: pycryptodome<4,>=3.4.3 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from streamlink)
Requirement already up-to-date: iso-639 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from streamlink)
Requirement already up-to-date: iso3166 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from streamlink)
Requirement already up-to-date: websocket-client in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from streamlink)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from requests!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0,>=2.2->streamlink)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from requests!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0,>=2.2->streamlink)
Requirement already up-to-date: idna<2.7,>=2.5 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from requests!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0,>=2.2->streamlink)
Requirement already up-to-date: certifi>=2017.4.17 in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from requests!=2.12.0,!=2.12.1,!=2.16.0,!=2.16.1,!=2.16.2,!=2.16.3,!=2.16.4,!=2.16.5,!=2.17.1,<3.0,>=2.2->streamlink)
Requirement already up-to-date: six in c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages (from websocket-client->streamlink)
Installing collected packages: streamlink
  Found existing installation: streamlink 0.7.0
    Uninstalling streamlink-0.7.0:
      Successfully uninstalled streamlink-0.7.0
  Running setup.py install for streamlink ... done
Successfully installed streamlink-0.8.1
PS C:\WINDOWS\system32> streamlink
Traceback (most recent call last):
  File "C:\Users\Jesus\AppData\Local\Programs\Python\Python36\Scripts\streamlink-script.py", line 6, in <module>
    from pkg_resources import load_entry_point
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3017, in <module>
    @_call_aside
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 3030, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 659, in _build_master
    ws.require(__requires__)
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 967, in require
    needed = self.resolve(parse_requirements(requirements))
  File "c:\users\jesus\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py", line 853, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'PySocks!=1.5.7,>=1.5.6; extra == "socks"' distribution was not found and is required by requests
```

[Love Streamlink? Please consider supporting our collective. Thanks!](https://opencollective.com/streamlink/donate)



Discussion:
This is a known issue, the easiest solution is to `pip install "PySocks!=1.5.7,>=1.5.6"`. 



Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,10 @@
 #!/usr/bin/env python
 
+import os
 from os import environ
 from os.path import abspath, dirname, join
 from setuptools import setup, find_packages
 from sys import version_info, path as sys_path
-import warnings
 
 deps = []
 
@@ -47,7 +47,12 @@
 deps.append("websocket-client")
 
 # Support for SOCKS proxies
-deps.append("requests[socks]")
+deps.append("PySocks!=1.5.7,>=1.5.6")  # requests[socks] uses this version
+
+# win-inet-pton is missing a dependency in PySocks, this has been fixed but not released yet
+if os.name == "nt" and version_info < (3, 0):
+    # Required due to missing socket.inet_ntop & socket.inet_pton method in Windows Python 2.x
+    deps.append("win-inet-pton")
 
 # When we build an egg for the Win32 bootstrap we don't want dependency
 # information built into it.


Test patch: