Mechanical waves require matter to travel medium. If there is no substance or matter to travel through, mechanical waves cannot propagate.
Since space is mostly vacuum, there is no medium for waves to travel through: waves sent by the sun (electromagnetic waves) are not mechanical waves