Skip to content

Commit 15630c9

Browse files
0.9.19
1 parent 97e6660 commit 15630c9

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

torchstudio/pythoninstall.cmd

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ cd "$SCRIPTDIR"
88
cd ..
99

1010
pythonpath="$(pwd)/python"
11-
channel="pytorch"
1211
cuda=""
1312
packages=""
1413
uninstall=""
1514
while [ "$1" != "" ]; do
1615
if [ $1 == "--path" ]; then
1716
shift; pythonpath=$1
18-
elif [ $1 == "--channel" ]; then
19-
shift; channel=$1
2017
elif [ $1 == "--cuda" ]; then
2118
cuda="--cuda"
2219
elif [ $1 == "--package" ]; then
@@ -100,7 +97,15 @@ fi
10097
rm -f "$file"
10198

10299
PATH="$PATH;$pythonpath/bin"
103-
"$pythonpath/bin/python" -u -B -X utf8 -m torchstudio.pythoninstall --channel $channel $cuda $packages
100+
101+
"$pythonpath/bin/conda" install -y python-graphviz -c conda-forge
102+
if [ $? != 0 ]; then
103+
echo "" 1>&2
104+
echo "Error while installing python-graphviz" 1>&2
105+
exit 1
106+
fi
107+
108+
"$pythonpath/bin/python" -u -B -X utf8 -m torchstudio.pythoninstall $cuda $packages
104109
if [ $? != 0 ]; then
105110
echo "" 1>&2
106111
echo "Error while installing packages" 1>&2
@@ -121,17 +126,13 @@ cd /D "%~dp0"
121126
cd ..
122127

123128
set pythonpath=%cd%\python
124-
set channel=pytorch
125129
set cuda=
126130
set packages=
127131
set uninstall=
128132
:args
129133
if "%~1" == "--path" (
130134
set pythonpath=%~2
131135
shift
132-
) else if "%~1" == "--channel" (
133-
set channel=%~2
134-
shift
135136
) else if "%~1" == "--cuda" (
136137
set cuda=--cuda
137138
) else if "%~1" == "--package" (
@@ -194,7 +195,15 @@ if ERRORLEVEL 1 (
194195
del %file% 2>nul
195196

196197
set PATH=%PATH%;%pythonpath%;%pythonpath%\Library\mingw-w64\bin;%pythonpath%\Library\bin;%pythonpath%\bin
197-
"%pythonpath%\python" -u -B -X utf8 -m torchstudio.pythoninstall --channel %channel% %cuda% %packages%
198+
199+
call "%pythonpath%\condabin\conda" install -y python-graphviz -c conda-forge
200+
if ERRORLEVEL 1 (
201+
echo. 1>&2
202+
echo Error while installing python-graphviz 1>&2
203+
exit /B 1
204+
)
205+
206+
"%pythonpath%\python" -u -B -X utf8 -m torchstudio.pythoninstall %cuda% %packages%
198207
if ERRORLEVEL 1 (
199208
echo. 1>&2
200209
echo Error while installing packages 1>&2

torchstudio/pythoninstall.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,7 @@
1414
exit()
1515

1616
if not args.package:
17-
#first install python-graphviz as it only exist as a conda package, and conda is recommended before pip: https://www.anaconda.com/blog/using-pip-in-a-conda-environment
18-
if importlib.util.find_spec("conda") is None:
19-
print("Error: Conda is required to install the graphviz package.", file=sys.stderr)
20-
exit()
21-
else:
22-
print("Downloading and installing the graphviz package...")
23-
print("")
24-
result = subprocess.run([sys.executable, "-m", "conda", "install", "-y", "python-graphviz", "-c", "conda-forge"])
25-
if result.returncode != 0:
26-
exit(result.returncode)
27-
print("")
28-
17+
#NB: conda install are recommended before pip: https://www.anaconda.com/blog/using-pip-in-a-conda-environment
2918
pip_install="torch torchvision torchaudio torchtext"
3019
if (sys.platform.startswith('win') or sys.platform.startswith('linux')):
3120
if args.cuda:

0 commit comments

Comments
 (0)