Skip to content

Commit 143f675

Browse files
FindHaofacebook-github-bot
authored andcommitted
Fix: Show actual error messages in Triton installation script (#49)
Summary: ## Problem When Triton import failed in CI scripts, errors were silently discarded (`2>/dev/null`) making debugging impossible. Additionally, the libstdc++ version was too old to support newer Triton builds. ## Solution - **Error Visibility**: Replace `2>/dev/null` with `2>&1` to capture and display actual error messages - **Controlled Exit**: Use `set +e`/`set -e` around import tests to prevent immediate script termination - **libstdc++ Upgrade**: Update from 12.3.0 to 15.1.0 for `GLIBCXX_3.4.32` support - **Enhanced Diagnostics**: Add Python environment info when imports fail ## Changes - `.ci/install-triton.sh` - Source installation script with improved error handling + libstdc++ upgrade - `.ci/install-triton-pip.sh` - Pip installation script with same error handling improvements Pull Request resolved: #49 Reviewed By: davidberard98 Differential Revision: D79449990 Pulled By: FindHao fbshipit-source-id: 32ff5c2c8832fcdaef965ef226e59a514ee2a3c3
1 parent 922df73 commit 143f675

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

.ci/install-triton-pip.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,28 @@ show_elapsed
4040

4141
# Verify Triton installation
4242
echo "Verifying Triton installation..."
43-
if python -c "import triton; print(f'Triton version: {triton.__version__}')" 2>/dev/null; then
43+
44+
set +e # Temporarily disable exit on error
45+
IMPORT_OUTPUT=$(python -c "import triton; print(f'Triton version: {triton.__version__}')" 2>&1)
46+
IMPORT_EXITCODE=$?
47+
set -e # Re-enable exit on error
48+
49+
echo "Import exit code: $IMPORT_EXITCODE"
50+
echo "Import output: $IMPORT_OUTPUT"
51+
52+
if [ $IMPORT_EXITCODE -eq 0 ]; then
53+
echo "$IMPORT_OUTPUT"
4454
python -c "import triton; print(f'Triton path: {triton.__file__}')"
4555
echo "✅ Triton installation verified successfully"
4656
show_elapsed
4757
echo "🎉 Triton installation completed successfully!"
4858
else
4959
echo "❌ ERROR: Failed to import Triton"
60+
echo "Import error details:"
61+
echo "$IMPORT_OUTPUT"
62+
echo ""
63+
echo "Additional diagnostic information:"
64+
echo "Installed packages containing 'triton':"
65+
pip list | grep -i triton || echo "No triton packages found"
5066
exit 1
5167
fi

.ci/install-triton.sh

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ fi
7272
# ImportError: /opt/miniconda3/envs/tritonparse/bin/../lib/libstdc++.so.6:
7373
# version `GLIBCXX_3.4.30' not found (required by /tmp/triton/python/triton/_C/libtriton.so)
7474
echo "Updating libstdc++ to match system version..."
75-
conda install -y -c conda-forge libstdcxx-ng=12.3.0
75+
# Use the latest version for Ubuntu 22.04 that includes GLIBCXX_3.4.32
76+
conda install -y -c conda-forge libstdcxx-ng=15.1.0
7677
# Check if the update was successful
77-
strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -5
78+
echo "Checking libstdc++ version after update:"
79+
strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -10
7880

7981
# Uninstall existing pytorch-triton
8082
echo "Uninstalling existing pytorch-triton..."
@@ -143,7 +145,23 @@ show_elapsed
143145

144146
# Verify Triton installation
145147
echo "Verifying Triton installation..."
146-
if python -c "import triton; print(f'Triton version: {triton.__version__}')" 2>/dev/null; then
148+
echo "Python path: $(which python)"
149+
echo "Python version: $(python --version)"
150+
echo "PYTHONPATH: $PYTHONPATH"
151+
echo "Testing basic Python functionality..."
152+
python -c "print('Python works')" || echo "❌ Basic Python test failed"
153+
echo "Attempting to import triton..."
154+
155+
set +e # Temporarily disable exit on error
156+
IMPORT_OUTPUT=$(python -c "import triton; print(f'Triton version: {triton.__version__}')" 2>&1)
157+
IMPORT_EXITCODE=$?
158+
set -e # Re-enable exit on error
159+
160+
echo "Import exit code: $IMPORT_EXITCODE"
161+
echo "Import output: $IMPORT_OUTPUT"
162+
163+
if [ $IMPORT_EXITCODE -eq 0 ]; then
164+
echo "$IMPORT_OUTPUT"
147165
python -c "import triton; print(f'Triton path: {triton.__file__}')"
148166
echo "✅ Triton installation verified successfully"
149167

@@ -155,11 +173,19 @@ if python -c "import triton; print(f'Triton version: {triton.__version__}')" 2>/
155173
echo "🎉 Triton installation completed successfully!"
156174
else
157175
echo "❌ ERROR: Failed to import triton"
158-
echo "This might be due to libstdc++ version issues"
159-
echo "Checking system libstdc++ version:"
160-
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | tail -5 || echo "Could not check system libstdc++"
161-
echo "Checking conda libstdc++ version:"
162-
strings /opt/miniconda3/envs/tritonparse/lib/libstdc++.so.6 | grep GLIBCXX | tail -5 || echo "Could not check conda libstdc++"
176+
echo "Import error details:"
177+
echo "$IMPORT_OUTPUT"
178+
echo ""
179+
echo "Additional diagnostic information:"
180+
echo "Installed packages containing 'triton':"
181+
pip list | grep -i triton || echo "No triton packages found"
182+
echo ""
183+
echo "Python sys.path:"
184+
python -c "import sys; print('\n'.join(sys.path))"
185+
echo ""
186+
echo "Checking if triton directory exists in site-packages:"
187+
python -c "import site; print([p for p in site.getsitepackages()])" 2>/dev/null || echo "Could not get site-packages"
188+
find $(python -c "import site; print(' '.join(site.getsitepackages()))" 2>/dev/null) -name "*triton*" 2>/dev/null || echo "Could not find triton in site-packages"
163189

164190
# Clean up cache on failure to prevent corruption
165191
echo "🧹 Cleaning up cache due to installation failure..."

0 commit comments

Comments
 (0)