ValueError: buffer source array is read-only In DictionaryLearning using coordinate decent, numworkers = 15

### Describe the bug

I get "source array is read only" error in Dictionary Learning when I try to fit it to the Cifar10 Dataset. 

### Steps/Code to Reproduce

```python
from sklearn.decomposition import DictionaryLearning
from keras.datasets import cifar10

(x_train, y_train), (x_test, y_test) = cifar10.load_data() #or x_train = np.random((50000, 32,32,3))


dict_learner = DictionaryLearning(
    n_components= 56,
    random_state=0,
    n_jobs=15,
    fit_algorithm='cd',
    verbose= True,
    max_iter= 50
)
s_train = dict_learner.fit_transform(x_train.reshape(50000, 3072))
```

### Expected Results

The dictionary

### Actual Results

```pytb
 File "sklearn\linear_model\_cd_fast.pyx", line 568, in sklearn.linear_model._cd_fast.enet_coordinate_descent_gram
  File "stringsource", line 660, in View.MemoryView.memoryview_cwrapper
  File "stringsource", line 350, in View.MemoryView.memoryview.__cinit__
ValueError: buffer source array is read-only
"""

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
Cell In [16], line 13
      4 #out = dict_learning_online(x_train[np.random.choice(a=50000, size=10000)].reshape(10000, 3072), n_components=3072)
      5 dict_learner = DictionaryLearning(
      6     n_components= 56,
      7     random_state=0,
   (...)
     11     max_iter= 50
     12 )
---> 13 s_train = dict_learner.fit_transform(x_train.reshape(50000, 3072))

File c:\Users\shafi\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\_set_output.py:142, in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs)
    140 @wraps(f)
    141 def wrapped(self, X, *args, **kwargs):
--> 142     data_to_wrap = f(self, X, *args, **kwargs)
    143     if isinstance(data_to_wrap, tuple):
    144         # only wrap the first output for cross decomposition
    145         return (
    146             _wrap_data_with_container(method, data_to_wrap[0], X, self),
    147             *data_to_wrap[1:],
    148         )

File c:\Users\shafi\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\_set_output.py:142, in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs)
    140 @wraps(f)
    141 def wrapped(self, X, *args, **kwargs):
--> 142     data_to_wrap = f(self, X, *args, **kwargs)
    143     if isinstance(data_to_wrap, tuple):
    144         # only wrap the first output for cross decomposition
    145         return (
    146             _wrap_data_with_container(method, data_to_wrap[0], X, self),
    147             *data_to_wrap[1:],
    148         )

File c:\Users\shafi\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\_set_output.py:142, in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs)
    140 @wraps(f)
    141 def wrapped(self, X, *args, **kwargs):
--> 142     data_to_wrap = f(self, X, *args, **kwargs)
    143     if isinstance(data_to_wrap, tuple):
    144         # only wrap the first output for cross decomposition
    145         return (
    146             _wrap_data_with_container(method, data_to_wrap[0], X, self),
    147             *data_to_wrap[1:],
    148         )

File c:\Users\shafi\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py:848, in TransformerMixin.fit_transform(self, X, y, **fit_params)
    844 # non-optimized default implementation; override when a better
    845 # method is possible for a given clustering algorithm
    846 if y is None:
    847     # fit method of arity 1 (unsupervised transformation)
--> 848     return self.fit(X, **fit_params).transform(X)
    849 else:
    850     # fit method of arity 2 (supervised transformation)
    851     return self.fit(X, y, **fit_params).transform(X)

File c:\Users\shafi\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\decomposition\_dict_learning.py:1719, in DictionaryLearning.fit(self, X, y)
   1716 else:
   1717     n_components = self.n_components
-> 1719 V, U, E, self.n_iter_ = dict_learning(
   1720     X,
   1721     n_components,
   1722     alpha=self.alpha,
   1723     tol=self.tol,
   1724     max_iter=self.max_iter,
   1725     method=self.fit_algorithm,
...
--> 389         raise self._exception
    390     else:
    391         return self._result

ValueError: buffer source array is read-only
```

### Versions

```shell
System:
    python: 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
executable: c:\Users\shafi\AppData\Local\Programs\Python\Python39\python.exe
   machine: Windows-10-10.0.19041-SP0

Python dependencies:
      sklearn: 1.2.0
          pip: 20.2.3
   setuptools: 49.2.1
        numpy: 1.23.4
        scipy: 1.8.0
       Cython: None
       pandas: 1.5.1
   matplotlib: 3.4.3
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\shafi\AppData\Roaming\Python\Python39\site-packages\numpy\.libs\libopenblas.WCDJNK7YVMPZQ2ME2ZZHJJRJ3JIKNDB7.gfortran-win_amd64.dll
        version: 0.3.13
threading_layer: pthreads
   architecture: Zen
    num_threads: 16

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\shafi\AppData\Local\Programs\Python\Python39\Lib\site-packages\scipy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
        version: 0.3.17
threading_layer: pthreads
   architecture: Zen
    num_threads: 16

       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\shafi\AppData\Local\Programs\Python\Python39\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 16
```

COMMENT:
I can't reproduce your error in 1.2 and 1.1.3.

Still, I get another traceback using your reproducer:

```
"""                                                                                                                                                                                           
Traceback (most recent call last):                                                                                                                                                            
  File "/home/jjerphan/.local/share/miniconda3/envs/sk-debug/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 428, in _process_worker                             
    r = call_item()                                                                                                                                                                           
  File "/home/jjerphan/.local/share/miniconda3/envs/sk-debug/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 275, in __call__                                    
    return self.fn(*self.args, **self.kwargs)                                                                                                                                                 
  File "/home/jjerphan/.local/share/miniconda3/envs/sk-debug/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 620, in __call__                                                 
    return self.func(*args, **kwargs)                                                                                                                                                         
  File "/home/jjerphan/.local/share/miniconda3/envs/sk-debug/lib/python3.9/site-packages/joblib/parallel.py", line 288, in __call__                                                           
    return [func(*args, **kwargs)                                                                                                                                                             
  File "/home/jjerphan/.local/share/miniconda3/envs/sk-debug/lib/python3.9/site-packages/joblib/parallel.py", line 288, in <listcomp>                                                         
    return [func(*args, **kwargs)                                                                                                                                                             
  File "/home/jjerphan/dev/scikit-learn/sklearn/utils/fixes.py", line 117, in __call__                                                                                                        
    return self.function(*args, **kwargs)                                                                                                                                                     
  File "/home/jjerphan/dev/scikit-learn/sklearn/decomposition/_dict_learning.py", line 179, in _sparse_encode                                                                                 
    clf.fit(dictionary.T, X.T, check_input=check_input)                                                                                                                                       
  File "/home/jjerphan/dev/scikit-learn/sklearn/linear_model/_coordinate_descent.py", line 1031, in fit                                                                                       
    coef_[k] = this_coef[:, 0]                                                                                                                                                                
ValueError: assignment destination is read-only                                                                                                                                               
"""
```

Nevertheless, looking at error, I think the error reported in your trace is due to https://github.com/scikit-learn/scikit-learn/commit/845e702ab9c01271f08084a1adc56e2f34dc3a18 (which first featured in `0.18.0`!).

I have opened https://github.com/scikit-learn/scikit-learn/pull/25172 to address this problem.

Labels: Bug, module:decomposition