Skip to content

Commit

Permalink
Making torch installation on windows optional (#96)
Browse files Browse the repository at this point in the history
Adding warning in setup.py for windows platform to instruct user to install torch manually
  • Loading branch information
lalitpagaria committed May 4, 2021
1 parent e109a3b commit 63b6cef
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Expand Up @@ -17,11 +17,6 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [3.7, 3.8, 3.9]
# experimental: [ false ]
# include:
# - python-version: 3.10
# experimental: true
# continue-on-error: ${{ matrix.experimental }}

steps:
- uses: actions/checkout@v2
Expand All @@ -35,7 +30,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
pip install --editable . -v
- name: Install Pytorch on windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Lint with flake8
run: |
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Expand Up @@ -234,8 +234,7 @@ tldextract==3.1.0
# via presidio-analyzer
tokenizers==0.10.2
# via transformers
torch==1.8.1; sys_platform != 'win32' and sys_platform != 'cygwin'
torch==1.8.1+cpu; sys_platform == 'win32' or sys_platform == 'cygwin'
torch==1.8.1; sys_platform != '*win*'
# via -r requirements.in
tqdm==4.60.0
# via
Expand Down
13 changes: 13 additions & 0 deletions setup.py
@@ -1,8 +1,21 @@
import logging
import pathlib
from io import open
from sys import platform

from setuptools import find_packages, setup

logger = logging.getLogger(__name__)

if "win" in platform:
warning_message = """
------------------------------------------------------------------------------------------------
NOTE: For windows platform install torch manually. Refer https://pytorch.org/get-started/locally/
------------------------------------------------------------------------------------------------
"""
logger.warning(warning_message)
print(warning_message)


def parse_requirements(filename):
with open(filename) as file:
Expand Down

0 comments on commit 63b6cef

Please sign in to comment.