Repository: mindsdb/lightwood

Issue:
Windows install via pypi repo fails
`pip install lightwood` will fail on windows due to us sourcing the torch dependency from outside of pypi.

Not much we can do about it at the moment, since the pypi version of torch for windows seems to fail installing most of the time (or install a version that's way too old).

we should look into fixing when new releases of torch arrive on pypi and/or new updates for the various libraries involved with torch appear on windows.

Temporary "fix" is just asking people to install from github.


Discussion:
For now I see no way around this, even with the new pytroch version, added a wontfix label and I'll get back to it whenever pytroch releases a new version again.

Resolving patch:
diff --git a/lightwood/__about__.py b/lightwood/__about__.py
--- a/lightwood/__about__.py
+++ b/lightwood/__about__.py
@@ -1,6 +1,6 @@
 __title__ = 'lightwood'
 __package_name__ = 'mindsdb'
-__version__ = '0.12.2'
+__version__ = '0.13.0'
 __description__ = "Lightwood's goal is to make it very simple for developers to use the power of artificial neural networks in their projects."
 __email__ = "jorge@mindsdb.com"
 __author__ = 'MindsDB Inc'
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -4,15 +4,7 @@
 import subprocess
 
 
-# @TODO: Figure out a way to check for this
-is_installed_from_pypi = False
-
-about = {}
-with open("lightwood/__about__.py") as fp:
-    exec(fp.read(), about)
-
-
-def remove_requirements(requirements, name, replace=None):
+def remove_requirements(requirements, name, replace=''):
     new_requirements = []
     for requirement in requirements:
         if requirement.split(' ')[0] != name:
@@ -23,55 +15,27 @@ def remove_requirements(requirements, name, replace=None):
 
 sys_platform = sys.platform
 
+about = {}
+with open("lightwood/__about__.py") as fp:
+    exec(fp.read(), about)
+    
 with open("README.md", "r") as fh:
     long_description = fh.read()
 
 with open('requirements.txt') as req_file:
     requirements = [req.strip() for req in req_file.read().splitlines()]
 
-# Linux specific requirements
-if sys_platform == 'linux' or sys_platform.startswith('linux'):
-    pass
-    #requirements = remove_requirements(requirements,'torch',replace='torch >= 1.1.0')
-
-
-# OSX specific requirements
-elif sys_platform == 'darwin':
-    pass
-    #requirements = remove_requirements(requirements,'torch',replace='torch >= 1.1.0.post2')
-
 # Windows specific requirements
-elif sys_platform in ['win32','cygwin','windows']:
-    if is_installed_from_pypi:
-        requirements = remove_requirements(requirements,'torch')
-        requirements = remove_requirements(requirements,'torchvision')
-
-    else:
-        if sys.version_info < (3,7):
-            requirements = remove_requirements(requirements,'torch',replace='torch @ https://download.pytorch.org/whl/cu100/torch-1.2.0-cp36-cp36m-win_amd64.whl')
-            requirements = remove_requirements(requirements,'torchvision',replace='torchvision @ https://download.pytorch.org/whl/cu100/torchvision-0.4.0-cp36-cp36m-win_amd64.whl')
-        else:
-            requirements = remove_requirements(requirements,'torch',replace='torch @ https://download.pytorch.org/whl/cu100/torch-1.2.0-cp37-cp37m-win_amd64.whl')
-            requirements = remove_requirements(requirements,'torchvision',replace='torchvision @ https://download.pytorch.org/whl/cu100/torchvision-0.4.0-cp37-cp37m-win_amd64.whl')
-
-    requirements.append('cwrap')
-
-# For stuff like freebsd
-else:
-    print('\n\n====================\n\nError, platform {sys_platform} not recognized, proceeding to install anyway, but lightwood might not work properly !\n\n====================\n\n')
-
-if is_installed_from_pypi and (sys_platform in ['win32','cygwin','windows']):
+if sys_platform in ['win32','cygwin','windows']:
+    requirements = remove_requirements(requirements,'torch')
+    requirements = remove_requirements(requirements,'torchvision')
     try:
-        subprocess.call(['pip','install','https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl'])
-        print('Successfully installed pytorch !')
+        print('Installing pytorch and torchvision!')
+        subprocess.call(['pip','install','torch>=1.2.0', 'torchvision>=0.4.2', '-f', 'https://download.pytorch.org/whl/torch_stable.html'])
+        print('Successfully installed pytorch and torchvision!')
     except:
         print('Failed to install pytroch, please install pytroch and torchvision manually be following the simple instructions over at: https://pytorch.org/get-started/locally/')
 
-    try:
-        subprocess.call(['pip','install','https://download.pytorch.org/whl/cu100/torchvision-0.3.0-cp37-cp37m-win_amd64.whl'])
-        print('Successfully installed Torchvision !')
-    except:
-        print('Failed to install torchvision, please install pytroch and torchvision manually be following the simple instructions over at: https://pytorch.org/get-started/locally/')
 
 setuptools.setup(
     name=about['__title__'],


Test patch: