Nilearn first level model hrf_model error


I’m trying to specify an hrf_model for the first level as ‘spm + derivative’, but I get the following error:
Traceback (most recent call last):

File “/home/alado/datasets/code/05-glm_analysis/”, line 216, in
glm_1 =, events=events_1, confounds=confounds_1)

File “/home/alado/anaconda3/lib/python3.8/site-packages/nilearn/glm/first_level/”, line 467, in fit
design = make_first_level_design_matrix(frame_times,

File “/home/alado/anaconda3/lib/python3.8/site-packages/nilearn/glm/first_level/”, line 362, in make_first_level_design_matrix
matrix, names = _convolve_regressors(

File “/home/alado/anaconda3/lib/python3.8/site-packages/nilearn/glm/first_level/”, line 233, in _convolve_regressors
reg, names = compute_regressor(

File “/home/alado/anaconda3/lib/python3.8/site-packages/nilearn/glm/first_level/”, line 562, in compute_regressor
reg_names = _regressor_names(con_id, hrf_model, fir_delays=fir_delays)

File “/home/alado/anaconda3/lib/python3.8/site-packages/nilearn/glm/first_level/”, line 400, in _regressor_names
return [con_name, con_name + “_derivative”]

UFuncTypeError: ufunc ‘add’ did not contain a loop with signature matching types (dtype(’<U21’), dtype(’<U21’)) → dtype(’<U21’)

I get the same error if I try to specify any model with a + sign, models with a single word work fine.

It looks like the condition names are defined as int, not strings.
Can you share the experimental design descriptor ?

Thanks a lot. Indeed, condition names were int. They were automatically created from events.tsv.
I solved the problem with one line:
events['trial_type'] = events['trial_type'].astype(str)