TL;DR: scipy moved triu out of scipy.linalg.special_matrices into scipy.linalg. Change your import to `from scipy.linalg import triu` and it works on old and new scipy.

## The error
```text
ImportError: cannot import name 'triu' from 'scipy.linalg.special_matrices'
```

## Fix it
1. Replace the import in your code:
   ```python
   from scipy.linalg import triu
   ```
   Expected: no other changes needed; triu takes the same arguments.
2. If you maintain a library, make the import version-proof:
   ```python
   try:
       from scipy.linalg import triu
   except ImportError:
       from scipy.linalg.special_matrices import triu
   ```
3. Verify:
   ```
   python -c "from scipy.linalg import triu; print(triu([[1,2],[3,4]]))"
   ```
   Expected: prints the upper-triangular matrix.

## When this applies
Use this when old code or a dependency does `from scipy.linalg.special_matrices import triu` (or tril) on a recent scipy.

## When it does not apply
If the error names a different function, look up its new location instead of guessing. If scipy itself will not import, the install is broken.

## Compatibility
scipy 1.8+ (special_matrices no longer exports triu/tril). from scipy.linalg import triu works on scipy 1.x and 2.x alike.

## Root cause
scipy consolidated the triangular-matrix helpers into the main linalg namespace and stopped re-exporting them from the special_matrices submodule. Code written against the old path breaks at import.

## Edge cases
The same move applies to tril. Some very old code does `from scipy.linalg.special_matrices import toeplitz`; toeplitz stayed put, so only triu/tril need the change.