# Buggy code
def check_data(self):
    def error(err):
        err()
        self.data = None

    # `super().check_data()` clears all messages so we have to remember if
    # it was shown
    # pylint: disable=assignment-from-no-return
    should_show_modified_message = self.Information.modified.is_shown()
    super().check_data()

    if self.data is None:
        return

    self.Information.modified(shown=should_show_modified_message)

    if len(self.data) < 2:
        error(self.Error.not_enough_rows)

    elif not self.data.domain.attributes:
        error(self.Error.no_attributes)

    elif not self.data.is_sparse():
        if np.all(~np.isfinite(self.data.X)):
            error(self.Error.no_valid_data)
        else:
            with warnings.catch_warnings():
                warnings.filterwarnings(
                    "ignore", "Degrees of freedom .*", RuntimeWarning
                )
                if np.nan_to_num(np.nanstd(self.data.X, axis=0)).sum() == 0:
                    error(self.Error.constant_data)


# Traceback (ValueError)
Traceback (most recent call last):
File "/Users/primoz/Documents/orange3/Orange/widgets/utils/concurrent.py", line 596, in _on_task_done
super()._on_task_done(future)
File "/Users/primoz/Documents/orange3/Orange/widgets/utils/concurrent.py", line 552, in _on_task_done
self.on_exception(ex)
File "/Users/primoz/Documents/orange3/Orange/widgets/utils/concurrent.py", line 492, in on_exception
raise ex
File "/Users/primoz/miniconda3/envs/orange/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/primoz/Documents/orange3/Orange/widgets/unsupervised/owtsne.py", line 217, in run
job(progress_callback=_progress_callback)
File "/Users/primoz/Documents/orange3/Orange/widgets/unsupervised/owtsne.py", line 107, in compute_initialization
task.initialization = task.tsne.compute_initialization(task.pca_projection.X)
File "/Users/primoz/Documents/orange3/Orange/projection/manifold.py", line 454, in compute_initialization
X, self.n_components, random_state=self.random_state
File "/Users/primoz/miniconda3/envs/orange/lib/python3.7/site-packages/openTSNE/initialization.py", line 58, in pca
embedding = pca_.fit_transform(X)
File "/Users/primoz/miniconda3/envs/orange/lib/python3.7/site-packages/sklearn/decomposition/_pca.py", line 369, in fit_transform
U, S, V = self._fit(X)
File "/Users/primoz/miniconda3/envs/orange/lib/python3.7/site-packages/sklearn/decomposition/_pca.py", line 416, in _fit
return self._fit_full(X, n_components)
File "/Users/primoz/miniconda3/envs/orange/lib/python3.7/site-packages/sklearn/decomposition/_pca.py", line 435, in _fit_full
% (n_components, min(n_samples, n_features)))
ValueError: n_components=2 must be between 0 and min(n_samples, n_features)=1 with svd_solver='full'

# Fixed code
def check_data(self):
    def error(err):
        err()
        self.data = None

    # `super().check_data()` clears all messages so we have to remember if
    # it was shown
    # pylint: disable=assignment-from-no-return
    should_show_modified_message = self.Information.modified.is_shown()
    super().check_data()

    if self.data is None:
        return

    self.Information.modified(shown=should_show_modified_message)

    if len(self.data) < 2:
        error(self.Error.not_enough_rows)

    elif len(self.data.domain.attributes) < 2:
        error(self.Error.not_enough_cols)

    elif not self.data.is_sparse():
        if np.all(~np.isfinite(self.data.X)):
            error(self.Error.no_valid_data)
        else:
            with warnings.catch_warnings():
                warnings.filterwarnings(
                    "ignore", "Degrees of freedom .*", RuntimeWarning
                )
                if np.nan_to_num(np.nanstd(self.data.X, axis=0)).sum() == 0:
                    error(self.Error.constant_data)