File size: 486,467 Bytes
146d736
7174e7a
 
 
 
 
c7781da
7174e7a
 
c7781da
7174e7a
c7781da
7174e7a
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
c7781da
 
 
 
 
 
 
7174e7a
 
c7781da
 
 
 
 
 
 
 
 
7174e7a
c7781da
 
 
7174e7a
 
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
 
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
c7781da
 
 
 
 
 
 
 
 
7174e7a
c7781da
 
7174e7a
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
 
c7781da
7174e7a
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
c7781da
 
7174e7a
c7781da
 
 
 
 
 
7174e7a
 
 
c7781da
 
7174e7a
c7781da
 
7174e7a
 
c7781da
7174e7a
 
c7781da
7174e7a
 
c7781da
 
 
 
 
 
 
 
7174e7a
 
c7781da
 
 
 
 
 
7174e7a
c7781da
7174e7a
c7781da
7174e7a
c7781da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
f8a3fe7
 
 
 
 
 
 
 
 
 
7174e7a
 
 
 
c7781da
 
 
 
f8a3fe7
c7781da
 
 
 
 
 
 
f8a3fe7
 
7174e7a
 
 
 
c7781da
7174e7a
c7781da
 
7174e7a
f8a3fe7
 
 
 
 
7174e7a
c7781da
 
 
 
 
 
 
f8a3fe7
 
 
c7781da
 
7174e7a
 
 
f8a3fe7
7174e7a
 
 
 
 
c7781da
7174e7a
 
 
f8a3fe7
7174e7a
 
 
f8a3fe7
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
 
7174e7a
 
 
f8a3fe7
 
7174e7a
 
 
 
f8a3fe7
 
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
 
7174e7a
 
 
 
 
 
f8a3fe7
 
7174e7a
f8a3fe7
 
7174e7a
 
 
 
 
 
 
f8a3fe7
 
7174e7a
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
 
 
 
 
f8a3fe7
 
7174e7a
 
 
 
 
 
 
 
 
 
 
 
c7781da
f8a3fe7
 
 
7174e7a
f8a3fe7
 
c7781da
7174e7a
 
 
f8a3fe7
 
 
 
7174e7a
 
 
 
f8a3fe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
f8a3fe7
 
 
7174e7a
 
f8a3fe7
 
7174e7a
 
 
f8a3fe7
 
7174e7a
 
 
 
f8a3fe7
 
 
7174e7a
f8a3fe7
7174e7a
 
f8a3fe7
 
7174e7a
 
 
f8a3fe7
7174e7a
 
f8a3fe7
7174e7a
 
 
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
f8a3fe7
7174e7a
f8a3fe7
 
7174e7a
f8a3fe7
 
7174e7a
 
 
 
 
f8a3fe7
 
 
7174e7a
 
 
 
 
f8a3fe7
 
 
 
7174e7a
 
 
 
 
 
f8a3fe7
7174e7a
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
 
 
 
 
f8a3fe7
 
 
 
 
7174e7a
f8a3fe7
7174e7a
 
 
 
 
f8a3fe7
7174e7a
 
f8a3fe7
c7781da
f8a3fe7
c7781da
 
 
f8a3fe7
 
 
 
c7781da
 
f8a3fe7
 
c7781da
 
f8a3fe7
 
 
c7781da
 
7174e7a
f8a3fe7
 
 
7174e7a
f8a3fe7
 
 
 
 
 
 
 
7174e7a
 
c7781da
f8a3fe7
c7781da
7174e7a
f8a3fe7
7174e7a
f8a3fe7
 
7174e7a
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
 
7174e7a
 
 
 
 
 
f8a3fe7
 
 
7174e7a
 
f8a3fe7
 
7174e7a
f8a3fe7
 
7174e7a
f8a3fe7
 
7174e7a
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
f8a3fe7
 
 
7174e7a
 
 
 
 
 
 
f8a3fe7
7174e7a
 
 
f8a3fe7
7174e7a
 
 
f8a3fe7
 
 
 
7174e7a
 
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
 
 
 
 
 
7174e7a
f8a3fe7
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
 
 
f8a3fe7
 
 
 
7174e7a
f8a3fe7
7174e7a
 
 
 
 
 
 
f8a3fe7
 
 
 
 
7174e7a
f8a3fe7
7174e7a
 
 
f8a3fe7
 
7174e7a
 
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
 
 
 
 
7174e7a
 
 
 
 
 
 
f8a3fe7
 
 
7174e7a
 
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
 
 
 
 
 
c7781da
 
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
f8a3fe7
 
7174e7a
 
f8a3fe7
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
7174e7a
 
 
 
 
 
f8a3fe7
7174e7a
f8a3fe7
7174e7a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f8a3fe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7174e7a
 
 
 
 
 
146d736
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Parcours WSL Python Climat</title>
<meta name="description" content="Parcours WSL - Python pour les données climatiques : tutoriels 00 à 09, PDF et outils à télécharger, commandes, dépannage, QCM. Dr Ibrahima Diouf, Université de Labé.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap">
<style>
/* Layout: blue top bar (brand, links, theme) > white tab bar > navy hero card with status box > content plates; same family as the Fouta Djallon Water Atlas */
:root{
  --top:#5f86c2; --top-ink:#ffffff; --top-soft:rgba(255,255,255,.85);
  --hero:#1e2d4d; --hero-2:#2a3b5f; --hero-ink:#ffffff; --hero-soft:rgba(255,255,255,.78);
  --bg:#eef1f6; --surface:#ffffff; --ink:#1b2535; --muted:#5b6779; --line:#dbe1ea; --chip:#f3f5f9;
  --tab:#f2f4f8; --tab-act:#3d6fc4; --accent:#c2502f; --navy:#1e2d4d;
  --water:#2a6db0; --water-2:#9cc3e6; --laterite:#b45d2a; --plateau:#3f7a43; --sun:#d39a2c;
  --good:#2f7d4f; --bad:#b33a2f; --violet:#6b3fa0;
  --code:#13203a; --codehead:#1c2c4b; --codeink:#e6edf7; --codecom:#8ea2c2;
  --f-ui:"Manrope",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;
  --pad:clamp(10px,1.6vw,24px); --band:clamp(6px,2.2vw,44px);
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --top:#1f3a63; --top-ink:#f2f6fb; --top-soft:rgba(242,246,251,.82);
  --hero:#121d31; --hero-2:#1b2a44; --hero-ink:#f2f6fb; --hero-soft:rgba(242,246,251,.75);
  --bg:#0d131c; --surface:#151e2a; --ink:#e4eaf2; --muted:#98a6b8; --line:#283445; --chip:#1b2633;
  --tab:#1b2633; --tab-act:#5b8fe0; --accent:#e07a54; --navy:#e4eaf2;
  --water:#6fa9e2; --water-2:#2e5d8c; --laterite:#d9824d; --plateau:#7bb77e; --sun:#e3b45a;
  --good:#5fbf86; --bad:#ec7a6d; --violet:#c6a2f5;
  --code:#0a1120; --codehead:#14213a; --codeink:#e6edf7; --codecom:#8ea2c2; color-scheme:dark}}
:root[data-theme="dark"]{
  --top:#1f3a63; --top-ink:#f2f6fb; --top-soft:rgba(242,246,251,.82);
  --hero:#121d31; --hero-2:#1b2a44; --hero-ink:#f2f6fb; --hero-soft:rgba(242,246,251,.75);
  --bg:#0d131c; --surface:#151e2a; --ink:#e4eaf2; --muted:#98a6b8; --line:#283445; --chip:#1b2633;
  --tab:#1b2633; --tab-act:#5b8fe0; --accent:#e07a54; --navy:#e4eaf2;
  --water:#6fa9e2; --water-2:#2e5d8c; --laterite:#d9824d; --plateau:#7bb77e; --sun:#e3b45a;
  --good:#5fbf86; --bad:#ec7a6d; --violet:#c6a2f5;
  --code:#0a1120; --codehead:#14213a; --codeink:#e6edf7; --codecom:#8ea2c2; color-scheme:dark}

*{box-sizing:border-box}
html,body{overflow-x:hidden}
body{background:var(--top);color:var(--ink);font-family:var(--f-ui);font-size:15px;line-height:1.55;margin:0;-webkit-text-size-adjust:100%}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:var(--top)}
.wrap{padding-left:max(var(--pad),env(safe-area-inset-left,0px));padding-right:max(var(--pad),env(safe-area-inset-right,0px))}
nav.tabs,.herowrap,main.wrap{margin-inline:var(--band)}
.herowrap,main.wrap{background:var(--bg)}
main.wrap{border-radius:0 0 12px 12px;margin-bottom:var(--band);padding-block:var(--pad) 28px;display:grid;gap:18px}
#view{display:grid;gap:18px;min-width:0}
h1,h2,h3{font-family:var(--f-ui);text-wrap:balance;line-height:1.2;margin:0}
p{margin:0}
a{color:var(--water)}
code{font-family:var(--f-mono);font-size:.86em;background:var(--chip);border:1px solid var(--line);color:var(--ink);padding:.02em .35em;border-radius:5px;overflow-wrap:anywhere}
b,strong{font-weight:700}
.muted{color:var(--muted)} .small{font-size:.86rem}
button{font:inherit;cursor:pointer}
:focus-visible{outline:3px solid var(--sun);outline-offset:2px}

/* top bar */
header.top{background:var(--top);color:var(--top-ink)}
header.top .wrap{display:flex;flex-wrap:wrap;gap:10px 18px;align-items:center;justify-content:space-between;padding-block:10px}
.brand{display:flex;gap:10px;align-items:center;min-width:0}
.logo{width:36px;height:36px;border-radius:9px;background:#fff;display:grid;place-items:center;flex:none}
.brand b{font-weight:800;font-size:17px;line-height:1.2}
.brand b sup{font-size:11px;font-weight:600;opacity:.85;margin-left:4px}
.brand small{display:block;font-size:12px;color:var(--top-soft)}
.right{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center}
.right .links{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center}
.right a{color:var(--top-ink);font-weight:700;font-size:13px;text-decoration:none}
.right a:hover{text-decoration:underline}
.thb{background:rgba(255,255,255,.18);color:var(--top-ink);border:0;border-radius:8px;width:34px;height:30px;font-size:15px}

/* tabs */
nav.tabs{background:var(--surface);border-bottom:1px solid var(--line)}
nav.tabs .wrap{display:flex;flex-wrap:wrap;gap:8px;padding-block:10px}
nav.tabs button{background:var(--tab);color:var(--ink);border:1px solid var(--line);border-radius:8px;padding:8px 14px;font:700 13.5px var(--f-ui);box-shadow:0 1px 1px rgba(0,0,0,.04)}
nav.tabs button[aria-pressed="true"]{background:var(--tab-act);border-color:var(--tab-act);color:#fff}

/* hero */
.herowrap{padding-top:var(--pad)}
.hero,.card.thead{border:0;background:linear-gradient(135deg,var(--hero),var(--hero-2));color:var(--hero-ink);border-radius:14px;padding:clamp(18px,2.6vw,32px)}
.hero{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:22px;align-items:center}
.eyebrow{font-family:var(--f-mono);font-size:11.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--hero-soft)}
.hero h1{font-weight:800;font-size:clamp(24px,3.4vw,40px);line-height:1.12;margin:8px 0}
.hero p{color:var(--hero-soft);max-width:78ch}
.authors{margin-top:12px;font-size:13.5px;color:var(--hero-soft)}
.authors b{color:var(--hero-ink)}
.authors .aff{display:block;font-size:12px;margin-top:2px}
.pills{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
.pills span{border:1px solid rgba(255,255,255,.28);border-radius:999px;padding:4px 11px;font-size:12px;color:var(--hero-ink)}
.status{background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.16);border-radius:12px;padding:16px;display:grid;gap:10px;min-width:0}
.status .st{font-weight:800;font-size:clamp(18px,2vw,23px);display:flex;align-items:center;gap:8px}
.status .st i{width:11px;height:11px;border-radius:50%;background:#4cc37a;display:inline-block;flex:none}
.status .grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.status .grid small{display:block;font-size:11.5px;color:var(--hero-soft)}
.status .grid b{font-size:clamp(19px,2vw,24px);font-weight:800;font-variant-numeric:tabular-nums}
.status .grid code{display:block;font-family:var(--f-mono);font-size:11px;color:var(--hero-soft);background:none;border:0;padding:0}
.status p{font-size:12px;color:var(--hero-soft)}
.hbar{height:8px;border-radius:999px;background:rgba(255,255,255,.14);overflow:hidden}
.hbar i{display:block;height:100%;background:#4cc37a}

/* body */
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:16px;display:grid;gap:12px;min-width:0;align-content:start}
.card h2,.sechead h2{font-weight:800;font-size:clamp(20px,2.4vw,26px)}
.card h3{font-weight:800;font-size:16px}
h2 .num{font-family:var(--f-mono);font-size:.62em;font-weight:600;color:var(--accent);border:1.5px solid var(--accent);border-radius:7px;padding:1px 7px;margin-right:10px;vertical-align:.18em}
.sectitle,.sechead{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:4px 16px}
.lbl{font-family:var(--f-mono);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.lead{max-width:110ch;color:var(--muted)}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,460px),1fr));gap:16px;align-items:start}
.stack{display:grid;gap:12px;min-width:0}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

/* KPI */
.kpis{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr));gap:14px}
.kpi{background:var(--surface);border:1px solid var(--line);border-top:3px solid var(--accent);border-radius:12px;padding:14px 16px;display:grid;gap:3px;align-content:start;min-width:0}
.kpi b{font-family:var(--f-mono);font-size:25px;font-weight:600;font-variant-numeric:tabular-nums;line-height:1.2}
.kpi small{font-family:var(--f-mono);font-size:11.5px;color:var(--muted)}
.kpi.kw{border-top-color:var(--water)}.kpi.kh{border-top-color:var(--bad)}.kpi.ks{border-top-color:var(--plateau)}.kpi.kr{border-top-color:var(--laterite)}.kpi.ku{border-top-color:var(--sun)}

/* buttons */
.btn{background:var(--tab-act);color:#fff;border:1px solid var(--tab-act);border-radius:8px;padding:8px 14px;font:700 13.5px var(--f-ui);text-decoration:none;display:inline-flex;align-items:center;gap:6px}
.btn:hover{filter:brightness(1.07)}
.btn.ghost{background:var(--tab);color:var(--ink);border-color:var(--line)}
.btn[disabled]{opacity:.45;cursor:default}
.chip{background:var(--surface);color:var(--ink);border:1.5px solid var(--navy);border-radius:7px;padding:4px 11px;font:700 13px var(--f-ui);line-height:1.35}
.chip[aria-pressed="true"]{background:var(--navy);color:var(--surface)}
.mini{background:var(--tab);border:1px solid var(--line);color:var(--ink);border-radius:6px;padding:2px 9px;font:700 12px var(--f-ui)}
.linkbtn{background:none;border:0;padding:0;color:var(--water);font-weight:700;text-decoration:underline;text-underline-offset:2px}
.pbref{background:color-mix(in srgb,var(--violet) 14%,transparent);color:var(--violet);border:0;border-radius:5px;padding:0 .35em;font-family:var(--f-mono);font-size:.84em;font-weight:600}
.pbref:hover{text-decoration:underline}
input[type=search],input[type=text]{width:100%;font:inherit;padding:9px 13px;border-radius:8px;border:1px solid var(--line);background:var(--surface);color:var(--ink)}

/* toc (pills with mono numbers) */
.toc{display:flex;flex-wrap:wrap;gap:8px}
.toc button,.toc a{display:inline-flex;align-items:center;gap:7px;text-decoration:none;color:var(--ink);font:700 13px var(--f-ui);background:var(--chip);border:1px solid var(--line);border-radius:999px;padding:5px 12px 5px 5px;text-align:left}
.toc button span.n,.toc a span.n{font-family:var(--f-mono);font-size:11px;background:var(--navy);color:var(--surface);border-radius:999px;padding:2px 7px;flex:none}
.toc button:hover,.toc a:hover{border-color:var(--tab-act)}
.toc button[aria-pressed="true"]{background:var(--tab-act);border-color:var(--tab-act);color:#fff}
.toc button[aria-pressed="true"] span.n{background:#fff;color:var(--tab-act)}

/* where badges */
.where{display:inline-flex;align-items:center;gap:6px;font-family:var(--f-mono);font-weight:600;font-size:11px;letter-spacing:.03em;padding:2px 9px;border-radius:999px;border:1px solid currentColor;line-height:1.5;background:var(--surface)}
.where::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.w-ps,.w-psa{color:var(--water)} .w-ub,.w-mac{color:var(--laterite)} .w-geo{color:var(--plateau)} .w-root{color:var(--bad)} .w-nano,.w-file,.w-wslconfig,.w-win,.w-key,.w-msg{color:var(--muted)} .w-py{color:var(--violet)}
.cmd .where{background:var(--code)}
.cmd .w-ps,.cmd .w-psa{color:#8fbaf0}.cmd .w-ub,.cmd .w-mac{color:#f2a777}.cmd .w-geo{color:#8fd49a}.cmd .w-root{color:#f39b90}.cmd .w-nano,.cmd .w-file,.cmd .w-wslconfig,.cmd .w-win,.cmd .w-key,.cmd .w-msg{color:#b8c4d8}.cmd .w-py{color:#cdb0f5}

/* command block */
.cmd{border-radius:10px;overflow:hidden;background:var(--code);border:1px solid var(--codehead);min-width:0}
.cmd-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px 6px 10px;background:var(--codehead);flex-wrap:wrap}
.cmd-copy{background:#3d6fc4;color:#fff;border:0;border-radius:6px;padding:3px 12px;font:700 12px var(--f-ui)}
.cmd-body{margin:0;padding:11px 14px;font-family:var(--f-mono);font-size:13px;line-height:1.55;color:var(--codeink)}
.cl{white-space:pre-wrap;overflow-wrap:anywhere;padding-left:1.25em;text-indent:-1.25em}
.cl::before{content:"›";display:inline-block;width:1.25em;text-indent:0;color:#7fb0ec;font-weight:600}
.cl.com{color:var(--codecom)} .cl.com::before,.cl.blank::before{content:""}
.plain .cl{padding-left:0;text-indent:0}.plain .cl::before{content:none}
.ph{background:rgba(211,154,44,.22);color:#ffd88a;border-radius:4px;padding:0 2px}
.ph.set{background:rgba(95,191,134,.2);color:#a6efc3}
.cmd-note{font-size:12px;color:var(--codecom);padding:0 14px 10px}
.cmd-note .linkbtn{color:#ffd88a}
.out{background:color-mix(in srgb,var(--good) 8%,var(--surface));border:1px solid color-mix(in srgb,var(--good) 35%,var(--line));border-radius:10px;min-width:0}
.out .lbl{display:block;padding:8px 12px 0;color:var(--good)}
.out pre{margin:0;padding:6px 12px 12px;font-family:var(--f-mono);font-size:12.5px;line-height:1.5;color:var(--ink);overflow-x:auto;white-space:pre}

/* notes (warnbox style) */
.note{border-left:4px solid var(--k);background:color-mix(in srgb,var(--k) 11%,var(--surface));padding:10px 12px;border-radius:6px;display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;font-size:14px}
.note .ni{font-family:var(--f-mono);font-weight:600;font-size:10.5px;letter-spacing:.07em;text-transform:uppercase;color:var(--k);white-space:nowrap;padding-top:2px}
.n-ok{--k:var(--good)} .n-warn{--k:var(--sun)} .n-tip{--k:var(--water)} .n-danger{--k:var(--bad)} .n-fail{--k:var(--violet)}
@media (max-width:560px){.note{grid-template-columns:minmax(0,1fr);gap:3px}}

/* tables */
.tw{overflow-x:auto;-webkit-overflow-scrolling:touch;min-width:0}
table{border-collapse:collapse;width:100%;font-size:13.5px}
th,td{padding:8px 10px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{font-family:var(--f-mono);font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
td{min-width:9ch}
tr:last-child td{border-bottom:0}
@media (max-width:640px){
  table.resp thead{display:none}
  table.resp tr{display:block;border-bottom:1px solid var(--line);padding:6px 0}
  table.resp tr:last-child{border-bottom:0}
  table.resp td{display:grid;grid-template-columns:minmax(78px,32%) minmax(0,1fr);gap:8px;border:0;padding:3px 4px}
  table.resp td::before{content:attr(data-h);font-family:var(--f-mono);font-size:10px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);padding-top:3px}
}
ul.l,ol.l{margin:0;padding-left:1.3em;display:grid;gap:6px;max-width:110ch}

/* path overview */
.phases{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:14px}
.phase{display:grid;gap:8px;align-content:start}
.phase h3{font-size:14px}
.tnode{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:8px 10px;color:var(--ink);width:100%;font:600 13.5px/1.3 var(--f-ui)}
.tnode:hover{border-color:var(--tab-act)}
.tnum{font-family:var(--f-mono);font-weight:600;font-size:12px;background:var(--navy);color:var(--surface);border-radius:6px;padding:3px 7px;min-width:3.2em;text-align:center}
.state{width:12px;height:12px;border-radius:50%;border:2px solid var(--line);flex:none}
.state.part{border-color:var(--sun);background:linear-gradient(90deg,var(--sun) 50%,transparent 50%)}
.state.done{border-color:var(--good);background:var(--good)}
.bar{height:9px;background:var(--chip);border:1px solid var(--line);border-radius:999px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--good);border-radius:999px}

/* tutorial head */
.thead{display:grid;gap:8px}
.thead .lbl{color:var(--hero-soft)}
.thead h2{color:var(--hero-ink);font-weight:800;font-size:clamp(22px,3vw,34px)}
.thead p.sub{color:var(--hero-soft);max-width:78ch}
.meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:10px;margin-top:6px}
.meta div{background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.16);border-radius:10px;padding:9px 12px;font-size:13.5px;color:var(--hero-ink)}
.meta b{display:block;font-family:var(--f-mono);font-weight:600;font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--hero-soft);margin-bottom:3px}
.meta code{background:rgba(255,255,255,.12);border-color:transparent;color:#fff}
.thead .btn.ghost{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.25);color:#fff}
.block h3{scroll-margin-top:12px}
.check{padding:0;margin:0;display:grid;gap:6px;list-style:none}
.check label{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;padding:8px 10px;border-radius:8px;background:var(--chip);border:1px solid var(--line);cursor:pointer}
.check input{width:19px;height:19px;margin:2px 0 0;accent-color:var(--good)}
.check label.on{border-color:color-mix(in srgb,var(--good) 55%,var(--line));background:color-mix(in srgb,var(--good) 9%,var(--surface))}
details{border:1px solid var(--line);border-radius:10px;background:var(--surface);min-width:0}
details>summary{cursor:pointer;padding:10px 12px;list-style:none;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center}
details>summary::-webkit-details-marker{display:none}
details>summary::after{content:"+";font-weight:800;color:var(--muted);font-size:1.2rem;line-height:1}
details[open]>summary::after{content:"\2212"}
details[open]>summary{border-bottom:1px solid var(--line)}
.dbody{padding:12px;display:grid;gap:10px;min-width:0}
.pcode{font-family:var(--f-mono);font-weight:600;font-size:12px;background:color-mix(in srgb,var(--violet) 14%,transparent);color:var(--violet);border-radius:5px;padding:2px 7px;white-space:nowrap}
.ptitle{font-weight:700;line-height:1.35}
.ptitle small{display:block;font-weight:500;color:var(--muted);font-size:12.5px;overflow-wrap:anywhere}
.see{background:var(--code);color:var(--codeink);font-family:var(--f-mono);font-size:12.5px;border-radius:8px;padding:10px 12px;display:grid;gap:4px;overflow-wrap:anywhere}
.see code{background:transparent;color:inherit;padding:0;border:0}
.pager{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.solution summary{grid-template-columns:minmax(0,1fr) auto}

/* commands */
.cmdrow{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:14px;align-items:start;padding:11px 0;border-bottom:1px solid var(--line)}
.cmdrow:last-child{border-bottom:0}
.cmdrow .code{font-family:var(--f-mono);font-size:13px;background:var(--code);color:var(--codeink);border-radius:8px;padding:8px 10px;white-space:pre-wrap;overflow-wrap:anywhere}
.cmdrow .meta2{display:grid;gap:3px;font-size:14px}
@media (max-width:700px){.cmdrow{grid-template-columns:minmax(0,1fr);gap:8px}}

/* tool steps */
.steps{counter-reset:s;display:grid;gap:12px;margin:0;padding:0}
.steps>li{list-style:none;display:grid;grid-template-columns:2.2em minmax(0,1fr);gap:10px;align-items:start}
.steps>li::before{counter-increment:s;content:counter(s);font-family:var(--f-mono);font-weight:600;background:var(--navy);color:var(--surface);border-radius:50%;width:2em;height:2em;display:grid;place-items:center;font-size:13px}
.steps .sbody{display:grid;gap:8px;min-width:0}

/* documents */
.docs{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));gap:12px}
.doc{border:1px solid var(--line);border-top:3px solid var(--water);border-radius:12px;padding:12px 14px;display:grid;gap:8px;background:var(--surface);align-content:start;min-width:0}
.doc.tool{border-top-color:var(--laterite)}
.doc .dt{display:flex;gap:10px;align-items:baseline}
.doc .dt b{font-size:14.5px;line-height:1.3}
.doc small{font-family:var(--f-mono);font-size:11px;color:var(--muted);overflow-wrap:anywhere}

/* QCM */
.q{display:grid;gap:10px}
.opt{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;text-align:left;width:100%;background:var(--surface);color:var(--ink);border:1.5px solid var(--line);border-radius:10px;padding:10px 12px;line-height:1.4;font-weight:500}
.opt:hover:not([disabled]){border-color:var(--tab-act)}
.opt .k{font-family:var(--f-mono);font-weight:600;width:1.8em;height:1.8em;border-radius:6px;display:grid;place-items:center;background:var(--chip);border:1px solid var(--line);font-size:12px}
.opt.sel{border-color:var(--tab-act);background:color-mix(in srgb,var(--tab-act) 10%,var(--surface))}
.opt.good{border-color:var(--good);background:color-mix(in srgb,var(--good) 11%,var(--surface))}
.opt.bad{border-color:var(--bad);background:color-mix(in srgb,var(--bad) 10%,var(--surface))}
.opt[disabled]{cursor:default}
.score{font-family:var(--f-mono);font-weight:600;font-size:2.4rem;line-height:1;font-variant-numeric:tabular-nums}
.timer{font-family:var(--f-mono);font-weight:600;font-variant-numeric:tabular-nums}
.confirm{border-left:4px solid var(--sun);background:color-mix(in srgb,var(--sun) 12%,var(--surface));border-radius:6px;padding:10px 12px;display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.conv{display:grid;gap:10px}
.convout{font-family:var(--f-mono);background:var(--code);color:var(--codeink);padding:10px 12px;border-radius:8px;overflow-wrap:anywhere;min-height:2.6em}

/* footer */
footer{border-top:1px solid var(--line);padding-top:14px;font-size:12.5px;color:var(--muted);display:grid;gap:4px}
.flinks{display:flex;flex-wrap:wrap;gap:6px 16px;margin-top:4px;align-items:center}.flinks a{color:var(--water);font-weight:700}
.sel{user-select:all;font-family:var(--f-mono);color:var(--ink)}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(18px + env(safe-area-inset-bottom,0px));background:var(--hero);color:#fff;padding:9px 16px;border-radius:999px;font-size:13.5px;z-index:20;box-shadow:0 6px 24px rgba(0,0,0,.25)}

@media (max-width:900px){.hero{grid-template-columns:1fr}body.sub .herowrap{display:none}}
@media (max-width:600px){
  body{font-size:14.5px}
  .brand b{font-size:15px}.right{width:100%}
  nav.tabs .wrap{gap:6px}nav.tabs button{padding:6px 10px;font-size:12.5px}
  .card{padding:12px}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.kpi{padding:10px 12px}.kpi b{font-size:19px}
  .status .grid b{font-size:18px}
  th,td{padding:6px 7px;font-size:12.5px}
}
@media (prefers-reduced-motion:no-preference){.card,details,.tnode{transition:border-color .15s}}
.thead .linkbtn{color:#9cc3e6}.thead .pbref{background:rgba(255,255,255,.14);color:#e6d4ff}

.ctrls{display:flex;gap:8px;align-items:center}
.seg{display:inline-flex;background:rgba(255,255,255,.18);border-radius:8px;padding:3px;gap:2px}
.seg button{background:transparent;color:var(--top-ink);border:0;border-radius:6px;padding:4px 10px;font:700 12px var(--f-ui)}
.seg button[aria-pressed="true"]{background:#fff;color:#1e2d4d}
.pcode.qtag{background:color-mix(in srgb,var(--water) 14%,transparent);color:var(--water)}
.pcode.tag-ok{background:color-mix(in srgb,var(--good) 14%,transparent);color:var(--good)}
.pcode.tag-bad{background:color-mix(in srgb,var(--bad) 14%,transparent);color:var(--bad)}
.chip.answered{border-color:var(--good)}
.cmd-note .linkbtn{color:#ffd88a}

</style>

</head>
<body>
<header class="top">
  <div class="wrap">
    <div class="brand">
      <span class="logo" aria-hidden="true"><svg width="22" height="22" viewBox="0 0 24 24"><rect x="2.5" y="4" width="19" height="16" rx="3" fill="#1e2d4d"/><path d="M6.5 9.5l3 2.5-3 2.5" stroke="#9cc3e6" stroke-width="1.9" fill="none" stroke-linecap="round" stroke-linejoin="round"/><path d="M11.5 15h6" stroke="#d39a2c" stroke-width="1.9" stroke-linecap="round"/></svg></span>
      <div><b><span id="brandT">Parcours WSL - Python pour les données climatiques</span><sup>v2.0</sup></b><small>Université de Labé · FST | UCAD · ESP · LPAO-SF</small></div>
    </div>
    <div class="right">
      <div class="links">
        <a href="https://ibrahimadiouf.com/" target="_blank" rel="noopener">Dr Ibrahima Diouf</a>
        <a href="https://huggingface.co/idiouf" target="_blank" rel="noopener">Hugging Face</a>
        <a href="https://www.linkedin.com/in/dr-ibrahima-diouf-610872108/" target="_blank" rel="noopener">LinkedIn</a>
      </div>
      <div class="ctrls"><span class="seg" role="group" aria-label="Langue / Language"><button type="button" data-lang="fr" aria-pressed="true">FR</button><button type="button" data-lang="en" aria-pressed="false">EN</button></span>
      <button class="thb" id="themeBtn" type="button" aria-label="Changer de thème">☾</button></div>
    </div>
  </div>
</header>

<nav class="tabs" aria-label="Sections"><div class="wrap" id="nav"></div></nav>

<div class="wrap herowrap">
  <section class="hero">
    <div>
      <div class="eyebrow" id="heroEy">WSL 2 · Ubuntu · conda · Python · CDO</div>
      <h1 id="heroH">Installer Linux sous Windows et préparer Python pour les données climatiques</h1>
      <p id="heroP">Douze tutoriels pas à pas, de l'activation de la virtualisation à l'environnement geoenv : chaque commande expliquée, l'endroit exact où la taper, ce qui doit s'afficher, et la solution de chaque erreur rencontrée par les étudiants.</p>
      <div class="authors"><b>Dr Ibrahima Diouf</b><span class="aff" id="heroAff">Faculté des Sciences et Techniques (FST), Université de Labé, Guinée ; LPAO-SF, ESP, UCAD, Dakar, Sénégal</span></div>
      <div class="pills" id="heroPills"><span>Windows 10 (2004+) ou 11</span><span>Ubuntu en WSL 2</span><span>Miniconda · conda-forge</span><span>Python 3.11 · geoenv</span></div>
    </div>
    <div class="status" id="status"></div>
  </section>
</div>

<main class="wrap">
  <div id="view"></div>
  <footer>
    <div id="foot1">Dr Ibrahima Diouf, Faculté des Sciences et Techniques (FST), Université de Labé, Hafia, Labé, Guinée ; Laboratoire de Physique de l'Atmosphère et de l'Océan - Siméon Fongang (LPAO-SF), École Supérieure Polytechnique (ESP), Université Cheikh Anta Diop (UCAD), Dakar, Sénégal.</div>
    <div id="foot2">Parcours WSL - Python pour les données climatiques, version 2.0, novembre 2026. La progression et les résultats de QCM restent dans votre navigateur ; aucune donnée n'est transmise.</div>
    <div class="flinks"><a href="https://ibrahimadiouf.com/" target="_blank" rel="noopener">ibrahimadiouf.com</a><a href="https://huggingface.co/idiouf" target="_blank" rel="noopener">huggingface.co/idiouf</a><a href="https://www.linkedin.com/in/dr-ibrahima-diouf-610872108/" target="_blank" rel="noopener">LinkedIn</a><span class="sel">ibrahima23.diouf@ucad.edu.sn</span><button type="button" class="mini" id="footCopy" data-copy="ibrahima23.diouf@ucad.edu.sn">Copier</button></div>
  </footer>
</main>
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>

<script>
const DATA={"fr":{"files":{"pdf":{"05":{"name":"Tutoriel_05_Installer_Miniconda_et_creer_lenvironnement_geoenv.pdf","size":221510},"03":{"name":"Tutoriel_03_Naviguer_entre_Ubuntu_et_Windows_commandes_de_base.pdf","size":225064},"02":{"name":"Tutoriel_02_Premier_demarrage_et_mise_a_jour_Ubuntu.pdf","size":194274},"09":{"name":"Tutoriel_09_Mode_demploi_des_trois_outils_du_cours.pdf","size":158812},"01A":{"name":"Tutoriel_01A_Activer_la_virtualisation_dans_le_BIOS.pdf","size":163956},"00":{"name":"Tutoriel_00_Guide_du_parcours_A_LIRE_EN_PREMIER.pdf","size":156806},"03A":{"name":"Tutoriel_03A_Commandes_Ubuntu.pdf","size":430759},"07":{"name":"Tutoriel_07_Aide-memoire_commandes_WSL_Ubuntu_Conda_CDO.pdf","size":189725},"04":{"name":"Tutoriel_04_Creer_ses_raccourcis_de_commandes_alias.pdf","size":182864},"01":{"name":"Tutoriel_01_Installer_WSL2_et_Ubuntu_sous_Windows.pdf","size":168480},"08":{"name":"Tutoriel_08_Depannage_general_et_FAQ.pdf","size":256375},"06":{"name":"Tutoriel_06_Installer_les_packages_Python_climat_et_donnees.pdf","size":248727}},"tools":{"outil_04_installer_alias.sh":{"name":"outil_04_installer_alias.sh","size":2886},"outil_06_verifier_geoenv.py":{"name":"outil_06_verifier_geoenv.py","size":5799},"outil_05_geoenv.yml":{"name":"outil_05_geoenv.yml","size":1444}},"zip":{"name":"Parcours_WSL_Python_Climat_Tutoriels_PDF_et_outils.zip","size":1388633}},"tutos":[{"num":"00","title":"Guide du parcours (à lire en premier)","sub":"Organisation des tutoriels, configuration minimale du PC, conventions de lecture et méthode pour demander de l'aide.","obj":"Comprendre l'ordre des tutoriels, vérifier que votre ordinateur est compatible et apprendre à lire les encadrés.","dur":"10 à 15 minutes","pre":"Aucun.","ou":"Aucune commande dans ce tutoriel (sauf la vérification de la version de Windows).","fin":"Une vision claire du parcours et un PC dont vous savez s'il est prêt.","blocks":[{"h":"1. À quoi sert ce parcours ?","i":[{"k":"p","t":"Ce parcours installe sur votre ordinateur Windows un véritable système Linux (Ubuntu) grâce à **WSL 2** (Windows Subsystem for Linux, le sous-système Windows pour Linux), puis un environnement Python complet pour traiter les données climatiques et géographiques (fichiers NetCDF, GeoTIFF, shapefiles, cartes, statistiques, tableaux de bord)."},{"k":"p","t":"**Pourquoi Linux ?** Les principaux outils du climat (CDO, NCO, xESMF, ESMF) sont conçus pour Linux, et ce sont les mêmes commandes que sur les serveurs de calcul et les centres HPC. Avec WSL, vous gardez Windows et vous ajoutez Linux à côté : rien n'est effacé."}]},{"h":"2. Votre ordinateur est-il compatible ?","i":[{"k":"table","h":["Élément","Minimum","Recommandé","Comment vérifier"],"r":[["Windows","Windows 10 version 2004 (build 19041)","Windows 11 à jour","Touches Windows + R, taper `winver`, Entrée"],["Type de système","64 bits","64 bits","Paramètres > Système > Informations système"],["Mémoire vive (RAM)","4 Go (lent)","8 Go ou plus","Même écran « Informations système »"],["Espace libre sur C:","15 Go","30 Go ou plus","Explorateur > Ce PC"],["Virtualisation","Activée","Activée","Ctrl + Maj + Échap > Performances > Processeur > « Virtualisation »"],["Droits","Administrateur du PC","Administrateur du PC","Vous pouvez installer des logiciels"],["Internet","3 à 5 Go à télécharger au total","Connexion stable","Prévoir un lieu avec une bonne connexion"]]},{"k":"note","n":"warn","t":"Sur un ordinateur de l'université ou d'une entreprise, vous n'avez souvent pas les droits administrateur : demandez au service informatique avant la séance, ou utilisez votre ordinateur personnel."},{"k":"note","n":"tip","t":"Vous êtes sur Mac ou déjà sur Linux ? Ignorez les tutoriels 01 et 02. Ouvrez simplement le Terminal et commencez au tutoriel 03 (sauf les parties « Windows »), puis au tutoriel 05 avec l'installateur Miniconda pour votre système (voir tutoriel 08, FAQ). Les Chromebooks ne sont pas pris en charge par ce parcours."}]},{"h":"3. Les deux endroits où taper les commandes","i":[{"k":"p","t":"Chaque commande est présentée dans un encadré, précédé de l'endroit exact où la taper. Il existe deux endroits différents. **Les confondre est l'erreur la plus fréquente des débutants.**"},{"k":"table","h":["Endroit","Comment l'ouvrir","Comment le reconnaître (début de ligne)"],"r":[["PowerShell (Administrateur)","Menu Démarrer > taper « PowerShell » > clic droit > Exécuter en tant qu'administrateur","`PS C:\\Windows\\system32>` et le titre de fenêtre commence par « Administrateur »"],["PowerShell (normal)","Menu Démarrer > « PowerShell » > Entrée","`PS C:\\Users\\VotreNom>`"],["Ubuntu (terminal WSL)","Menu Démarrer > « Ubuntu » > Entrée","`ibrahima@NOM-DU-PC:~$` (en vert et bleu)"],["Ubuntu avec geoenv actif","Dans Ubuntu : `conda activate geoenv`","`(geoenv) ibrahima@NOM-DU-PC:~$`"]]}]},{"h":"4. Règles de saisie","i":[{"k":"ul","i":["Ne tapez jamais le début de ligne (`PS C:\\...>` ou `ibrahima@PC:~$`) : il est affiché par l'ordinateur.","Remplacez ce qui est entre chevrons, chevrons compris : `<VotreNom>` devient par exemple `Aminata`.","Une commande = une seule ligne. Si une commande longue apparaît sur deux lignes, tapez-la sur une seule ligne, avec un espace à l'endroit de la coupure.","Les lignes qui commencent par `#` sont des commentaires : inutile de les taper.","Appuyez sur Entrée après chaque commande et attendez que le début de ligne réapparaisse avant de taper la suivante.","Dans Ubuntu, les majuscules et minuscules comptent : `Documents` et `documents` sont deux noms différents.","Quand Ubuntu demande un mot de passe, rien ne s'affiche pendant la saisie (ni lettres, ni étoiles). C'est normal : tapez-le puis Entrée."]},{"k":"table","h":["Action","Dans le terminal Ubuntu","Remarque"],"r":[["Coller","Clic droit, ou Ctrl + Maj + V","Ctrl + V seul ne fonctionne pas toujours"],["Copier","Sélectionner à la souris puis Ctrl + Maj + C","Ctrl + C sert à interrompre une commande"]]},{"k":"note","n":"warn","t":"Le copier-coller depuis un PDF peut transformer les apostrophes droites ' en apostrophes typographiques ‘ ’ et couper les lignes. Si une commande copiée échoue, retapez-la à la main ou utilisez les fichiers outil_... fournis. Dans ce tableau de bord, le bouton **Copier** copie la commande exacte, sans ce problème."}]},{"h":"5. Les encadrés de couleur","i":[{"k":"note","n":"ok","t":"**Résultat attendu** : ce que vous devez voir si tout s'est bien passé."},{"k":"note","n":"warn","t":"**Attention** : un point où les étudiants se trompent souvent."},{"k":"note","n":"tip","t":"**Astuce** : un raccourci ou une bonne pratique."},{"k":"note","n":"danger","t":"**Danger** : une commande qui peut effacer des données. Lisez deux fois avant de l'exécuter."},{"k":"note","n":"fail","t":"**Si ça ne marche pas** : renvoi vers le problème correspondant, par exemple « voir Problème P1.2 » (P1 = tutoriel 01, problème n° 2)."}]},{"h":"6. Les règles d'or","i":[{"k":"ul","i":["**Lisez le message d'erreur**, surtout les dernières lignes : il indique presque toujours la cause.","**Ne passez pas à l'étape suivante si l'étape en cours a échoué** : les erreurs s'additionnent.","**Ne mettez jamais `sudo` devant `conda` ou `pip`.** `sudo` sert uniquement aux commandes `apt` (installation de logiciels Ubuntu).","**N'installez pas les bibliothèques Python avec pip dans le système.** Tout se fait dans l'environnement geoenv (tutoriels 05 et 06).","**En cas de comportement bizarre**, le remède universel : fermer Ubuntu, taper `wsl --shutdown` dans PowerShell, rouvrir Ubuntu. Si cela ne suffit pas : redémarrer le PC.","**Pas de corbeille sous Linux** : un fichier supprimé avec `rm` est perdu définitivement, y compris dans vos dossiers Windows."]}]},{"h":"7. Comment demander de l'aide efficacement","i":[{"k":"p","t":"Avant de demander de l'aide, cherchez le message d'erreur dans la section « Problèmes fréquents » du tutoriel en cours, puis dans l'onglet **Dépannage** (index du tutoriel 08). Si le problème persiste, envoyez un message contenant ces cinq éléments :"},{"k":"cmd","w":"msg","c":"1. Tutoriel et étape : Tutoriel 05, étape 7\n2. Commande tapée : conda create -n geoenv ...\n3. Message d'erreur COMPLET (copié en texte, pas une photo floue)\n4. Résultat de : wsl -l -v (dans PowerShell)\n   et, si conda est concerné : conda info (dans Ubuntu)\n5. Ce que vous avez déjà essayé"},{"k":"note","n":"tip","t":"Une capture d'écran nette (touches Windows + Maj + S) est acceptée, mais le texte copié est plus utile : il peut être recherché et recopié."}]}],"check":["Ma version de Windows est Windows 11, ou Windows 10 version 2004 ou plus récente (winver).","Mon système est en 64 bits.","J'ai au moins 15 Go libres sur le disque C:.","La virtualisation est « Activée » dans le Gestionnaire des tâches (sinon, voir tutoriel 01A).","Je suis administrateur de mon ordinateur.","Je dispose d'une connexion Internet correcte pour 1 à 2 heures.","Je sais distinguer PowerShell et le terminal Ubuntu."],"faq":[],"ver":"Version 2.0 - septembre 2026","part":"guide"},{"num":"01A","title":"Activer la virtualisation dans le BIOS","sub":"Vérifier si la virtualisation est activée et, si elle est « Désactivé », l'activer dans le BIOS (HP, Lenovo, Dell, Asus, Acer, MSI...). À faire avant le tutoriel 01.","obj":"Obtenir « Virtualisation : Activé » dans le Gestionnaire des tâches, condition indispensable pour WSL 2.","dur":"10 à 20 minutes, dont un ou deux redémarrages.","pre":"Tutoriel 00 lu. Être propriétaire du PC (ou avoir l'accord du propriétaire).","ou":"Dans Windows (vérification) puis dans le BIOS (écran de configuration du PC, avant le démarrage de Windows).","fin":"La ligne « Virtualisation : Activé » dans le Gestionnaire des tâches.","blocks":[{"h":"Pourquoi ce tutoriel ?","i":[{"k":"p","t":"WSL 2 fait tourner Ubuntu dans une petite machine virtuelle. Pour cela, la **virtualisation du processeur** doit être activée. Sur beaucoup d'ordinateurs portables, elle est désactivée par défaut dans le **BIOS** (ou UEFI), le petit programme qui démarre le PC avant Windows. Sans elle, l'installation de WSL échoue avec l'erreur `0x80370102`."},{"k":"note","n":"ok","t":"Si la virtualisation est déjà « Activé » sur votre PC, vous n'avez rien à faire : passez directement au tutoriel 01."}]},{"h":"Étape 1 - Vérifier l'état de la virtualisation","i":[{"k":"ul","i":["Appuyez en même temps sur **Ctrl + Maj + Échap** : le Gestionnaire des tâches s'ouvre.","Si la fenêtre est petite, cliquez sur **Plus de détails** en bas à gauche.","Ouvrez **Performances** (onglet en haut sous Windows 10, icône en forme de courbe à gauche sous Windows 11), puis cliquez sur **Processeur**.","En bas à droite, lisez la ligne **Virtualisation**."]},{"k":"table","h":["Ce que vous lisez","Signification","Que faire"],"r":[["Virtualisation : Activé","Tout est prêt","Rien. Passez au tutoriel 01"],["Virtualisation : Désactivé et « Prise en charge d'Hyper-V : Oui »","Le processeur est compatible, mais l'option est coupée dans le BIOS","Suivez les étapes 2 à 6"],["Pas de ligne « Virtualisation »","Windows l'utilise peut-être déjà","Faites la vérification par commande ci-dessous"]]},{"k":"p","t":"**Vérification par commande (si nécessaire)** : ouvrez PowerShell et tapez :"},{"k":"cmd","w":"ps","c":"systeminfo"},{"k":"p","t":"Attendez quelques secondes et lisez les dernières lignes : « Virtualisation activée dans le microprogramme : Oui » ou « Un hyperviseur a été détecté » signifie que tout est prêt. « Non » signifie qu'il faut suivre les étapes 2 à 6."}]},{"h":"Étape 2 - Se préparer","i":[{"k":"ul","i":["Enregistrez vos documents et fermez vos applications : le PC va redémarrer.","Branchez le chargeur.","Notez la marque et le modèle du PC (étiquette sous le PC, ou Paramètres > Système > Informations système). Exemple : Lenovo IdeaPad 320, HP ProBook 450 G5, Dell Latitude 5490.","Vérifiez **BitLocker** (chiffrement du disque) : voir Problème P1A.5 avant d'aller plus loin.","Dans le BIOS, la souris ne fonctionne souvent pas : on se déplace avec les **flèches** du clavier, on valide avec **Entrée**, on revient en arrière avec **Échap**."]},{"k":"note","n":"danger","t":"Dans le BIOS, ne modifiez **que** l'option de virtualisation. Ne touchez à rien d'autre (démarrage, sécurité, disques, mots de passe). En cas de doute, quittez sans enregistrer : **Exit Without Saving** (ou Échap, puis « Discard Changes »)."}]},{"h":"Étape 3 - Entrer dans le BIOS","i":[{"k":"p","t":"**Méthode A (recommandée, fonctionne sur tous les PC récents) : depuis Windows**"},{"k":"ul","i":["**Windows 11** : Paramètres > Système > Récupération > « Démarrage avancé » > Redémarrer maintenant.","**Windows 10** : Paramètres > Mise à jour et sécurité > Récupération > « Démarrage avancé » > Redémarrer maintenant.","Sur l'écran bleu, choisissez **Dépannage > Options avancées > Paramètres du microprogramme UEFI > Redémarrer**."]},{"k":"note","n":"ok","t":"Le PC redémarre directement sur l'écran du BIOS (souvent bleu, gris ou noir, en anglais)."},{"k":"note","n":"tip","t":"Si « Paramètres du microprogramme UEFI » n'apparaît pas, votre PC fonctionne en mode ancien (Legacy) : utilisez la méthode B."},{"k":"p","t":"**Méthode B : avec une touche au démarrage.** Éteignez complètement le PC. Rallumez-le et appuyez plusieurs fois de suite (environ deux fois par seconde) sur la touche de votre marque, dès que l'écran s'allume :"},{"k":"table","h":["Marque","Touche à presser au démarrage","Remarque"],"r":[["HP","Échap, puis F10 dans le menu qui apparaît","Menu « Startup Menu »"],["Lenovo ThinkPad","Entrée, puis F1","Écran « ThinkPad » au démarrage"],["Lenovo IdeaPad, Yoga, V","F2 ou Fn + F2","Ou le bouton Novo (voir ci-dessous)"],["Dell","F2","F12 ouvre un menu d'où choisir « BIOS Setup »"],["Asus","F2 (portables) ou Suppr (ordinateurs de bureau)","En mode « EZ Mode », appuyez sur F7 pour le mode avancé"],["Acer","F2",""],["MSI","Suppr",""],["Toshiba / Dynabook, Samsung, Fujitsu","F2",""],["Microsoft Surface","Maintenir Volume + puis appuyer sur Marche","Virtualisation généralement déjà activée"]]},{"k":"p","t":"**Bouton Novo (Lenovo IdeaPad, Yoga)** : PC éteint, appuyez avec la pointe d'un trombone dans le petit trou (ou sur le petit bouton) marqué d'une flèche courbe, sur le côté ou près de la prise d'alimentation. Dans le menu « Novo Button Menu », choisissez **BIOS Setup** avec les flèches, puis Entrée."},{"k":"note","n":"fail","t":"Windows démarre normalement sans entrer dans le BIOS : voir Problème P1A.2."}]},{"h":"Étape 4 - Trouver et activer l'option","i":[{"k":"p","t":"L'option porte un de ces noms : **Intel Virtualization Technology, Intel VT-x, VTx, Virtualization Technology, Intel Virtual Technology** (processeurs Intel), ou **SVM Mode, AMD-V, AMD SVM Technology** (processeurs AMD). Voici où la trouver :"},{"k":"table","h":["Marque","Chemin dans le BIOS","Réglage"],"r":[["HP","Advanced > System Options (ou Configuration, ou Security > System Security)","Cocher Virtualization Technology (VTx)"],["Lenovo ThinkPad","Security > Virtualization","Intel Virtualization Technology : Enabled"],["Lenovo IdeaPad, Yoga, V","Configuration","Intel Virtual Technology (ou AMD SVM Technology) : Enabled"],["Dell","Virtualization Support > Virtualization (ou Virtualization dans la liste de gauche)","Cocher Enable Intel Virtualization Technology"],["Asus","Advanced > CPU Configuration (Intel) ou Advanced > SVM Mode (AMD)","Enabled"],["Acer","Advanced (ou Main)","Intel Virtualization Technology : Enabled"],["MSI","OC > CPU Features (ou Advanced > CPU Configuration)","Intel Virtualization Tech ou SVM Mode : Enabled"]]},{"k":"p","t":"**Pour changer la valeur** : placez-vous sur l'option avec les flèches, appuyez sur Entrée, choisissez **Enabled**, puis Entrée. Sur certains BIOS, on utilise +/-, F5/F6, ou la barre d'espace pour cocher."},{"k":"p","t":"**Exemple 1** : Lenovo IdeaPad avec Intel Core i5 : F2 au démarrage > onglet Configuration (flèche droite) > descendre sur Intel Virtual Technology > Entrée > Enabled > Entrée."},{"k":"p","t":"**Exemple 2** : HP ProBook : Échap puis F10 > onglet Advanced > System Options > cocher Virtualization Technology (VTx) avec la barre d'espace."},{"k":"note","n":"fail","t":"Option introuvable ou grisée : voir Problème P1A.3."}]},{"h":"Étape 5 - Enregistrer et redémarrer","i":[{"k":"ul","i":["Appuyez sur **F10** (Save and Exit), puis choisissez **Yes** et Entrée.","Si F10 ne fonctionne pas : allez dans l'onglet **Exit > Save Changes and Exit** (ou Exit Saving Changes) > Yes.","Le PC redémarre sur Windows. Il peut redémarrer deux fois : c'est normal."]},{"k":"note","n":"fail","t":"Windows demande une « clé de récupération BitLocker » : voir Problème P1A.5."}]},{"h":"Étape 6 - Vérifier de nouveau","i":[{"k":"p","t":"Refaites l'étape 1 : Ctrl + Maj + Échap > Performances > Processeur."},{"k":"note","n":"ok","t":"Virtualisation : **Activé**. Vous pouvez passer au tutoriel 01, étape 3."}]},{"h":"Étape 7 - (Seulement si WSL affiche encore l'erreur 0x80370102)","i":[{"k":"p","t":"Si la virtualisation est « Activé » mais que l'installation de WSL affiche encore l'erreur `0x80370102`, ouvrez PowerShell en administrateur et tapez ces deux commandes, l'une après l'autre :"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart\nbcdedit /set hypervisorlaunchtype auto"},{"k":"p","t":"Redémarrez le PC, puis reprenez le tutoriel 01, étape 4."}]}],"check":["Le Gestionnaire des tâches affiche « Virtualisation : Activé ».","Je n'ai modifié aucune autre option du BIOS.","Windows démarre normalement."],"faq":[{"q":"Activer la virtualisation est-il dangereux pour mon PC ?","a":"Non. C'est une fonction normale du processeur, activée d'origine sur de nombreux PC. Elle n'abîme rien et ne ralentit pas Windows."},{"q":"Faut-il refaire cette opération plus tard ?","a":"Non, le réglage est conservé. Une mise à jour du BIOS peut exceptionnellement le remettre à zéro : refaites alors l'étape 1 pour vérifier."},{"q":"Mon PC est un Mac. Suis-je concerné ?","a":"Non. Ce tutoriel et WSL ne concernent que Windows (voir tutoriel 08, FAQ)."}],"ver":"Version 2.0 - septembre 2026","part":"install"},{"num":"01","title":"Installer WSL 2 et Ubuntu sous Windows","sub":"Activer le sous-système Windows pour Linux, installer Ubuntu et vérifier que tout fonctionne en WSL 2.","obj":"Installer WSL 2 et la distribution Ubuntu sur Windows 10 ou 11.","dur":"30 à 60 minutes, dont un redémarrage et le téléchargement (environ 500 Mo à 1 Go).","pre":"Tutoriel 00 lu ; point de contrôle du tutoriel 00 coché ; droits administrateur.","ou":"PowerShell (Administrateur) pour tout ce tutoriel.","fin":"La commande `wsl -l -v` affiche « Ubuntu » avec la VERSION 2.","blocks":[{"h":"Étape 1 - Vérifier la version de Windows","i":[{"k":"ul","i":["Appuyez sur les touches **Windows + R**, tapez `winver`, puis Entrée.","Windows 11 : parfait. Windows 10 : la version doit être **2004 ou plus** (build 19041 ou plus)."]},{"k":"note","n":"fail","t":"Version plus ancienne : voir Problème P1.1."}]},{"h":"Étape 2 - Vérifier que la virtualisation est activée","i":[{"k":"ul","i":["Appuyez sur **Ctrl + Maj + Échap** pour ouvrir le Gestionnaire des tâches.","Onglet **Performances**, puis **Processeur**.","En bas à droite, lisez la ligne **Virtualisation**."]},{"k":"note","n":"ok","t":"« Virtualisation : Activé »."},{"k":"note","n":"fail","t":"« Désactivé » : il faut l'activer dans le BIOS avant de continuer : suivez le tutoriel 01A (et le Problème P1.2)."}]},{"h":"Étape 3 - Ouvrir PowerShell en mode Administrateur","i":[{"k":"ul","i":["Cliquez sur le menu Démarrer et tapez « PowerShell ».","Faites un **clic droit** sur « Windows PowerShell » et choisissez **Exécuter en tant qu'administrateur**.","Répondez **Oui** à la question « Voulez-vous autoriser cette application à apporter des modifications ? »."]},{"k":"note","n":"ok","t":"Le titre de la fenêtre commence par « Administrateur : Windows PowerShell » et la ligne se termine par `PS C:\\Windows\\system32>`."},{"k":"note","n":"fail","t":"Windows demande un mot de passe administrateur que vous n'avez pas : voir Problème P1.3."},{"k":"note","n":"tip","t":"Sur Windows 11, vous pouvez aussi faire un clic droit sur le bouton Démarrer et choisir « Terminal (administrateur) »."}]},{"h":"Étape 4 - Installer WSL et Ubuntu (méthode recommandée)","i":[{"k":"p","t":"Tapez cette seule commande :"},{"k":"cmd","w":"psa","c":"wsl --install -d Ubuntu"},{"k":"p","t":"Windows active les composants nécessaires, télécharge le noyau Linux et la distribution Ubuntu. Cela prend de 5 à 20 minutes selon la connexion. **Ne fermez pas la fenêtre.**"},{"k":"note","n":"ok","t":"Des lignes « Installation de : Plateforme de machine virtuelle », « Installation de : Sous-système Windows pour Linux », « Téléchargement de : Ubuntu », puis « L'opération demandée a réussi. Les modifications ne seront pas effectives avant le redémarrage du système. »"},{"k":"note","n":"fail","t":"La commande affiche seulement une longue liste d'options (aide de wsl) : voir Problème P1.1. Un code d'erreur 0x8... : cherchez-le dans les problèmes P1.2 à P1.6. Si rien ne fonctionne, utilisez la méthode manuelle (étape 4 bis)."}]},{"h":"Étape 4 bis - Méthode manuelle (uniquement si l'étape 4 a échoué)","i":[{"k":"p","t":"Tapez les deux commandes suivantes, l'une après l'autre (chacune sur une seule ligne) :"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart\ndism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"},{"k":"note","n":"ok","t":"Pour chacune : une barre de progression jusqu'à 100 % et « L'opération a réussi. »"},{"k":"p","t":"Redémarrez l'ordinateur (étape 5), rouvrez PowerShell en Administrateur, puis tapez :"},{"k":"cmd","w":"psa","c":"wsl --update\nwsl --set-default-version 2\nwsl --install -d Ubuntu"}]},{"h":"Étape 5 - Redémarrer l'ordinateur","i":[{"k":"p","t":"Enregistrez vos documents ouverts, puis **Démarrer > Marche/Arrêt > Redémarrer**. Cette étape est indispensable."},{"k":"note","n":"warn","t":"Choisissez bien « Redémarrer » et non « Arrêter » : avec le démarrage rapide de Windows, « Arrêter » puis rallumer ne finalise pas toujours l'installation."}]},{"h":"Étape 6 - Premier lancement d'Ubuntu","i":[{"k":"p","t":"Après le redémarrage, une fenêtre Ubuntu s'ouvre souvent toute seule avec le message « Installing, this may take a few minutes... ». Si elle ne s'ouvre pas, cliquez sur Démarrer, tapez « Ubuntu » puis Entrée."},{"k":"p","t":"Quand la fenêtre affiche `Enter new UNIX username:`, passez au **tutoriel 02, étape 2** pour créer votre compte Linux, puis revenez ici pour l'étape 7."},{"k":"note","n":"fail","t":"La fenêtre s'ouvre et se referme aussitôt, ou affiche un code d'erreur : voir Problème P1.10."}]},{"h":"Étape 7 - Vérifier l'installation","i":[{"k":"p","t":"Dans une fenêtre PowerShell (normale ou administrateur), tapez :"},{"k":"cmd","w":"ps","c":"wsl -l -v"},{"k":"out","t":"  NAME      STATE           VERSION\n* Ubuntu    Running         2"},{"k":"note","n":"ok","t":"Une ligne « Ubuntu » (ou « Ubuntu-24.04 ») avec **VERSION 2**. L'état peut être « Running » (en marche) ou « Stopped » (arrêté) : les deux sont normaux."},{"k":"note","n":"fail","t":"VERSION 1 : voir Problème P1.7. Message « aucune distribution installée » : voir Problème P1.8."}]},{"h":"Étape 8 - Mettre WSL à jour et noter sa version","i":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --version"},{"k":"out","t":"Version WSL : 2.x.x.x\nVersion du noyau : 6.x.x.x\nVersion WSLg : 1.x.x\nVersion de Windows : 10.0.2xxxx.xxxx"},{"k":"note","n":"fail","t":"`wsl --version` renvoie une erreur ou la liste des options : voir Problème P1.9."},{"k":"note","n":"tip","t":"Gardez une copie de ce résultat : il est demandé quand on sollicite de l'aide (tutoriel 00, section 7)."}]}],"check":["`wsl -l -v` affiche Ubuntu avec VERSION 2.","`wsl --version` affiche une version WSL 2.x.","J'ai ouvert Ubuntu depuis le menu Démarrer et créé mon compte (tutoriel 02, étapes 1 à 3)."],"faq":[{"q":"Faut-il Windows Professionnel ?","a":"Non. Windows 10 ou 11 Famille suffit."},{"q":"Est-ce que cela efface Windows ou mes fichiers ?","a":"Non. Ubuntu s'installe à côté de Windows, comme une application. Vos fichiers Windows restent intacts et accessibles depuis Ubuntu (tutoriel 03)."},{"q":"Combien d'espace disque est utilisé ?","a":"Environ 2 à 3 Go pour Ubuntu, puis 5 à 8 Go pour Miniconda et l'environnement geoenv (tutoriels 05 et 06)."},{"q":"Quelle version d'Ubuntu choisir ?","a":"Celle installée par défaut (une version LTS, à support long, par exemple 24.04). La commande `wsl --list --online` affiche les versions disponibles si vous devez en choisir une précise."},{"q":"Le Microsoft Store est bloqué sur mon PC. Puis-je quand même installer Ubuntu ?","a":"Oui, avec l'option `--web-download` (Problème P1.6)."},{"q":"J'ai déjà VirtualBox, VMware ou un émulateur Android. Y a-t-il un conflit ?","a":"Les versions récentes de ces logiciels fonctionnent avec WSL 2. Mettez-les à jour. Une version très ancienne de VirtualBox peut devenir lente ou refuser de démarrer ses machines."},{"q":"Dois-je refaire ce tutoriel à chaque utilisation ?","a":"Non. L'installation se fait une seule fois. Ensuite, il suffit d'ouvrir « Ubuntu » depuis le menu Démarrer."}],"ver":"Version 2.0 - septembre 2026","part":"install"},{"num":"02","title":"Premier démarrage et mise à jour d'Ubuntu","sub":"Créer son compte Linux, mettre le système à jour et installer les outils de base (éditeurs de texte, visionneuse d'images).","obj":"Configurer Ubuntu au premier lancement et le préparer pour la suite du parcours.","dur":"20 à 40 minutes (la mise à jour dépend de la connexion).","pre":"Tutoriel 01 terminé (Ubuntu installé en WSL 2).","ou":"Ubuntu (terminal WSL), sauf mention contraire.","fin":"Un compte Linux avec mot de passe, un Ubuntu à jour, les outils wget, git, nano, gedit, eog... installés.","blocks":[{"h":"Étape 1 - Lancer Ubuntu","i":[{"k":"ul","i":["Menu Démarrer, tapez « Ubuntu », puis Entrée ;","ou, dans le Terminal Windows, cliquez sur la petite flèche ˅ à côté de l'onglet et choisissez « Ubuntu » ;","ou, dans PowerShell, tapez simplement `wsl`."]},{"k":"p","t":"Au tout premier lancement, Ubuntu prépare son système : « Installing, this may take a few minutes... ». Patientez (1 à 5 minutes)."}]},{"h":"Étape 2 - Créer votre nom d'utilisateur Linux","i":[{"k":"p","t":"Ubuntu affiche : `Enter new UNIX username:`. Tapez un nom puis Entrée. Règles à respecter :"},{"k":"ul","i":["uniquement des **minuscules et des chiffres**, sans espace, sans accent, commençant par une lettre ;","court et facile à retenir : par exemple `ibrahima`, `adiallo`, `fatou2`."]},{"k":"note","n":"tip","t":"Ce nom n'a pas besoin d'être identique à votre nom Windows."},{"k":"note","n":"fail","t":"Message « adduser: Please enter a username matching the regular expression... » : voir Problème P2.1."}]},{"h":"Étape 3 - Créer votre mot de passe Linux","i":[{"k":"p","t":"Ubuntu affiche `New password:`. Tapez un mot de passe puis Entrée, puis retapez-le après `Retype new password:`."},{"k":"note","n":"warn","t":"Rien ne s'affiche pendant la saisie (ni lettres, ni étoiles) : c'est normal et voulu. Tapez calmement, puis Entrée."},{"k":"note","n":"warn","t":"Notez ce mot de passe dans un endroit sûr. Il sera demandé à chaque commande commençant par `sudo`. Il est **indépendant** de votre mot de passe Windows."},{"k":"out","t":"passwd: password updated successfully\nInstallation successful!\nibrahima@NOM-DU-PC:~$"},{"k":"p","t":"La dernière ligne est l'**invite de commande**. Elle se lit ainsi :"},{"k":"table","h":["Partie","Signification"],"r":[["ibrahima","votre nom d'utilisateur Linux"],["@NOM-DU-PC","le nom de votre ordinateur"],["~","le dossier où vous êtes ; `~` désigne votre dossier personnel `/home/ibrahima`"],["$","Ubuntu attend votre commande (`#` à la place de `$` signifie que vous êtes « root », voir Problème P2.12)"]]},{"k":"note","n":"fail","t":"« Sorry, passwords do not match » : recommencez, voir Problème P2.2."}]},{"h":"Étape 4 - Mettre Ubuntu à jour","i":[{"k":"p","t":"Tapez les deux commandes suivantes, l'une après l'autre :"},{"k":"cmd","w":"ub","c":"sudo apt update\nsudo apt upgrade -y"},{"k":"ul","i":["`sudo` exécute la commande avec les droits d'administrateur Linux : il demande votre mot de passe Linux (invisible). Il ne le redemande pas pendant environ 15 minutes.","`apt update` télécharge la liste des logiciels disponibles ; `apt upgrade -y` installe les mises à jour (`-y` répond « oui » automatiquement).","Durée : 2 à 15 minutes. Ne fermez pas la fenêtre pendant l'opération."]},{"k":"out","t":"Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease\n...\nReading package lists... Done\n...\nProcessing triggers for man-db ...\nibrahima@NOM-DU-PC:~$"},{"k":"note","n":"tip","t":"Si un écran violet ou bleu apparaît avec une question (par exemple « Which services should be restarted? »), appuyez simplement sur Entrée pour accepter le choix proposé."},{"k":"note","n":"fail","t":"« Temporary failure resolving » : P2.3 ; « Could not get lock » : P2.4 ; « dpkg was interrupted » : P2.5 ; « is not valid yet » : P2.6 ; blocage à « 0% [Connecting to...] » : P2.7."}]},{"h":"Étape 5 - Installer les outils de base","i":[{"k":"cmd","w":"ub","c":"sudo apt install -y build-essential wget curl git nano unzip zip tree htop dos2unix"},{"k":"table","h":["Outil","Rôle"],"r":[["build-essential","compilateurs (gcc, make) nécessaires à certains logiciels"],["wget, curl","télécharger des fichiers depuis Internet (Miniconda, données)"],["git","gérer des versions de code et récupérer des projets (GitHub)"],["nano","éditeur de texte dans le terminal ; fonctionne toujours, même sans affichage graphique"],["unzip, zip","décompresser et compresser des archives .zip"],["tree","afficher l'arborescence d'un dossier"],["htop","voir l'utilisation du processeur et de la mémoire (quitter avec q)"],["dos2unix","corriger les fins de ligne des fichiers écrits sous Windows"]]}]},{"h":"Étape 6 - Installer les applications graphiques (éditeurs et images)","i":[{"k":"p","t":"WSL peut afficher des fenêtres Linux sous Windows 11, et sous Windows 10 à jour (après `wsl --update`). Installez :"},{"k":"cmd","w":"ub","c":"sudo apt install -y gedit eog imagemagick\n# Facultatif (volumineux, environ 500 Mo) : l'éditeur Kate\nsudo apt install -y kate"},{"k":"table","h":["Application","Rôle","Lancement"],"r":[["gedit","éditeur de texte simple","`gedit mon_script.py &`"],["kate","éditeur de texte avancé (numéros de ligne, coloration)","`kate mon_script.py &`"],["eog","visionneuse d'images","`eog figure.png &`"],["imagemagick","fournit la commande display pour afficher une image","`display figure.png &`"]]},{"k":"p","t":"Test :"},{"k":"cmd","w":"ub","c":"gedit &"},{"k":"note","n":"ok","t":"Une fenêtre gedit s'ouvre sur le bureau Windows. Fermez-la."},{"k":"note","n":"tip","t":"Le `&` final lance l'application « en arrière-plan » : le terminal reste utilisable pendant que la fenêtre est ouverte."},{"k":"note","n":"fail","t":"« cannot open display » ou aucune fenêtre : voir Problème P2.8. Cela ne bloque pas la suite du parcours."}]},{"h":"Étape 7 - Vérifier Python (sans rien installer)","i":[{"k":"cmd","w":"ub","c":"python3 --version"},{"k":"out","t":"Python 3.12.3"},{"k":"note","n":"warn","t":"N'installez pas de bibliothèques Python avec `pip` à ce stade, et n'utilisez pas `sudo pip`. Toutes les bibliothèques seront installées dans l'environnement conda geoenv (tutoriels 05 et 06). Sur Ubuntu récent, `pip install` hors environnement produit d'ailleurs l'erreur « externally-managed-environment » (Problème P2.9)."},{"k":"p","t":"**Remarque** : dans Ubuntu, la commande s'appelle `python3`. La commande `python` n'existe qu'une fois l'environnement conda activé (tutoriel 05). « python: command not found » à ce stade est donc normal."}]},{"h":"Étape 8 - Quitter et relancer Ubuntu correctement","i":[{"k":"ul","i":["Pour quitter : tapez `exit` ou fermez la fenêtre.","Pour redémarrer complètement Ubuntu (utile en cas de problème), tapez dans **PowerShell** : `wsl --shutdown`, puis rouvrez Ubuntu.","Pour mettre à jour Ubuntu à l'avenir (une fois par mois, par exemple) : `sudo apt update && sudo apt upgrade -y` (ou l'alias `maj` du tutoriel 04)."]}]}],"check":["L'invite affiche mon_nom@NOM-DU-PC:~$ (avec $, pas #).","Je connais mon mot de passe Linux et `sudo apt update` fonctionne sans erreur.","`sudo apt upgrade -y` s'est terminé sans erreur.","`wget --version` et `git --version` affichent un numéro de version.","`gedit &` ouvre une fenêtre, ou je sais utiliser nano à la place (Problème P2.8).","`python3 --version` affiche Python 3.x."],"faq":[{"q":"Mon mot de passe Ubuntu est-il le même que celui de Windows ?","a":"Non, ce sont deux comptes indépendants."},{"q":"Puis-je changer mon mot de passe Linux ?","a":"Oui : tapez `passwd` dans Ubuntu (il demande l'ancien puis le nouveau)."},{"q":"À quelle fréquence mettre à jour Ubuntu ?","a":"Une fois par mois environ, et toujours avant d'installer un nouveau logiciel : `sudo apt update && sudo apt upgrade -y`."},{"q":"Puis-je fermer la fenêtre pendant une mise à jour ?","a":"Non. Attendez le retour de l'invite `$`. Une interruption provoque le Problème P2.5."},{"q":"Quelle est la différence entre apt et pip/conda ?","a":"`apt` installe des logiciels du système Ubuntu (avec `sudo`). `conda` installe des bibliothèques Python dans un environnement isolé (sans `sudo`). Dans ce parcours : apt pour les outils système, conda pour Python."}],"ver":"Version 2.0 - septembre 2026","part":"install"},{"num":"03","title":"Naviguer entre Ubuntu et Windows : les commandes de base","sub":"Retrouver ses fichiers Windows depuis Ubuntu (et inversement), se déplacer, créer, copier et supprimer des fichiers sans risque.","obj":"Maîtriser les chemins Linux, accéder aux dossiers Windows et utiliser les commandes essentielles du terminal.","dur":"30 à 45 minutes, exercice compris.","pre":"Tutoriel 02 terminé.","ou":"Ubuntu (terminal WSL).","fin":"Un dossier de projet cours_climat créé dans vos Documents Windows et la maîtrise des commandes de base.","blocks":[{"h":"1. Deux systèmes de fichiers sur le même PC","i":[{"k":"p","t":"Ubuntu possède son propre espace de fichiers (votre dossier personnel `/home/<nom>`, abrégé `~`). Vos disques Windows sont visibles dans Ubuntu sous `/mnt` : le disque C: devient `/mnt/c`, le disque D: devient `/mnt/d`."},{"k":"table","h":["Dans Windows","Dans Ubuntu"],"r":[["`C:\\Users\\Aminata\\Documents`","`/mnt/c/Users/Aminata/Documents`"],["`C:\\Users\\Aminata\\Downloads` (Téléchargements)","`/mnt/c/Users/Aminata/Downloads`"],["`D:\\Donnees\\CHIRPS`","`/mnt/d/Donnees/CHIRPS`"],["`\\\\wsl.localhost\\Ubuntu\\home\\aminata`","`/home/aminata` ou `~`"]]},{"k":"p","t":"**Trois règles de conversion** (essayez-les dans l'onglet **Chemins**) :"},{"k":"ul","i":["la barre `\\` de Windows devient `/` ;","`C:` devient `/mnt/c` (toujours en minuscule) ;","Ubuntu respecte les majuscules : `Documents` ≠ `documents`."]}]},{"h":"Étape 1 - Trouver le nom de votre dossier Windows","i":[{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/"},{"k":"out","t":"'All Users'   Default   'Default User'   Public   Aminata   desktop.ini"},{"k":"p","t":"Ignorez `All Users`, `Default`, `Default User`, `Public` et `desktop.ini`. Le nom restant (ici `Aminata`) est votre nom de dossier Windows. Notez-le **exactement** (majuscules comprises) : il servira partout sous la forme `<NomWindows>`."},{"k":"note","n":"warn","t":"Le nom du dossier peut différer du nom affiché par Windows. Avec un compte Microsoft, il est souvent tronqué aux 5 premières lettres de l'adresse (par exemple `amina` pour aminata.diallo@outlook.com). Seul le résultat de `ls /mnt/c/Users/` fait foi. Sur le PC de l'auteur, ce nom est `User` : c'est pourquoi les anciennes versions des tutoriels utilisaient `/mnt/c/Users/User`."},{"k":"note","n":"tip","t":"Méthode automatique, qui donne directement le chemin complet :"},{"k":"cmd","w":"ub","c":"wslpath \"$(cd /mnt/c && cmd.exe /c 'echo %USERPROFILE%' | tr -d '\\r')\""}]},{"h":"Étape 2 - Aller dans vos dossiers Windows","i":[{"k":"cmd","w":"ub","c":"cd /mnt/c/Users/<NomWindows>\nls\ncd Documents\npwd"},{"k":"out","t":"/mnt/c/Users/Aminata/Documents"},{"k":"p","t":"Les noms des dossiers Windows sont **en anglais** dans Ubuntu, même si l'Explorateur les affiche en français :"},{"k":"table","h":["Explorateur Windows","Nom dans Ubuntu"],"r":[["Bureau","Desktop"],["Documents","Documents"],["Téléchargements","Downloads"],["Images","Pictures"]]},{"k":"note","n":"fail","t":"Dossier Bureau ou Documents vide ou introuvable : il est probablement dans OneDrive, voir Problème P3.3."}]},{"h":"Étape 3 - Gérer les espaces dans les noms","i":[{"k":"p","t":"Un espace sépare les éléments d'une commande. Un nom contenant un espace doit donc être mis **entre guillemets** :"},{"k":"cmd","w":"ub","c":"cd \"/mnt/c/Users/<NomWindows>/Documents/Mes donnees\""},{"k":"note","n":"tip","t":"La touche **Tab** complète automatiquement les noms et ajoute elle-même les protections nécessaires. Tapez `cd Doc` puis Tab : Ubuntu complète en `cd Documents/`. Appuyez deux fois sur Tab pour voir toutes les possibilités."},{"k":"note","n":"tip","t":"Pour vos propres fichiers, évitez espaces et accents : préférez `donnees_chirps_2020.nc` à `Données CHIRPS 2020.nc`."}]},{"h":"Étape 4 - Passer du terminal à l'Explorateur Windows (et inversement)","i":[{"k":"cmd","w":"ub","c":"explorer.exe ."},{"k":"p","t":"Le point `.` désigne le dossier courant : l'Explorateur Windows s'ouvre à l'endroit où vous êtes dans Ubuntu. Dans l'autre sens, pour voir vos fichiers Linux depuis Windows :"},{"k":"ul","i":["dans le panneau gauche de l'Explorateur, cliquez sur **Linux > Ubuntu > home > <votre_nom_linux>** ;","ou tapez dans la barre d'adresse : `\\\\wsl.localhost\\Ubuntu\\home\\<votre_nom_linux>` (sur les anciennes versions : `\\\\wsl$\\Ubuntu\\home\\<votre_nom_linux>`)."]},{"k":"note","n":"danger","t":"Ne cherchez jamais à ouvrir ou modifier le fichier caché `ext4.vhdx` d'Ubuntu dans les dossiers AppData de Windows : vous pourriez rendre Ubuntu inutilisable."}]},{"h":"Étape 5 - Où ranger ses travaux ?","i":[{"k":"table","h":["Emplacement","Avantages","Inconvénients"],"r":[["Dossiers Windows (`/mnt/c/Users/<NomWindows>/...`)","Visibles directement dans l'Explorateur, faciles à partager et à sauvegarder","Plus lents pour les très nombreux petits fichiers (git, conda)"],["Dossier Linux (`~/...`)","Rapide ; indispensable pour Miniconda","Accès depuis Windows par `\\\\wsl.localhost\\...` uniquement"]]},{"k":"note","n":"tip","t":"**Recommandation du parcours** : Miniconda s'installe toujours dans `~` (tutoriel 05) ; vos scripts, données et figures peuvent être dans vos Documents Windows pour débuter."}]},{"h":"Les commandes essentielles","i":[{"k":"p","t":"Le détail de chaque commande, avec exemples et pièges, est dans le **tutoriel 03A**. L'onglet **Commandes** regroupe toutes les commandes du parcours."},{"k":"table","h":["Commande","Rôle","Exemple"],"r":[["`pwd`","afficher le dossier courant","`pwd`"],["`ls`, `ls -lh`, `ls -lrt`, `ls -a`","lister ; en détail ; par date ; avec les cachés","`ls -lh donnees/`"],["`tree -L 2`","arborescence sur 2 niveaux","`tree -L 2 cours_climat`"],["`cd dossier`, `cd ..`, `cd`, `cd -`","entrer ; remonter ; dossier perso ; dossier précédent","`cd Desktop`"],["`mkdir -p a/b/c`","créer plusieurs niveaux d'un coup","`mkdir -p projet/donnees/brutes`"],["`cp`, `cp -r`","copier un fichier, un dossier entier","`cp -r scripts scripts_v2`"],["`mv ancien nouveau`","déplacer ou renommer","`mv test.py analyse_pluie.py`"],["`touch fichier`","créer un fichier vide","`touch notes.txt`"],["`rm`, `rm -i`, `rm -r`, `rmdir`","supprimer ; avec confirmation ; un dossier et son contenu ; un dossier vide","`rm -i *.png`"],["`cat`, `less`, `head -n 20`, `tail -n 20`","lire un fichier","`head -n 5 stations.csv`"],["`wc -l fichier`","compter les lignes","`wc -l stations.csv`"],["`find . -name \"*.nc\"`","chercher des fichiers par nom","`find . -name \"*chirps*\"`"],["`grep -n \"mot\" fichier`","chercher un mot dans un fichier","`grep -n \"import\" analyse.py`"],["`du -sh dossier`, `df -h`","taille d'un dossier ; espace libre","`df -h ~`"],["`clear`, `history`, `--help`, `man`, `exit`","effacer ; historique ; aide ; manuel ; quitter","`ls --help`"]]},{"k":"note","n":"danger","t":"Il n'y a **pas de corbeille** dans le terminal. `rm` supprime définitivement, y compris les fichiers Windows sous `/mnt/c`. Vérifiez toujours avec `pwd` et `ls` avant `rm -r`. N'exécutez jamais `rm -rf /`, `rm -rf ~` ou `rm -rf *` sans savoir exactement où vous êtes."}]},{"h":"Les raccourcis clavier indispensables","i":[{"k":"table","h":["Touche","Effet"],"r":[["Tab","compléter un nom (deux fois : voir les choix possibles)"],["Flèche haut / bas","rappeler les commandes précédentes"],["Ctrl + C","interrompre la commande en cours (et non copier)"],["Ctrl + Maj + C / Ctrl + Maj + V","copier / coller (ou clic droit pour coller)"],["Ctrl + R","rechercher dans l'historique des commandes"],["Ctrl + L","effacer l'écran"],["Ctrl + D","quitter le terminal (comme exit)"],["Ctrl + Z","suspendre (et non annuler) : voir Problème P3.8"]]}]},{"h":"Exercice guidé : créer le dossier du cours","i":[{"k":"cmd","w":"ub","c":"cd /mnt/c/Users/<NomWindows>/Documents\nmkdir -p cours_climat/donnees cours_climat/scripts cours_climat/figures\ncd cours_climat\ntree\nexplorer.exe ."},{"k":"out","t":".\n├── donnees\n├── figures\n└── scripts\n\n3 directories, 0 files"},{"k":"note","n":"ok","t":"L'Explorateur Windows s'ouvre sur `Documents\\cours_climat` avec les trois sous-dossiers."},{"k":"p","t":"Poursuivez l'exercice : créez un fichier, renommez-le, copiez-le, puis supprimez la copie."},{"k":"cmd","w":"ub","c":"touch scripts/essai.py\nmv scripts/essai.py scripts/premier_script.py\ncp scripts/premier_script.py scripts/copie.py\nls -l scripts\nrm -i scripts/copie.py"}]}],"check":["Je connais mon <NomWindows> exact.","Je sais aller dans mes Documents Windows depuis Ubuntu et revenir à ~.","Je sais ouvrir l'Explorateur Windows sur le dossier courant (`explorer.exe .`).","J'utilise la touche Tab pour compléter les noms.","Le dossier cours_climat avec ses trois sous-dossiers existe dans mes Documents.","Je sais que `rm` supprime définitivement."],"faq":[{"q":"Comment copier un fichier de mes Téléchargements Windows vers Ubuntu ?","a":"`cp /mnt/c/Users/<NomWindows>/Downloads/donnees.nc ~/`"},{"q":"Et d'Ubuntu vers mon Bureau Windows ?","a":"`cp ~/figure.png /mnt/c/Users/<NomWindows>/Desktop/`"},{"q":"Comment accéder à une clé USB ?","a":"Si la clé apparaît comme E: dans Windows, elle est généralement visible sous `/mnt/e`. Sinon : `sudo mkdir -p /mnt/e && sudo mount -t drvfs E: /mnt/e`."},{"q":"Puis-je modifier mes fichiers Linux avec des logiciels Windows ?","a":"Oui, en passant par `\\\\wsl.localhost\\Ubuntu\\...` dans l'Explorateur (étape 4), ou avec Visual Studio Code (tutoriel 06)."}],"ver":"Version 2.0 - septembre 2026","part":"install"},{"num":"03A","title":"Les commandes Ubuntu expliquées simplement","sub":"Chaque commande utile expliquée une par une : à quoi elle sert, comment l'écrire, ce qui s'affiche à l'écran et l'erreur à éviter.","obj":"Savoir utiliser seul les commandes Ubuntu de base : se repérer, créer, écrire, lire, copier, renommer, chercher, supprimer, installer un logiciel et lancer un script.","dur":"1 h 30 à 2 h, exercices compris. Vous pouvez le faire en deux séances (parties 1 à 8, puis 9 à 18).","pre":"Tutoriel 02 terminé (Ubuntu installé et à jour). Se lit avec le tutoriel 03 ou juste après.","ou":"Ubuntu (terminal WSL). Jamais dans PowerShell.","fin":"Un dossier d'entraînement ~/entrainement que vous avez rempli vous-même, et une fiche récapitulative de toutes les commandes.","blocks":[{"h":"Comment utiliser ce tutoriel","i":[{"k":"table","h":["Partie","Ce qu'elle vous dit"],"r":[["À quoi ça sert","Le rôle de la commande, en une phrase."],["Comment l'écrire","Le modèle à suivre. Ce qui est entre `< >` est à remplacer par votre valeur."],["Exemple","Un encadré sombre : la commande exacte à taper."],["Ce que vous voyez","Un encadré vert : ce qui doit s'afficher à l'écran."],["Attention","L'erreur que font souvent les débutants."]]},{"k":"note","n":"tip","t":"Le plus important : **tapez vous-même chaque exemple**. On apprend les commandes avec les doigts, pas avec les yeux. Tous les exemples se font dans un dossier d'entraînement : vous ne risquez rien."}]},{"h":"1. Avant de commencer : l'invite et la forme d'une commande","i":[{"k":"p","t":"Ouvrez Ubuntu. La dernière ligne ressemble à `aminata@PC-AMINATA:~$`. Cette ligne s'appelle l'**invite**. Elle veut dire : « Je suis prêt, tapez une commande »."},{"k":"table","h":["Partie","Signification"],"r":[["aminata","votre nom d'utilisateur Linux"],["@PC-AMINATA","le nom de votre ordinateur"],["~","le dossier où vous êtes en ce moment (~ = votre dossier personnel)"],["$","Ubuntu attend votre commande"]]},{"k":"note","n":"warn","t":"Ne tapez jamais l'invite. Elle est affichée par l'ordinateur. Vous tapez seulement ce qui vient après."},{"k":"p","t":"Une commande ressemble à une petite phrase : un **verbe** (ce qu'on fait), parfois une **manière** (l'option, qui commence par un tiret), et un **objet** (sur quoi on agit)."},{"k":"cmd","w":"ub","c":"ls -l Documents"},{"k":"table","h":["Morceau","Nom","Rôle"],"r":[["ls","la commande (le verbe)","« lister », c'est-à-dire montrer le contenu"],["-l","l'option (la manière)","« en détail » (taille, date...)"],["Documents","la cible (l'objet)","le dossier dont on veut voir le contenu"]]},{"k":"p","t":"**Les six règles de saisie** :"},{"k":"ol","i":["Mettez un espace entre chaque morceau : `ls -l Documents`, et non `ls-lDocuments`.","Les majuscules comptent : `Documents` et `documents` sont deux noms différents.","Appuyez sur Entrée pour exécuter la commande.","Attendez que l'invite `$` revienne avant de taper la commande suivante.","Une commande = une seule ligne.","Les lignes qui commencent par `#` sont des commentaires (des explications). Ne les tapez pas."]},{"k":"table","h":["Touche","Ce qu'elle fait"],"r":[["Tab","Complète un nom tout seul. Tapez `cd Doc` puis Tab : Ubuntu écrit `cd Documents/`. Deux fois Tab : la liste des choix."],["Flèche haut","Remet la commande précédente. Très utile pour corriger une faute sans tout retaper."],["Ctrl + C","Arrête la commande en cours. Dans le terminal, Ctrl + C ne sert pas à copier."],["Clic droit ou Ctrl + Maj + V","Coller dans le terminal."],["Ctrl + Maj + C","Copier ce qui est sélectionné à la souris."],["Ctrl + L","Effacer l'écran (vos fichiers ne sont pas touchés)."]]},{"k":"note","n":"ok","t":"**Si rien ne se passe** : après une commande réussie, Ubuntu n'affiche souvent rien : l'invite revient, c'est tout. En Linux, pas de message = tout s'est bien passé. Un problème, au contraire, s'affiche toujours en anglais, par exemple `No such file or directory` (fichier ou dossier introuvable). La partie 17 explique les messages les plus fréquents."}]},{"h":"2. Se repérer : pwd, ls et les chemins","i":[{"k":"p","t":"**pwd** : afficher le dossier dans lequel vous êtes en ce moment. C'est votre « Vous êtes ici » sur un plan."},{"k":"cmd","w":"ub","c":"pwd"},{"k":"out","t":"/home/aminata"},{"k":"note","n":"tip","t":"Avant toute commande importante (et surtout avant de supprimer), tapez `pwd` pour vérifier où vous êtes."},{"k":"p","t":"**ls** : lister le contenu d'un dossier. `ls` pour le dossier où vous êtes, ou `ls <dossier>` pour un autre dossier."},{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/"},{"k":"out","t":"'All Users'  Default  'Default User'  Public  Aminata  desktop.ini"},{"k":"table","h":["Commande","Ce qu'elle montre"],"r":[["`ls`","les noms seulement"],["`ls -l`","une liste détaillée : type, taille, date, nom"],["`ls -lh`","la même liste, avec des tailles lisibles (K, M, G)"],["`ls -a`","aussi les fichiers cachés (leur nom commence par un point, par exemple .bashrc)"],["`ls -lrt`","la liste détaillée, triée par date : le fichier le plus récent est en bas"]]},{"k":"out","t":"drwxr-xr-x 2 aminata aminata 4.0K Oct 12 10:15 donnees\n-rw-r--r-- 1 aminata aminata  120 Oct 12 10:20 notes.txt"},{"k":"p","t":"Pour lire une ligne : la première lettre indique le type (`d` = dossier, `-` = fichier). Ensuite viennent le propriétaire, la taille, la date de modification et le nom. Le reste (`rwx...`) concerne les droits : vous pouvez l'ignorer pour l'instant."},{"k":"p","t":"**Les chemins.** Un chemin est l'adresse d'un fichier ou d'un dossier. Les dossiers sont séparés par une barre `/` (et non `\\` comme dans Windows)."},{"k":"table","h":["Symbole","Signification"],"r":[["/","la racine : le tout premier dossier, qui contient tous les autres"],["~","votre dossier personnel (/home/aminata)"],[".","le dossier où vous êtes (« ici »)"],["..","le dossier parent, juste au-dessus"],["/mnt/c","le disque C: de Windows"]]},{"k":"ul","i":["**Chemin complet (absolu)** : il commence par `/` ou `~`. Valable de n'importe où. Exemple : `/home/aminata/entrainement/donnees`.","**Chemin relatif** : il part du dossier où vous êtes. Exemple : si vous êtes dans `/home/aminata/entrainement`, alors `donnees` suffit."]},{"k":"note","n":"tip","t":"Dans le doute, utilisez le chemin complet : il fonctionne toujours, quel que soit l'endroit où vous êtes."}]},{"h":"3. Créer et se déplacer : mkdir, cd, touch, tree","i":[{"k":"p","t":"**mkdir** crée un dossier (« make directory »). Créons votre dossier d'entraînement :"},{"k":"cmd","w":"ub","c":"cd ~\nmkdir entrainement\nls"},{"k":"out","t":"entrainement"},{"k":"p","t":"L'option `-p` crée aussi les dossiers intermédiaires qui manquent, sans erreur s'ils existent déjà :"},{"k":"cmd","w":"ub","c":"mkdir -p entrainement/donnees entrainement/scripts entrainement/figures"},{"k":"note","n":"warn","t":"Évitez les espaces et les accents dans vos noms : écrivez `donnees_pluie` et non `Données pluie`. Utilisez le tiret bas `_` à la place de l'espace."},{"k":"p","t":"**cd** change de dossier (« change directory »). C'est l'équivalent d'un double-clic sur un dossier."},{"k":"cmd","w":"ub","c":"cd entrainement\npwd\nls"},{"k":"out","t":"/home/aminata/entrainement\ndonnees  figures  scripts"},{"k":"table","h":["Commande","Effet"],"r":[["`cd donnees`","entrer dans le sous-dossier donnees"],["`cd ..`","remonter d'un cran"],["`cd ../scripts`","remonter d'un cran puis entrer dans scripts"],["`cd` ou `cd ~`","revenir directement dans votre dossier personnel"],["`cd -`","revenir au dossier où vous étiez juste avant"],["`cd ~/entrainement`","aller directement à une adresse complète"],["`cd /mnt/c/Users/<NomWindows>/Documents`","aller dans vos Documents Windows"]]},{"k":"cmd","w":"ub","c":"cd ~/entrainement/donnees\npwd\ncd ..\npwd\ncd\npwd"},{"k":"out","t":"/home/aminata/entrainement/donnees\n/home/aminata/entrainement\n/home/aminata"},{"k":"note","n":"warn","t":"Un nom qui contient un espace doit être mis entre guillemets : `cd \"Mes donnees\"`. Sans guillemets, Ubuntu croit qu'il y a deux noms et affiche une erreur."},{"k":"p","t":"**touch** crée un fichier vide, que vous remplirez ensuite :"},{"k":"cmd","w":"ub","c":"cd ~/entrainement\ntouch notes.txt\nls -l"},{"k":"out","t":"drwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 donnees\ndrwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 figures\n-rw-r--r-- 1 aminata aminata    0 Oct 12 10:20 notes.txt\ndrwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 scripts"},{"k":"p","t":"Le fichier `notes.txt` existe, avec une taille de 0 : il est vide. **tree** dessine l'arbre des dossiers (installé au tutoriel 02) :"},{"k":"cmd","w":"ub","c":"tree ~/entrainement"},{"k":"out","t":"/home/aminata/entrainement\n├── donnees\n├── figures\n├── notes.txt\n└── scripts\n\n3 directories, 1 file"}]},{"h":"4. Écrire dans un fichier : nano et echo","i":[{"k":"p","t":"**nano** ouvre un fichier texte dans le terminal. Il fonctionne toujours, même quand les fenêtres graphiques (gedit, kate) ne s'ouvrent pas. Si nano vous paraît difficile et que l'affichage graphique fonctionne, `gedit fichier &` ou `kate fichier &` font la même chose avec la souris."},{"k":"p","t":"Étape 1. Ouvrez le fichier :"},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nnano donnees/stations.csv"},{"k":"p","t":"Étape 2. Tapez (ou collez avec un clic droit) ces cinq lignes :"},{"k":"cmd","w":"nano","c":"station,annee,pluie_mm\nLabe,2020,1620\nDakar,2020,410\nKedougou,2020,1180\nZiguinchor,2020,1450"},{"k":"p","t":"Étape 3. Enregistrez : **Ctrl + O**, puis **Entrée**. Étape 4. Quittez : **Ctrl + X**."},{"k":"table","h":["Touche dans nano","Effet"],"r":[["Ctrl + O puis Entrée","enregistrer (« O » comme « Output »)"],["Ctrl + X","quitter"],["Ctrl + K","couper la ligne entière"],["Ctrl + U","coller la ligne coupée"],["Ctrl + W","chercher un mot"],["Alt + /","aller à la fin du fichier"],["Flèches du clavier","se déplacer (la souris ne déplace pas le curseur)"]]},{"k":"note","n":"warn","t":"En bas de l'écran de nano, le signe `^` veut dire Ctrl. `^X Exit` signifie « Ctrl + X pour quitter ». Si vous quittez sans enregistrer, nano demande « Save modified buffer? » : tapez Y (oui) puis Entrée, ou N (non) pour abandonner les modifications."},{"k":"p","t":"**echo** affiche un texte. Avec `>` ou `>>`, ce texte est écrit dans un fichier :"},{"k":"cmd","w":"ub","c":"echo \"Premiere note du cours\" > notes.txt\necho \"Deuxieme note\" >> notes.txt\ncat notes.txt"},{"k":"out","t":"Premiere note du cours\nDeuxieme note"},{"k":"table","h":["Signe","Effet"],"r":[["`>`","**remplace** tout le contenu du fichier par le texte (l'ancien contenu est perdu)"],["`>>`","**ajoute** le texte à la fin du fichier (l'ancien contenu est conservé)"]]},{"k":"note","n":"danger","t":"Un seul `>` efface le contenu existant du fichier, sans demander confirmation. Pour ajouter une ligne, utilisez toujours `>>` (deux signes)."}]},{"h":"5. Lire un fichier : cat, less, head, tail, wc","i":[{"k":"cmd","w":"ub","c":"cat donnees/stations.csv"},{"k":"out","t":"station,annee,pluie_mm\nLabe,2020,1620\nDakar,2020,410\nKedougou,2020,1180\nZiguinchor,2020,1450"},{"k":"note","n":"warn","t":"N'utilisez pas `cat` sur un fichier très long ou sur un fichier non texte (.nc, .tif, .png) : l'écran se remplit de caractères illisibles. Si cela arrive, tapez Ctrl + C puis la commande `reset`."},{"k":"p","t":"**less** lit un long fichier page par page, sans le modifier : Espace (page suivante), b (page précédente), `/mot` puis Entrée (chercher), **q (quitter, à retenir absolument)**."},{"k":"cmd","w":"ub","c":"less donnees/stations.csv"},{"k":"p","t":"**head** et **tail** montrent les premières ou les dernières lignes (10 par défaut sans `-n`) :"},{"k":"cmd","w":"ub","c":"head -n 2 donnees/stations.csv\ntail -n 1 donnees/stations.csv"},{"k":"out","t":"station,annee,pluie_mm\nLabe,2020,1620\nZiguinchor,2020,1450"},{"k":"p","t":"**wc -l** compte les lignes (« word count », option `-l` pour « lines ») :"},{"k":"cmd","w":"ub","c":"wc -l donnees/stations.csv"},{"k":"out","t":"5 donnees/stations.csv"},{"k":"p","t":"Le fichier a 5 lignes : 1 ligne de titres et 4 stations."}]},{"h":"6. Copier, déplacer, renommer : cp et mv","i":[{"k":"p","t":"**cp source destination**. Toujours dans cet ordre : d'abord ce qu'on copie, ensuite où on le met."},{"k":"cmd","w":"ub","c":"cd ~/entrainement\ncp donnees/stations.csv donnees/stations_copie.csv\nls donnees"},{"k":"out","t":"stations.csv  stations_copie.csv"},{"k":"p","t":"Copier un dossier entier : ajoutez `-r` (« récursif » : le dossier et tout ce qu'il contient)."},{"k":"cmd","w":"ub","c":"cp -r donnees donnees_sauvegarde\nls"},{"k":"out","t":"donnees  donnees_sauvegarde  figures  notes.txt  scripts"},{"k":"table","h":["Exemple utile","Effet"],"r":[["`cp ~/carte.png /mnt/c/Users/<NomWindows>/Desktop/`","copier une figure d'Ubuntu vers le Bureau Windows"],["`cp /mnt/c/Users/<NomWindows>/Downloads/data.nc ~/entrainement/donnees/`","copier un fichier téléchargé sous Windows vers Ubuntu"]]},{"k":"note","n":"warn","t":"Sans `-r`, la copie d'un dossier échoue avec `cp: -r not specified; omitting directory`. Si un fichier du même nom existe déjà à la destination, `cp` l'écrase sans prévenir. Pour être prévenu, utilisez `cp -i`."},{"k":"p","t":"**mv ancien nouveau** a deux usages : renommer (même dossier, nouveau nom) ou déplacer (même nom, autre dossier). Il marche aussi pour les dossiers, sans option."},{"k":"cmd","w":"ub","c":"mv donnees/stations_copie.csv donnees/stations_2020.csv\nls donnees"},{"k":"out","t":"stations.csv  stations_2020.csv"},{"k":"cmd","w":"ub","c":"mv notes.txt scripts/\nls scripts"},{"k":"out","t":"notes.txt"},{"k":"note","n":"tip","t":"Un `/` à la fin de la destination (`scripts/`) indique clairement que c'est un dossier. Si ce dossier n'existe pas, Ubuntu affiche une erreur au lieu de renommer votre fichier par erreur."}]},{"h":"7. Supprimer (avec prudence) : rm, rm -r, rmdir","i":[{"k":"note","n":"danger","t":"Le terminal **n'a pas de corbeille**. Un fichier supprimé avec `rm` est perdu définitivement, y compris s'il se trouve dans vos dossiers Windows (`/mnt/c/...`)."},{"k":"p","t":"**rm -i** demande confirmation pour chaque fichier :"},{"k":"cmd","w":"ub","c":"rm -i donnees/stations_2020.csv"},{"k":"out","t":"rm: remove regular file 'donnees/stations_2020.csv'?"},{"k":"p","t":"Tapez `y` (« yes ») puis Entrée pour supprimer, ou `n` puis Entrée pour annuler. **rm -r** supprime un dossier et tout son contenu, sans confirmation :"},{"k":"cmd","w":"ub","c":"rm -r donnees_sauvegarde"},{"k":"p","t":"**rmdir dossier** supprime un dossier seulement s'il est vide. S'il contient quelque chose, la commande refuse (`Directory not empty`). C'est la façon la plus sûre de faire le ménage."},{"k":"p","t":"**La règle des trois vérifications**, avant chaque suppression :"},{"k":"ol","i":["`pwd` : je vérifie où je suis.","`ls` : je vérifie ce que je vais supprimer.","`rm -i` : je confirme fichier par fichier."]},{"k":"note","n":"danger","t":"N'exécutez jamais `rm -rf /`, `rm -rf ~`, `rm -rf *` ou `sudo rm -rf ...` sans savoir exactement ce que vous faites. Ces commandes peuvent effacer tout votre travail en une seconde."}]},{"h":"8. Chercher : find, grep et le joker *","i":[{"k":"p","t":"**find où -name \"nom\"** cherche des fichiers dans un dossier et tous ses sous-dossiers. Le point `.` signifie « ici et en dessous »."},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nfind . -name \"*.csv\""},{"k":"out","t":"./donnees/stations.csv"},{"k":"note","n":"tip","t":"Mettez toujours le nom cherché entre guillemets. `-iname` à la place de `-name` ignore les majuscules : `find . -iname \"*chirps*\"`."},{"k":"p","t":"**grep \"mot\" fichier** affiche les lignes qui contiennent un mot :"},{"k":"cmd","w":"ub","c":"grep \"Dakar\" donnees/stations.csv"},{"k":"out","t":"Dakar,2020,410"},{"k":"table","h":["Variante","Effet"],"r":[["`grep -i \"dakar\" fichier`","ignore les majuscules et minuscules"],["`grep -n \"import\" analyse.py`","affiche aussi le numéro de la ligne"],["`grep -r \"xarray\" scripts/`","cherche dans tous les fichiers d'un dossier"],["`grep -c \"2020\" fichier`","compte le nombre de lignes trouvées"]]},{"k":"p","t":"Le **joker** `*` remplace « n'importe quels caractères » :"},{"k":"table","h":["Exemple","Ce qu'il désigne"],"r":[["`ls *.csv`","tous les fichiers qui finissent par .csv"],["`ls chirps_*`","tous les fichiers qui commencent par chirps_"],["`cp *.png figures/`","copie toutes les images PNG dans figures"],["`ls *2020*`","tous les fichiers dont le nom contient 2020"]]},{"k":"note","n":"warn","t":"Avec `rm`, le joker est dangereux : `rm *` supprime tous les fichiers du dossier. Vérifiez d'abord avec `ls *.png`, puis seulement `rm -i *.png`."}]},{"h":"9. Enchaîner des commandes : &&, |, >, >>","i":[{"k":"table","h":["Signe","Effet","Exemple"],"r":[["`&&`","exécute la deuxième commande si la première a réussi","`cd ~/entrainement && ls`"],["`|`","envoie le résultat de la première commande à la deuxième (« pipe », le tuyau)","`ls donnees | wc -l`"],["`>`","écrit le résultat dans un fichier (remplace)","`ls -l > liste.txt`"],["`>>`","ajoute le résultat à la fin d'un fichier","`date >> journal.txt`"]]},{"k":"p","t":"Retrouver une commande déjà tapée qui contenait le mot « conda » :"},{"k":"cmd","w":"ub","c":"history | grep conda"},{"k":"note","n":"tip","t":"Le signe `|` s'obtient avec **Alt Gr + 6** sur un clavier français (AZERTY). Le signe `~` s'obtient avec **Alt Gr + 2** puis Espace."}]},{"h":"10. Espace disque et taille des fichiers","i":[{"k":"table","h":["Commande","Ce qu'elle montre"],"r":[["`df -h ~`","l'espace libre sur le disque où se trouve Ubuntu (colonne Avail = disponible)"],["`du -sh <dossier>`","la taille totale d'un dossier"],["`du -sh *`","la taille de chaque élément du dossier courant"],["`free -h`","la mémoire vive (RAM) utilisée et disponible"]]},{"k":"cmd","w":"ub","c":"du -sh ~/entrainement"},{"k":"out","t":"24K   /home/aminata/entrainement"},{"k":"note","n":"tip","t":"L'option `-h` (« human ») affiche les tailles en K, M ou G, plus faciles à lire."}]},{"h":"11. Télécharger et décompresser : wget, unzip, tar","i":[{"k":"p","t":"**wget adresse** télécharge un fichier dans le dossier où vous êtes. `-c` reprend un téléchargement interrompu."},{"k":"cmd","w":"ub","c":"cd ~/entrainement/donnees\nwget -c https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"},{"k":"out","t":"ne_110m_admin_0_countries.zip 100%[==========>] 210K --.-KB/s in 0.3s\n... 'ne_110m_admin_0_countries.zip' saved"},{"k":"note","n":"warn","t":"L'adresse doit être tapée sur une seule ligne, sans espace à l'intérieur. Une adresse coupée donne l'erreur `404 Not Found`."},{"k":"table","h":["Type d'archive","Commande"],"r":[[".zip","`unzip fichier.zip` (ou `unzip fichier.zip -d dossier_cible`)"],[".tar.gz ou .tgz","`tar -xzf fichier.tar.gz`"],[".gz (un seul fichier)","`gunzip fichier.nc.gz`"],["créer un .zip","`zip -r archive.zip dossier/`"]]},{"k":"cmd","w":"ub","c":"unzip ne_110m_admin_0_countries.zip -d pays\nls pays"},{"k":"out","t":"ne_110m_admin_0_countries.dbf  ne_110m_admin_0_countries.shp  ..."},{"k":"p","t":"Vous venez de télécharger et d'ouvrir un vrai shapefile des pays du monde, que vous utiliserez plus tard avec Python."}]},{"h":"12. Installer des logiciels Ubuntu : sudo et apt","i":[{"k":"p","t":"`sudo` veut dire « fais-le en tant qu'administrateur ». Ubuntu demande alors votre mot de passe Linux (rien ne s'affiche pendant la saisie : c'est normal). `apt` est le magasin de logiciels d'Ubuntu."},{"k":"table","h":["Commande","Effet"],"r":[["`sudo apt update`","met à jour la liste des logiciels disponibles"],["`sudo apt upgrade -y`","installe les mises à jour"],["`sudo apt install -y <logiciel>`","installe un logiciel, par exemple `sudo apt install -y tree`"],["`sudo apt remove <logiciel>`","désinstalle un logiciel"],["`apt search <mot>`","cherche un logiciel (sans sudo)"]]},{"k":"cmd","w":"ub","c":"sudo apt update && sudo apt upgrade -y"},{"k":"note","n":"warn","t":"`sudo` sert uniquement pour `apt` et les fichiers du système. Ne mettez jamais `sudo` devant `conda`, `pip`, `python`, `cd`, `ls` ou `rm` dans vos propres dossiers."},{"k":"note","n":"tip","t":"L'option `-y` répond « oui » automatiquement à la question « Do you want to continue? [Y/n] »."}]},{"h":"13. Lancer un script : bash et python3","i":[{"k":"table","h":["Type de fichier","Commande","Exemple"],"r":[["script bash .sh","`bash <fichier>`","`bash installer.sh`"],["script Python .py","`python3 <fichier>`","`python3 analyse.py`"]]},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nnano scripts/bonjour.py"},{"k":"p","t":"Écrivez cette ligne dans nano, enregistrez (Ctrl + O, Entrée) et quittez (Ctrl + X) :"},{"k":"cmd","w":"nano","c":"print(\"Bonjour, mon premier script Python fonctionne\")"},{"k":"cmd","w":"ub","c":"python3 scripts/bonjour.py"},{"k":"out","t":"Bonjour, mon premier script Python fonctionne"},{"k":"note","n":"tip","t":"Pour lancer un script avec `./script.sh` (sans bash devant), il faut d'abord le rendre exécutable : `chmod +x script.sh`. Dans ce parcours, le plus simple reste `bash script.sh`."},{"k":"note","n":"warn","t":"Avant le tutoriel 05, c'est `python3` qu'il faut taper. Après activation de l'environnement geoenv, `python` et `python3` fonctionnent tous les deux."}]},{"h":"14. Surveiller et arrêter un programme","i":[{"k":"table","h":["Commande ou touche","Effet"],"r":[["Ctrl + C","arrêter le programme en cours (à retenir en premier)"],["`htop`","voir les programmes qui tournent, le processeur et la mémoire ; q pour quitter"],["`free -h`","voir la mémoire disponible"],["Ctrl + Z","met le programme en pause (il ne l'arrête pas)"],["`fg`","reprendre un programme mis en pause par Ctrl + Z"]]},{"k":"note","n":"warn","t":"Si le terminal affiche `[1]+ Stopped`, vous avez appuyé sur Ctrl + Z. Tapez `fg` pour reprendre, puis Ctrl + C pour arrêter."}]},{"h":"15. Trouver de l'aide et se faciliter la vie","i":[{"k":"table","h":["Commande","Effet"],"r":[["`<commande> --help`","aide rapide, par exemple `ls --help`"],["`man <commande>`","le manuel complet ; q pour quitter"],["`history`","la liste des commandes déjà tapées"],["`clear` (ou Ctrl + L)","effacer l'écran"],["`which <commande>`","où se trouve le programme, par exemple `which python3`"],["`explorer.exe .`","ouvrir le dossier courant dans l'Explorateur Windows"],["`exit` (ou Ctrl + D)","fermer le terminal"]]}]},{"h":"16. Exercice final : tout refaire seul","i":[{"k":"p","t":"Faites cet exercice **sans regarder les parties précédentes**. Ne consultez la solution qu'en cas de blocage."},{"k":"ol","i":["Allez dans votre dossier personnel et vérifiez où vous êtes.","Créez le dossier `~/exercice` avec trois sous-dossiers : `entrees`, `resultats`, `archives`.","Entrez dans `~/exercice` et affichez son arborescence.","Créez avec nano le fichier `entrees/pluie.csv` contenant une ligne de titres `mois,pluie_mm` et trois mois de votre choix.","Ajoutez avec echo une quatrième ligne à la fin du fichier.","Affichez le fichier, puis comptez ses lignes.","Copiez `pluie.csv` dans `archives` sous le nom `pluie_copie.csv`.","Renommez `entrees/pluie.csv` en `entrees/pluie_2026.csv`.","Cherchez tous les fichiers .csv du dossier `~/exercice`.","Supprimez `archives/pluie_copie.csv` avec confirmation, puis le dossier vide `archives`.","Ouvrez `~/exercice` dans l'Explorateur Windows."]},{"k":"solution","c":"# 1\ncd ~\npwd\n# 2\nmkdir -p ~/exercice/entrees ~/exercice/resultats ~/exercice/archives\n# 3\ncd ~/exercice\ntree\n# 4 (écrire les lignes, puis Ctrl + O, Entrée, Ctrl + X)\nnano entrees/pluie.csv\n# 5\necho \"septembre,210\" >> entrees/pluie.csv\n# 6\ncat entrees/pluie.csv\nwc -l entrees/pluie.csv\n# 7\ncp entrees/pluie.csv archives/pluie_copie.csv\n# 8\nmv entrees/pluie.csv entrees/pluie_2026.csv\n# 9\nfind . -name \"*.csv\"\n# 10\nrm -i archives/pluie_copie.csv\nrmdir archives\n# 11\nexplorer.exe ."},{"k":"note","n":"ok","t":"`tree` montre `entrees` (avec `pluie_2026.csv`) et `resultats`, `find` trouve `./entrees/pluie_2026.csv`, et l'Explorateur Windows s'ouvre sur le dossier exercice."}]},{"h":"17. Les erreurs les plus fréquentes","i":[{"k":"table","h":["Message affiché","Ce qu'il veut dire","Que faire"],"r":[["No such file or directory","fichier ou dossier introuvable","`pwd` puis `ls` ; vérifier l'orthographe et les majuscules ; utiliser Tab (P3.1)"],["command not found","commande inconnue","faute de frappe, ou logiciel non installé : `sudo apt install -y <logiciel>`"],["Permission denied","droit refusé","travailler dans vos dossiers ; fermer le fichier ouvert dans Excel ou Word ; lancer un script avec bash (P3.2)"],["Is a directory","la commande attend un fichier, pas un dossier","pour copier un dossier : `cp -r` ; pour le supprimer : `rm -r`"],["Directory not empty","rmdir refuse un dossier qui contient des fichiers","vérifier son contenu avec `ls`, puis `rm -r` si vous êtes sûr"],["File exists","le dossier ou le fichier existe déjà","choisir un autre nom, ou utiliser `mkdir -p`"],["L'invite devient >","un guillemet n'a pas été fermé","Ctrl + C, puis retaper la commande (P3.9)"],["[1]+ Stopped","programme mis en pause par Ctrl + Z","`fg`, puis Ctrl + C (P3.8)"],["Écran plein de signes bizarres","cat sur un fichier non texte","Ctrl + C puis `reset`"],["sudo: ... incorrect password","mauvais mot de passe Linux","vérifier Verr. Maj ; rien ne s'affiche, c'est normal (P2.2)"],["Unable to locate package","logiciel introuvable","`sudo apt update` puis réessayer (P2.10)"]]}]}],"check":["Je sais lire l'invite et je ne la tape jamais.","Je sais où je suis (`pwd`) et ce qu'il y a dans un dossier (`ls`, `ls -lh`).","Je sais me déplacer avec `cd`, `cd ..`, `cd ~` et un chemin complet.","Je sais créer un dossier (`mkdir -p`) et un fichier (`touch`, `nano`).","Je sais enregistrer et quitter nano (Ctrl + O, Entrée, Ctrl + X).","Je sais lire un fichier (`cat`, `head`, `less` avec q pour quitter).","Je sais copier (`cp`), déplacer et renommer (`mv`).","Je supprime toujours avec prudence : `pwd`, `ls`, puis `rm -i`.","Je sais chercher un fichier (`find`) et un mot (`grep`).","Je sais installer un logiciel avec `sudo apt install` et ne jamais mettre sudo devant conda.","J'ai réussi l'exercice final de la partie 16."],"faq":[],"ver":"Version 2.0 - octobre 2026","part":"install"},{"num":"04","title":"Créer ses raccourcis de commandes (alias)","sub":"Remplacer les commandes longues par des raccourcis d'une ou deux lettres, de façon permanente et sans erreur.","obj":"Installer les alias du cours dans le fichier ~/.bashrc et savoir les utiliser, les modifier et les réparer.","dur":"15 minutes.","pre":"Tutoriels 02 et 03 terminés ; connaître son <NomWindows> (tutoriel 03, étape 1).","ou":"Ubuntu (terminal WSL).","fin":"Des raccourcis permanents : m (dossier Windows), ll, p, geo, j, ex, maj...","blocks":[{"h":"1. Qu'est-ce qu'un alias ?","i":[{"k":"p","t":"Un **alias** est un surnom donné à une commande. Par exemple, `m` peut remplacer `cd /mnt/c/Users/Aminata`. Essayez :"},{"k":"cmd","w":"ub","c":"alias bonjour='echo Bonjour, le terminal fonctionne'\nbonjour"},{"k":"p","t":"Cet alias disparaît dès que vous fermez le terminal. Pour qu'un alias soit **permanent**, il doit être écrit dans le fichier `~/.bashrc`, qu'Ubuntu lit automatiquement à chaque ouverture du terminal."},{"k":"p","t":"Dans ce parcours, le dossier Windows est enregistré une seule fois dans une variable nommée **WIN** (par exemple `WIN=\"/mnt/c/Users/Aminata\"`). Les alias utilisent ensuite `$WIN` : ils fonctionnent donc sur tous les PC, quel que soit le nom Windows."},{"k":"note","n":"warn","t":"Les anciennes versions des tutoriels utilisaient `/mnt/c/Users/User`, qui est le nom Windows du PC de l'auteur. Sur votre PC, ce chemin n'existe probablement pas : c'est la cause la plus fréquente de l'erreur « No such file or directory » avec l'alias m."}]},{"h":"2. Les alias du cours","i":[{"k":"table","h":["Alias","Commande réelle","Usage"],"r":[["m, M, myhome","`cd \"$WIN\"`","aller dans votre dossier Windows"],["docs, dl","`cd \"$WIN/Documents\"`, `cd \"$WIN/Downloads\"`","aller dans Documents, Téléchargements"],["ll, la, lt","`ls -lh`, `ls -lha`, `ls -lrt`","liste détaillée, avec cachés, par date"],["p, P","`python3`","`p analyse.py`"],["geo","`conda activate geoenv`","activer l'environnement (après le tutoriel 05)"],["j, J, jl","`jupyter notebook/lab --no-browser`","lancer Jupyter (après le tutoriel 06)"],["k, g, n","`kate`, `gedit`, `nano`","`g analyse.py &`"],["d","`display`","afficher une image : `d carte.png &`"],["voir, ex","`explorer.exe`, `explorer.exe .`","ouvrir un fichier ou le dossier courant dans Windows"],["maj","`sudo apt update && sudo apt upgrade -y`","mettre Ubuntu à jour"]]}]},{"h":"Étape 1 - Choisir une méthode","i":[{"k":"table","h":["Méthode","Pour qui","Risque d'erreur"],"r":[["A. Script automatique (recommandée)","Tout le monde, en particulier les débutants","Très faible"],["B. Copier-coller dans le terminal","Si vous n'avez pas le fichier du script","Moyen (copier-coller depuis PDF)"],["C. Éditeur de texte (nano, gedit, kate)","Pour comprendre ou personnaliser","Moyen"]]},{"k":"note","n":"warn","t":"N'utilisez qu'**une seule** méthode. Les trois produisent le même résultat."}]},{"h":"Étape 2A - Méthode A : script automatique","i":[{"k":"p","t":"Copiez le fichier `outil_04_installer_alias.sh` dans votre dossier Téléchargements Windows, puis :"},{"k":"cmd","w":"ub","c":"bash /mnt/c/Users/<NomWindows>/Downloads/outil_04_installer_alias.sh"},{"k":"p","t":"Le script détecte votre dossier Windows (ou vous le demande), sauvegarde `~/.bashrc`, retire un éventuel ancien bloc d'alias du cours et ajoute le nouveau. Il peut être relancé sans créer de doublons."},{"k":"out","t":"1/4 - Recherche de votre dossier Windows...\n      Dossier Windows : /mnt/c/Users/Aminata\n2/4 - Sauvegarde de ~/.bashrc...\n3/4 - Suppression d'un éventuel ancien bloc d'alias du cours...\n4/4 - Ajout des alias...\nTerminé. Pour activer les alias maintenant, tapez :\n   source ~/.bashrc"},{"k":"p","t":"Passez directement à l'étape 3."},{"k":"note","n":"fail","t":"« No such file or directory » sur le script : vérifiez son emplacement avec `ls /mnt/c/Users/<NomWindows>/Downloads/`. Si le navigateur l'a renommé (par exemple `outil_04_installer_alias(1).sh`), mettez le nom entre guillemets."}]},{"h":"Étape 2B - Méthode B : copier-coller dans le terminal","i":[{"k":"p","t":"1. Sauvegardez le fichier actuel :"},{"k":"cmd","w":"ub","c":"cp ~/.bashrc ~/.bashrc.sauvegarde"},{"k":"p","t":"2. Détectez votre dossier Windows et vérifiez le résultat :"},{"k":"cmd","w":"ub","c":"WIN=$(wslpath \"$(cd /mnt/c && cmd.exe /c 'echo %USERPROFILE%' | tr -d '\\r')\")\necho \"$WIN\"\nls \"$WIN\""},{"k":"note","n":"ok","t":"`echo` affiche par exemple `/mnt/c/Users/Aminata` et `ls` liste Desktop, Documents, Downloads... Si echo n'affiche rien, tapez à la place `WIN=\"/mnt/c/Users/<NomWindows>\"` avec votre nom exact."},{"k":"p","t":"3. Enregistrez ce dossier dans `~/.bashrc` :"},{"k":"cmd","w":"ub","c":"echo \"export WIN=\\\"$WIN\\\"\" >> ~/.bashrc"},{"k":"p","t":"4. Ajoutez les alias : copiez-collez **tout le bloc** suivant en une seule fois, de `cat` jusqu'à `EOF` inclus, puis appuyez sur Entrée :"},{"k":"cmd","w":"ub","c":"cat << 'EOF' >> ~/.bashrc\n# >>> ALIAS DU COURS DIOUF >>>\n# Dossiers\nalias myhome='cd \"$WIN\"'\nalias m='cd \"$WIN\"'\nalias M='cd \"$WIN\"'\nalias docs='cd \"$WIN/Documents\"'\nalias dl='cd \"$WIN/Downloads\"'\n# Listes de fichiers\nalias ls='ls --color=auto'\nalias ll='ls -lh'\nalias la='ls -lha'\nalias lt='ls -lrt'\n# Python, conda et Jupyter\nalias p='python3'\nalias P='python3'\nalias geo='conda activate geoenv'\nalias j='jupyter notebook --no-browser'\nalias J='jupyter notebook --no-browser'\nalias jl='jupyter lab --no-browser'\n# Éditeurs de texte\nalias k='kate'\nalias g='gedit'\nalias n='nano'\n# Images et Explorateur Windows\nalias d='display'\nalias voir='explorer.exe'\nalias ex='explorer.exe .'\n# Mise à jour d'Ubuntu\nalias maj='sudo apt update && sudo apt upgrade -y'\n# <<< ALIAS DU COURS DIOUF <<<\nEOF"},{"k":"note","n":"warn","t":"Le mot `EOF` final doit être seul sur sa ligne, sans espace avant ni après. Si le terminal affiche `>` et attend, voir Problème P4.3. Ne collez ce bloc qu'**une seule fois** (sinon, voir Problème P4.4)."}]},{"h":"Étape 2C - Méthode C : avec un éditeur de texte","i":[{"k":"p","t":"1. Sauvegardez : `cp ~/.bashrc ~/.bashrc.sauvegarde`"},{"k":"p","t":"2. Ouvrez le fichier. Écrivez toujours `~/.bashrc` (avec `~/`), quel que soit le dossier où vous êtes :"},{"k":"cmd","w":"ub","c":"nano ~/.bashrc\n# ou, si les fenêtres graphiques fonctionnent :\ngedit ~/.bashrc &\nkate ~/.bashrc &"},{"k":"p","t":"3. Allez à la fin du fichier (dans nano : Alt + /) et ajoutez la ligne suivante, en remplaçant `<NomWindows>` :"},{"k":"cmd","w":"file","c":"export WIN=\"/mnt/c/Users/<NomWindows>\""},{"k":"p","t":"4. Ajoutez en dessous le bloc d'alias de la méthode B (les lignes entre `cat << 'EOF'` et `EOF`, **sans ces deux lignes**)."},{"k":"p","t":"5. Enregistrez et fermez : dans nano, Ctrl + O puis Entrée, Ctrl + X ; dans gedit ou kate, Ctrl + S puis fermer la fenêtre."}]},{"h":"Étape 3 - Activer les alias","i":[{"k":"cmd","w":"ub","c":"source ~/.bashrc"},{"k":"p","t":"Cette commande relit `~/.bashrc` sans fermer le terminal. Elle est nécessaire une seule fois : les prochains terminaux chargeront les alias automatiquement."},{"k":"note","n":"fail","t":"Messages d'erreur « syntax error » ou « unexpected EOF » : voir Problème P4.6."}]},{"h":"Étape 4 - Vérifier","i":[{"k":"cmd","w":"ub","c":"echo \"$WIN\"\ntype m\nm\npwd\nll\nex"},{"k":"out","t":"/mnt/c/Users/Aminata\nm is aliased to `cd \"$WIN\"'\n/mnt/c/Users/Aminata\ntotal 0\ndrwxrwxrwx 1 aminata aminata 4.0K Sep 28 10:12 Desktop\n..."},{"k":"note","n":"ok","t":"`m` vous place dans votre dossier Windows, `ll` affiche une liste détaillée, `ex` ouvre l'Explorateur Windows à cet endroit."},{"k":"p","t":"Fermez le terminal, rouvrez Ubuntu et tapez de nouveau `m` puis `pwd` : l'alias doit toujours fonctionner."}]},{"h":"Modifier, ajouter ou supprimer un alias","i":[{"k":"ul","i":["Voir tous les alias actifs : `alias`.","Voir où ils sont écrits : `grep -n \"alias\" ~/.bashrc` (le numéro de ligne s'affiche au début).","Modifier : `nano ~/.bashrc`, corriger la ligne, enregistrer, puis `source ~/.bashrc`.","Ajouter le vôtre, par exemple pour un projet : le plus simple est de l'écrire avec nano, gedit ou kate à la fin de `~/.bashrc`, puis `source ~/.bashrc`.","Désactiver un alias pour la session en cours : `unalias nom`."]},{"k":"cmd","w":"ub","c":"echo \"alias proj='cd \\\"\\$WIN/Documents/cours_climat\\\"'\" >> ~/.bashrc\nsource ~/.bashrc"},{"k":"note","n":"warn","t":"Syntaxe d'un alias : `alias nom='commande'`, **sans espace** autour du signe `=`, avec des apostrophes **droites**."}]}],"check":["`echo \"$WIN\"` affiche mon vrai dossier Windows.","`m` puis `pwd` affiche ce dossier, même après avoir fermé et rouvert Ubuntu.","`ll` affiche une liste détaillée.","`ex` ouvre l'Explorateur Windows.","Une copie de sécurité ~/.bashrc.sauvegarde... existe (`ls -a ~`)."],"faq":[{"q":"Qu'est-ce que le fichier .bashrc ?","a":"Un fichier texte caché (son nom commence par un point) situé dans votre dossier personnel Linux. Ubuntu l'exécute à chaque ouverture d'un terminal. On y place les alias, les variables comme WIN et, plus tard, l'initialisation de conda."},{"q":"Pourquoi ne vois-je pas .bashrc avec ls ?","a":"Les fichiers commençant par un point sont cachés. Utilisez `ls -a ~` ou l'alias `la`."},{"q":"Puis-je ouvrir geoenv automatiquement à chaque terminal ?","a":"Oui, après le tutoriel 05 : `echo \"conda activate geoenv\" >> ~/.bashrc`. C'est facultatif."},{"q":"Mes alias fonctionneront-ils dans un script Python ou bash ?","a":"Non. Les alias ne servent que dans le terminal interactif. Dans un script, écrivez les commandes complètes (par exemple `python3` et non `p`)."}],"ver":"Version 2.0 - septembre 2026","part":"install"},{"num":"05","title":"Installer Miniconda et créer l'environnement geoenv","sub":"Installer le gestionnaire conda, le configurer sur le canal conda-forge et créer l'environnement Python « geoenv » dédié aux données climatiques et géographiques.","obj":"Disposer de Python 3.11 et du socle scientifique (xarray, geopandas, rioxarray, regionmask, cartopy, CDO...) dans un environnement isolé.","dur":"30 à 45 minutes (dont 10 à 20 minutes de téléchargement).","pre":"Tutoriels 02 à 04 terminés ; environ 10 Go libres ; bonne connexion Internet (environ 2 Go à télécharger).","ou":"Ubuntu (terminal WSL). Jamais dans PowerShell, jamais avec sudo.","fin":"L'invite (geoenv) nom@PC:~$ et un test d'importation qui affiche « OK ».","blocks":[{"h":"1. Vocabulaire","i":[{"k":"table","h":["Terme","Signification"],"r":[["conda","gestionnaire qui installe Python et des bibliothèques, y compris leurs composants compilés (GDAL, PROJ, NetCDF, ESMF)"],["Miniconda","installateur minimal de conda (le parcours l'utilise) ; Miniforge est une alternative équivalente (Problème P5.4)"],["environnement","dossier isolé contenant une version de Python et ses bibliothèques ; on peut en avoir plusieurs sans conflit"],["base","environnement par défaut de conda : on n'y installe rien"],["geoenv","l'environnement du cours"],["conda-forge","le « canal » (dépôt) communautaire qui fournit les paquets scientifiques les plus complets et à jour"]]},{"k":"p","t":"**Les 4 règles d'or de conda**"},{"k":"ol","i":["**Jamais de `sudo`** devant conda ou pip.","**Toujours activer geoenv** (`conda activate geoenv`) avant d'installer ou d'exécuter.","**Préférer `conda install -c conda-forge`** à `pip install`. Utiliser pip seulement si le paquet n'existe pas sur conda-forge, et toujours après les installations conda.","**Installer Miniconda dans Linux (`~`)**, jamais dans un dossier Windows (`/mnt/c/...`)."]}]},{"h":"Étape 1 - Vérifications préalables","i":[{"k":"cmd","w":"ub","c":"cd ~\nuname -m\ndf -h ~\nconda --version"},{"k":"table","h":["Commande","Résultat attendu","Sinon"],"r":[["`uname -m`","x86_64 (PC Intel ou AMD, cas le plus courant)","aarch64 : PC à processeur ARM (Snapdragon), utilisez l'installateur ARM à l'étape 3"],["`df -h ~`","colonne « Avail » supérieure à 10G","Libérez de l'espace sur C: (P1.12)"],["`conda --version`","« conda: command not found » (conda absent : normal)","Si une version s'affiche, conda est déjà installé : passez à l'étape 6, ou nettoyez d'abord (étape 2)"]]}]},{"h":"Étape 2 - (Facultatif) Supprimer une ancienne installation","i":[{"k":"p","t":"Uniquement si une installation précédente de conda a échoué ou est en désordre :"},{"k":"cmd","w":"ub","c":"rm -rf ~/miniconda3 ~/.conda ~/.condarc ~/.continuum"},{"k":"note","n":"danger","t":"Cette commande supprime définitivement Miniconda et tous les environnements existants. Ne l'utilisez pas si vous avez des environnements à conserver."},{"k":"p","t":"Si l'ouverture d'Ubuntu affiche ensuite des erreurs mentionnant miniconda3, voir Problème P5.12."}]},{"h":"Étape 3 - Télécharger l'installateur Miniconda","i":[{"k":"cmd","w":"ub","c":"# PC Intel ou AMD (uname -m = x86_64), le cas le plus courant :\nwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh\n# PC ARM uniquement (uname -m = aarch64) :\nwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh"},{"k":"note","n":"warn","t":"La commande wget est **une seule ligne** : l'adresse et `-O ~/miniconda.sh` doivent être sur la même ligne, séparés par un espace. Le O de `-O` est une lettre majuscule, pas un zéro. Ne tapez qu'**une** des deux commandes, celle de votre processeur."},{"k":"out","t":"miniconda.sh   100%[===================>] 150,00M  5,2MB/s    en 29s\n... « /home/aminata/miniconda.sh » sauvegardé"},{"k":"p","t":"Contrôle : `ls -lh ~/miniconda.sh` doit afficher une taille d'environ 150 Mo."},{"k":"note","n":"fail","t":"404 Not Found, échec de résolution, certificat, téléchargement coupé : voir Problème P5.3."}]},{"h":"Étape 4 - Installer Miniconda","i":[{"k":"p","t":"**Méthode recommandée** (automatique, sans questions) :"},{"k":"cmd","w":"ub","c":"bash ~/miniconda.sh -b -p ~/miniconda3\n~/miniconda3/bin/conda init bash"},{"k":"p","t":"L'option `-b` accepte la licence et installe sans questions ; `-p ~/miniconda3` fixe le dossier d'installation. `conda init bash` ajoute conda à votre `~/.bashrc`."},{"k":"out","t":"PREFIX=/home/aminata/miniconda3\n...\ninstallation finished.\n...\nmodified      /home/aminata/.bashrc\n==> For changes to take effect, close and re-open your current shell. <=="},{"k":"p","t":"**Méthode interactive (alternative)** : `bash ~/miniconda.sh`, puis répondez ainsi :"},{"k":"table","h":["Question affichée","Réponse"],"r":[["« Please, press ENTER to continue »","Entrée"],["Texte de la licence (« --More-- »)","Barre d'espace plusieurs fois, ou q pour aller à la fin"],["« Do you accept the license terms? [yes|no] »","tapez **yes** en toutes lettres, puis Entrée"],["« Miniconda3 will now be installed into this location: /home/.../miniconda3 »","Entrée (garder le dossier proposé)"],["« Do you wish to update your shell profile to automatically initialize conda? »","tapez **yes**, puis Entrée"]]},{"k":"note","n":"warn","t":"À la question de la licence, `y` ne suffit pas : il faut `yes`. Si vous avez répondu no à l'initialisation, tapez `~/miniconda3/bin/conda init bash`."}]},{"h":"Étape 5 - Activer conda et vérifier","i":[{"k":"p","t":"Fermez et rouvrez Ubuntu, ou tapez :"},{"k":"cmd","w":"ub","c":"source ~/.bashrc\nconda --version"},{"k":"note","n":"ok","t":"L'invite commence désormais par `(base)` et `conda --version` affiche un numéro, par exemple conda 25.x.x ou plus récent."},{"k":"note","n":"fail","t":"« conda: command not found » : voir Problème P5.1."},{"k":"p","t":"Supprimez l'installateur pour libérer de la place : `rm ~/miniconda.sh`."}]},{"h":"Étape 6 - Configurer les canaux (conda-forge uniquement)","i":[{"k":"cmd","w":"ub","c":"conda config --add channels conda-forge\nconda config --set channel_priority strict\nconda config --remove channels defaults\nconda config --show channels"},{"k":"out","t":"channels:\n  - conda-forge"},{"k":"p","t":"Ces réglages font de conda-forge la **seule** source des paquets : on évite ainsi les conflits entre canaux, principale cause des installations interminables. Un avertissement sur la troisième commande (« defaults » absent) peut être ignoré."},{"k":"note","n":"fail","t":"Message mentionnant « Terms of Service » ou « CondaToSNonInteractiveError » à cette étape ou aux suivantes : voir Problème P5.4."}]},{"h":"Étape 7 - Créer l'environnement geoenv","i":[{"k":"p","t":"Trois méthodes aboutissent au même résultat. **Choisissez-en une seule.**"},{"k":"p","t":"**Méthode A (recommandée) : une seule commande.** Installer tout le socle d'un coup permet à conda de trouver une combinaison compatible en une fois. Tapez cette commande sur une seule ligne :"},{"k":"cmd","w":"ub","c":"conda create -n geoenv -c conda-forge python=3.11 numpy pandas scipy xarray netcdf4 h5netcdf cftime bottleneck dask shapely pyproj geopandas fiona rasterio rioxarray regionmask cartopy matplotlib seaborn plotly jupyter jupyterlab ipykernel ipywidgets cdo nco openpyxl tqdm pip -y"},{"k":"p","t":"Durée : 5 à 20 minutes. Les étapes « Channels », « Solving environment » (jusqu'à quelques minutes), « Downloading and Extracting Packages » puis « Preparing transaction », « Verifying transaction », « Executing transaction » se succèdent. **Ne fermez pas la fenêtre.**"},{"k":"out","t":"Preparing transaction: done\nVerifying transaction: done\nExecuting transaction: done\n#\n# To activate this environment, use\n#\n#     $ conda activate geoenv"},{"k":"p","t":"**Méthode B : pas à pas** (méthode de la version précédente du cours) :"},{"k":"cmd","w":"ub","c":"conda create -n geoenv -c conda-forge python=3.11 -y\nconda activate geoenv\nconda install -c conda-forge numpy pandas xarray netcdf4 cftime scipy -y\nconda install -c conda-forge shapely pyproj geopandas fiona rasterio rioxarray -y\nconda install -c conda-forge regionmask cartopy -y\nconda install -c conda-forge matplotlib seaborn plotly jupyter jupyterlab ipykernel -y\nconda install -c conda-forge cdo nco -y"},{"k":"note","n":"warn","t":"La version précédente imposait `numpy=1.26` et `xarray=2024.6.0`. Ces versions figées ne sont plus nécessaires et peuvent créer des conflits avec les bibliothèques récentes. Ne les imposez que si un script du cours l'exige."},{"k":"p","t":"**Méthode C : à partir du fichier fourni** (voir aussi le tutoriel 09) :"},{"k":"cmd","w":"ub","c":"conda env create -f /mnt/c/Users/<NomWindows>/Downloads/outil_05_geoenv.yml"},{"k":"note","n":"fail","t":"« Solving environment » dure plus de 30 minutes ou message « conflicts » / « Unsatisfiable » : Problème P5.5. « CondaHTTPError » : Problème P5.11. « No space left on device » : Problème P5.8."}]},{"h":"Étape 8 - Activer geoenv","i":[{"k":"cmd","w":"ub","c":"conda activate geoenv"},{"k":"note","n":"ok","t":"L'invite devient `(geoenv) aminata@NOM-DU-PC:~$`."},{"k":"note","n":"warn","t":"L'activation ne dure que le temps du terminal. À chaque nouvelle ouverture d'Ubuntu, tapez `conda activate geoenv` (ou l'alias `geo` du tutoriel 04)."}]},{"h":"Étape 9 - Vérifier l'installation","i":[{"k":"cmd","w":"geo","c":"which python\npython --version\npython -c \"import xarray, geopandas, rioxarray, regionmask, cartopy; print('OK', xarray.__version__, geopandas.__version__)\"\ncdo -V 2>&1 | head -n 1\nncdump 2>&1 | tail -n 1"},{"k":"out","t":"/home/aminata/miniconda3/envs/geoenv/bin/python\nPython 3.11.x\nOK 2025.x.x 1.x.x\nClimate Data Operators version 2.x.x (https://mpimet.mpg.de/cdo)\nnetcdf library version 4.9.x ..."},{"k":"note","n":"ok","t":"Le chemin de python contient `envs/geoenv` et la ligne commence par « OK ». Les numéros de version exacts peuvent différer."},{"k":"note","n":"fail","t":"`which python` affiche /usr/bin/python ou rien : P5.7. « ModuleNotFoundError » : P5.7. Erreur mentionnant GDAL, PROJ ou « numpy » : P5.13 et P5.14."}]},{"h":"Étape 10 - Gérer ses environnements","i":[{"k":"table","h":["Commande","Rôle"],"r":[["`conda activate geoenv`","activer geoenv"],["`conda deactivate`","quitter l'environnement actif (retour à base)"],["`conda env list`","lister les environnements (l'actif est marqué *)"],["`conda list`","lister les paquets de l'environnement actif"],["`conda list xarray`","version d'un paquet précis"],["`conda env export --from-history > geoenv_sauvegarde.yml`","sauvegarder la recette de geoenv"],["`conda create -n geoenv2 --clone geoenv`","copier un environnement (pour tester sans risque)"],["`conda remove -n geoenv --all`","supprimer complètement geoenv (à faire depuis base)"],["`conda clean --all -y`","supprimer les fichiers téléchargés inutiles (libère souvent plusieurs Go)"]]}]}],"check":["`conda --version` affiche un numéro de version.","`conda config --show channels` affiche seulement conda-forge.","`conda env list` affiche geoenv.","Après `conda activate geoenv`, l'invite commence par (geoenv).","`which python` affiche un chemin contenant miniconda3/envs/geoenv.","Le test d'importation de l'étape 9 affiche « OK ».","`cdo -V` affiche une version de CDO."],"faq":[{"q":"Miniconda, Anaconda ou Miniforge ?","a":"Anaconda installe des centaines de paquets inutiles (plusieurs Go). Miniconda et Miniforge sont minimalistes ; Miniforge est déjà réglé sur conda-forge. Le parcours fonctionne avec les deux, à condition de n'utiliser que conda-forge."},{"q":"Pourquoi Python 3.11 ?","a":"C'est une version récente et stable, compatible avec toutes les bibliothèques du cours, y compris les plus spécialisées (xESMF, ESMF, certaines bibliothèques d'apprentissage automatique)."},{"q":"J'ai déjà Anaconda sous Windows. Est-il utilisé dans Ubuntu ?","a":"Non. Le conda de Windows et celui d'Ubuntu sont totalement séparés. Dans Ubuntu, seul le Miniconda installé dans `~/miniconda3` compte."},{"q":"Puis-je créer d'autres environnements ?","a":"Oui, un par projet si nécessaire : `conda create -n projet_dengue -c conda-forge python=3.11 pandas scikit-learn -y`. Ils ne se perturbent pas entre eux."},{"q":"Dois-je taper « -c conda-forge » à chaque fois ?","a":"Après l'étape 6, ce n'est plus obligatoire, mais le garder ne fait aucun mal et rend les commandes explicites."},{"q":"Comment installer le même environnement sur un autre PC ?","a":"Exportez la recette (`conda env export --from-history > geoenv.yml`), copiez le fichier, puis `conda env create -f geoenv.yml` sur l'autre PC."}],"ver":"Version 2.0 - septembre 2026","part":"python"},{"num":"06","title":"Installer les packages Python pour le climat et les données","sub":"Les bibliothèques du cours classées par niveau, leur rôle, leur installation dans geoenv, la vérification automatique et l'utilisation de Jupyter.","obj":"Compléter geoenv avec les bibliothèques utiles au cours, vérifier l'ensemble et lancer Jupyter.","dur":"20 à 60 minutes selon les niveaux installés.","pre":"Tutoriel 05 terminé (geoenv créé et vérifié).","ou":"Ubuntu, avec (geoenv) actif : commencez toujours par conda activate geoenv (ou geo).","fin":"Le script de vérification affiche « OK » pour le niveau 1 et le niveau 2, et une carte de test test_geoenv.png.","blocks":[{"h":"1. Organisation des packages en trois niveaux","i":[{"k":"table","h":["Niveau","Contenu","Faut-il l'installer ?"],"r":[["1. Socle obligatoire","lire, calculer, cartographier des données climatiques","Oui (déjà installé au tutoriel 05)"],["2. Recommandé","statistiques, apprentissage automatique, regrillage, cartes interactives, tableaux de bord, Excel","Oui, pour suivre tout le cours"],["3. Spécialisé","OpenStreetMap, krigeage, bases de données, traitement du langage, Earth Engine","Seulement si votre projet en a besoin"]]},{"k":"note","n":"warn","t":"Avant toute installation : l'invite doit commencer par `(geoenv)`. Sinon, tapez `conda activate geoenv`. Installer dans `(base)` est une erreur fréquente (Problème P6.3)."}]},{"h":"2. Niveau 1 : socle obligatoire (déjà installé)","i":[{"k":"pkgs","lvl":1}]},{"h":"Étape 1 - Installer le niveau 2 (recommandé)","i":[{"k":"cmd","w":"geo","c":"conda install -c conda-forge seaborn statsmodels scikit-learn bottleneck dask zarr h5netcdf fsspec xesmf rasterstats fiona pyshp contextily plotly folium branca dash streamlit streamlit-folium openpyxl xlrd tabulate tqdm jupyterlab ipywidgets nbformat pillow imageio -y"},{"k":"p","t":"Commande sur une seule ligne. Durée : 5 à 20 minutes. Les paquets déjà installés au tutoriel 05 sont simplement conservés."},{"k":"note","n":"fail","t":"« PackagesNotFoundError » : P6.1. Résolution interminable ou conflit : P6.2 (installez alors par petits groupes)."},{"k":"pkgs","lvl":2}]},{"h":"4. Niveau 3 : spécialisé (selon vos besoins)","i":[{"k":"p","t":"Installez chaque groupe **séparément**, seulement si nécessaire. Ainsi, un paquet problématique ne bloque pas les autres."},{"k":"pkgs","lvl":3},{"k":"p","t":"**Packages obsolètes de l'ancienne liste**"},{"k":"table","h":["Ancien package","Statut","À utiliser à la place"],"r":[["pandas-profiling","renommé","ydata-profiling"],["xlwt, xlutils","abandonnés (ancien format .xls)","openpyxl et le format .xlsx"],["psycopg2-binary","nom propre à pip","psycopg2 avec conda"]]}]},{"h":"Étape 2 - Lancer le script de vérification","i":[{"k":"p","t":"Placez-vous dans le dossier du cours (créé au tutoriel 03), puis lancez le script fourni :"},{"k":"cmd","w":"geo","c":"cd \"$WIN/Documents/cours_climat\"\npython /mnt/c/Users/<NomWindows>/Downloads/outil_06_verifier_geoenv.py"},{"k":"out","t":"Python : 3.11.x (/home/aminata/miniconda3/envs/geoenv/bin/python)\n=== Niveau 1 - Socle obligatoire ===\n  OK         numpy 2.x.x\n  OK         xarray 2025.x.x\n  ...\n=== Niveau 3 - Spécialisé (facultatif) ===\n  MANQUANT   pykrige (No module named 'pykrige')\n...\n=== Test pratique : NetCDF + carte ===\n  OK  fichier test_geoenv.nc écrit et relu ((21, 27))\n  OK  figure test_geoenv.png créée dans : /mnt/c/Users/Aminata/Documents/cours_climat\n=== Bilan ===\nNiveau 3 - Spécialisé (facultatif) : 16 manquant(s)\n  conda install -c conda-forge pykrige osmnx ... -y"},{"k":"note","n":"ok","t":"Tout est « OK » pour les niveaux 1 et 2, et la figure est créée. Les « MANQUANT » du niveau 3 sont normaux si vous ne l'avez pas installé. Le bilan donne la commande exacte pour installer ce qui manque."},{"k":"p","t":"Ouvrez la carte de test :"},{"k":"cmd","w":"geo","c":"explorer.exe test_geoenv.png"},{"k":"note","n":"tip","t":"Au premier tracé, cartopy télécharge les côtes et frontières (Natural Earth) : il faut Internet et quelques secondes de plus. Ensuite, elles sont conservées sur le disque."}]},{"h":"Étape 3 - Enregistrer geoenv comme noyau Jupyter","i":[{"k":"cmd","w":"geo","c":"python -m ipykernel install --user --name geoenv --display-name \"Python (geoenv)\""},{"k":"p","t":"Ainsi, le noyau « Python (geoenv) » est toujours proposé dans Jupyter, même lancé depuis un autre environnement."}]},{"h":"Étape 4 - Lancer Jupyter Lab ou Jupyter Notebook","i":[{"k":"cmd","w":"geo","c":"cd \"$WIN/Documents/cours_climat\"\njupyter lab --no-browser"},{"k":"p","t":"(ou les alias `jl` et `j`). Le terminal affiche une adresse :"},{"k":"out","t":"    To access the server, open this file in a browser:\n        ...\n    Or copy and paste one of these URLs:\n        http://localhost:8888/lab?token=3f2a9c...e71\n        http://127.0.0.1:8888/lab?token=3f2a9c...e71"},{"k":"ul","i":["Maintenez **Ctrl** et cliquez sur l'adresse `http://localhost:8888/...`, ou copiez-la (sélection puis Ctrl + Maj + C) dans votre navigateur Windows (Chrome, Edge, Firefox).","Dans Jupyter, choisissez le noyau **Python (geoenv)**.","Laissez le terminal ouvert tant que vous travaillez : le fermer arrête Jupyter.","Pour arrêter : dans le terminal, **Ctrl + C**, puis **y** et Entrée."]},{"k":"note","n":"fail","t":"Navigateur qui ne s'ouvre pas, port occupé, mot de passe ou jeton demandé : P6.4. Module introuvable dans Jupyter mais présent dans le terminal : P6.3."}]},{"h":"(Facultatif) Travailler avec Visual Studio Code","i":[{"k":"ul","i":["Installez Visual Studio Code sous Windows (site officiel de Microsoft), puis l'extension **WSL** (éditeur Microsoft) et l'extension **Python**.","Dans Ubuntu, placez-vous dans votre dossier de projet et tapez `code .` : VS Code s'ouvre connecté à Ubuntu (la première fois, il installe un petit serveur, patientez).","En bas à droite de VS Code (ou Ctrl + Maj + P > « Python: Select Interpreter »), choisissez l'interpréteur geoenv (`~/miniconda3/envs/geoenv/bin/python`)."]}]},{"h":"Règles pour installer un nouveau package plus tard","i":[{"k":"ol","i":["`conda activate geoenv`.","Chercher s'il existe sur conda-forge : `conda search -c conda-forge <nom>`.","S'il existe : `conda install -c conda-forge <nom> -y`.","Sinon seulement : `python -m pip install <nom>` (toujours `python -m pip`, jamais `sudo pip`).","Si l'environnement devient instable : le recréer (tutoriel 05, P5.5). C'est rapide et sans risque pour vos scripts et données."]}]}],"check":["Le script de vérification affiche « OK » pour tout le niveau 1.","Le niveau 2 est installé et vérifié (ou je sais exactement ce qui manque et pourquoi).","La figure test_geoenv.png s'ouvre dans Windows.","Jupyter Lab s'ouvre dans mon navigateur avec le noyau « Python (geoenv) ».","Je sais arrêter Jupyter (Ctrl + C puis y)."],"faq":[{"q":"Dois-je installer les trois niveaux ?","a":"Non. Niveaux 1 et 2 pour suivre le cours ; niveau 3 uniquement pour un besoin précis."},{"q":"Combien d'espace occupe geoenv ?","a":"Environ 3 à 5 Go avec les niveaux 1 et 2 ; plus de 7 Go avec pytorch et transformers. `conda clean --all -y` libère les fichiers d'installation."},{"q":"Puis-je utiliser Spyder ?","a":"Oui : `conda install -c conda-forge spyder -y` puis `spyder &` (nécessite l'affichage graphique, voir P2.8). Visual Studio Code est une alternative plus légère."},{"q":"Pourquoi « python » ici et « python3 » ailleurs ?","a":"Dans geoenv, `python` et `python3` désignent le même Python de l'environnement. Hors environnement, seul `python3` (celui d'Ubuntu) existe. L'alias `p` (python3) fonctionne donc dans les deux cas."}],"ver":"Version 2.0 - septembre 2026","part":"python"},{"num":"07","title":"Aide-mémoire des commandes : WSL, Ubuntu, Conda et CDO","sub":"Toutes les commandes utiles du parcours, regroupées par usage, à garder sous la main.","obj":"Retrouver en quelques secondes la bonne commande et l'endroit où la taper.","dur":"Référence.","pre":"Aucun.","ou":"<...> est à remplacer par votre valeur ; PS = à taper dans PowerShell ; toutes les autres commandes se tapent dans Ubuntu.","fin":"Une fiche à garder sous la main.","blocks":[{"h":"Toutes les commandes sont dans l'onglet Commandes","i":[{"k":"p","t":"L'onglet **Commandes** reprend l'intégralité de l'aide-mémoire, avec une recherche et des filtres par usage (WSL, fichiers, Windows, apt, éditeurs, conda, CDO/NCO, clavier, alias). Chaque commande a un bouton **Copier**."},{"k":"goto","view":"commandes","label":"Ouvrir l'aide-mémoire complet"}]},{"h":"Les opérateurs CDO s'enchaînent","i":[{"k":"p","t":"Exemple : cumul annuel de pluie, puis moyenne spatiale sur un cadre autour du Sénégal, en une seule commande (lue de droite à gauche : découper, puis cumuler par année, puis moyenner dans l'espace) :"},{"k":"cmd","w":"geo","c":"cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc pluie_annuelle_senegal.nc"}]},{"h":"Routine de travail quotidienne","i":[{"k":"cmd","w":"ub","c":"# 1. Ouvrir Ubuntu (menu Démarrer), puis :\ngeo                                   # activer geoenv\ncd \"$WIN/Documents/cours_climat\"      # aller dans le projet\njl                                    # lancer Jupyter Lab, ou :\np scripts/mon_analyse.py              # exécuter un script\nex                                    # voir les résultats dans Windows"}]}],"check":[],"faq":[],"ver":"Version 2.0 - septembre 2026","part":"ref"},{"num":"08","title":"Dépannage général et foire aux questions","sub":"Méthode de dépannage, index de toutes les erreurs du parcours, sauvegarde et réinstallation, performances, et réponses aux questions des étudiants.","obj":"Savoir diagnostiquer seul une erreur et trouver sa solution.","dur":"Référence.","pre":"Aucun.","ou":"PowerShell ou Ubuntu selon le cas (indiqué à chaque commande).","fin":"L'index de toutes les erreurs et leurs solutions.","blocks":[{"h":"1. Méthode de dépannage en 7 étapes","i":[{"k":"table","h":["N°","Action","Détail"],"r":[["1","Lire le message","Les dernières lignes contiennent la cause : « Error », « not found », « denied », un code 0x8..."],["2","Situer le problème","Dans PowerShell ou Ubuntu ? geoenv est-il actif (invite `(geoenv)`) ? Dans quel dossier (`pwd`) ?"],["3","Chercher dans l'index","Onglet **Dépannage** : repérez le code (P1.2, P5.4...) et appliquez la solution."],["4","Redémarrer WSL","Fermer Ubuntu, `wsl --shutdown` dans PowerShell, rouvrir Ubuntu. Si besoin, redémarrer le PC."],["5","Relancer la même commande","Beaucoup d'échecs viennent d'une coupure réseau passagère ; conda et `wget -c` reprennent là où ils se sont arrêtés."],["6","Rechercher le message exact","Copiez la ligne d'erreur, entre guillemets, dans un moteur de recherche, sans vos noms de dossiers personnels."],["7","Demander de l'aide","Avec les 5 éléments du tutoriel 00, section 7, et le diagnostic ci-dessous."]]},{"k":"goto","view":"depannage","label":"Ouvrir l'index des erreurs"}]},{"h":"2. Diagnostic : informations à joindre à une demande d'aide","i":[{"k":"cmd","w":"ps","c":"winver\nwsl --version\nwsl -l -v"},{"k":"cmd","w":"ub","c":"lsb_release -a              # version d'Ubuntu\ndf -h ~                     # espace disque libre\nfree -h                     # mémoire disponible\necho \"$WIN\"                 # dossier Windows utilisé par les alias\nconda info                  # configuration de conda\nconda env list              # environnements\nconda activate geoenv && which python && python --version"}]},{"h":"3. Sauvegarder","i":[{"k":"ul","i":["**Vos travaux** (scripts, données, figures) : s'ils sont dans vos Documents Windows, ils sont sauvegardés comme vos autres fichiers Windows. S'ils sont dans `~`, copiez-les régulièrement vers Windows : `cp -r ~/projets \"$WIN/Documents/\"`.","**La recette de geoenv** : `conda env export --from-history > \"$WIN/Documents/geoenv_sauvegarde.yml\"`.","**Tout Ubuntu** (avant une manipulation risquée), dans PowerShell :"]},{"k":"cmd","w":"ps","c":"mkdir D:\\Sauvegardes\nwsl --shutdown\nwsl --export Ubuntu D:\\Sauvegardes\\ubuntu_sauvegarde.tar"},{"k":"p","t":"Le fichier peut peser 5 à 15 Go. Remplacez D: par un disque ou une clé disposant d'assez d'espace."},{"k":"p","t":"**Restaurer une sauvegarde complète** :"},{"k":"cmd","w":"ps","c":"wsl --import UbuntuRestaure C:\\WSL\\UbuntuRestaure D:\\Sauvegardes\\ubuntu_sauvegarde.tar\nwsl -d UbuntuRestaure"},{"k":"p","t":"Une distribution importée s'ouvre en root : définissez votre utilisateur par défaut comme au Problème P2.12."}]},{"h":"4. Réparer sans tout réinstaller","i":[{"k":"table","h":["Élément en panne","Réparation","Voir"],"r":[["Alias ou ~/.bashrc","restaurer la copie `~/.bashrc.sauvegarde...` ou relancer `outil_04_installer_alias.sh`","P4.4, P4.9"],["Environnement geoenv","le supprimer et le recréer (10 à 20 minutes) ; vos scripts ne sont pas touchés","P5.5"],["Miniconda entier","supprimer `~/miniconda3`, nettoyer `~/.bashrc`, réinstaller","P5.12, tutoriel 05"],["WSL lui-même","`wsl --update`, puis `wsl --shutdown`","P1.5, P1.10"]]},{"k":"p","t":"**Réinstaller Ubuntu à neuf (dernier recours)**"},{"k":"note","n":"danger","t":"`wsl --unregister` efface définitivement Ubuntu, votre dossier personnel `~`, Miniconda et geoenv. Sauvegardez d'abord. Vos fichiers situés dans les dossiers Windows ne sont pas touchés."},{"k":"cmd","w":"psa","c":"wsl --unregister Ubuntu\nwsl --install -d Ubuntu"},{"k":"p","t":"Puis reprenez les tutoriels 02 à 06."}]},{"h":"5. Performances et espace disque","i":[{"k":"ul","i":["Limiter ou augmenter la mémoire de WSL : fichier `C:\\Users\\<VotreNom>\\.wslconfig` (tutoriel 06, P6.8), puis `wsl --shutdown`.","Libérer de l'espace : `conda clean --all -y`, `sudo apt autoremove -y && sudo apt clean`, supprimer les installateurs `~/miniconda.sh`.","Accélérer les projets à nombreux fichiers : travailler dans `~` plutôt que dans `/mnt/c` (P3.4).","Arrêter WSL quand vous avez terminé pour rendre la mémoire à Windows : `wsl --shutdown`.","L'espace libéré dans Ubuntu n'est pas toujours rendu immédiatement à Windows. C'est normal ; la place reste disponible pour Ubuntu."]}]},{"h":"6. Je suis sur Mac","i":[{"k":"p","t":"Ignorez les tutoriels 01 et 02 : macOS dispose déjà d'un terminal (Applications > Utilitaires > Terminal). Au tutoriel 05, téléchargez l'installateur macOS au lieu de celui pour Linux :"},{"k":"cmd","w":"mac","c":"# Mac Apple Silicon (M1, M2, M3...) :\ncurl -L -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh\n# Mac Intel :\ncurl -L -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh\nbash ~/miniconda.sh -b -p ~/miniconda3\n~/miniconda3/bin/conda init zsh"},{"k":"p","t":"Le terminal Mac utilise **zsh** : remplacez `~/.bashrc` par `~/.zshrc` au tutoriel 04 et définissez WIN sur votre dossier (par exemple `export WIN=\"$HOME\"`). Les tutoriels 05 et 06 s'appliquent ensuite tels quels, sans `explorer.exe` (utilisez `open .`)."}]}],"check":[],"faq":[{"q":"Je suis déjà sous Linux (Ubuntu installé sur le PC).","a":"Commencez au tutoriel 02 (étape 4), puis 03 (les parties sur /mnt/c ne vous concernent pas), 04 (avec `export WIN=\"$HOME\"`), 05 et 06."},{"q":"Puis-je utiliser Anaconda ou Python sous Windows à la place de WSL ?","a":"Pour du Python simple, oui. Mais CDO, xESMF/ESMF et plusieurs outils du cours ne fonctionnent pas sous Windows, et les commandes du cours sont celles de Linux. Le parcours s'appuie donc sur WSL."},{"q":"Combien de données Internet faut-il prévoir ?","a":"Environ 3 à 5 Go au total : Ubuntu et ses mises à jour (1 à 1,5 Go), Miniconda (150 Mo), geoenv niveaux 1 et 2 (1,5 à 3 Go). Faites l'installation depuis un lieu bien connecté ; `wget -c` et conda reprennent après une coupure."},{"q":"Mon PC n'a que 4 Go de RAM. Est-ce possible ?","a":"Oui, mais c'est lent. Fermez le navigateur et les autres logiciels pendant les installations, travaillez sur des sous-ensembles de données (région, période) et utilisez dask (P6.8)."},{"q":"Dois-je refaire l'installation à chaque séance ?","a":"Non. Une fois le parcours terminé, suivez simplement la routine quotidienne du tutoriel 07."},{"q":"Puis-je endommager Windows avec Ubuntu ?","a":"Pas en suivant le parcours. Le seul risque réel est la suppression de fichiers Windows avec `rm` sous `/mnt/c` : vérifiez toujours avec `pwd` et `ls` avant de supprimer."},{"q":"Mon antivirus signale ou bloque quelque chose.","a":"WSL, Ubuntu et Miniconda sont des logiciels légitimes. Si un antivirus tiers bloque l'installation, désactivez-le temporairement pendant l'installation (P1.10), ou ajoutez une exception."},{"q":"Quelle est la différence entre PowerShell et le terminal Ubuntu ?","a":"PowerShell est le terminal de Windows ; il sert seulement à gérer WSL (`wsl ...`). Tout le travail (fichiers, conda, Python) se fait dans le terminal Ubuntu."},{"q":"Qu'est-ce que sudo ?","a":"« Super-utilisateur, fais » : exécute une commande avec les droits d'administrateur Linux. Il sert à `apt` et aux fichiers système. Jamais avec conda ou pip."},{"q":"Pourquoi rien ne s'affiche quand je tape mon mot de passe ?","a":"C'est une protection normale. Tapez-le puis Entrée."},{"q":"Comment utiliser le Terminal Windows avec plusieurs onglets ?","a":"Installez « Terminal Windows » depuis le Microsoft Store (déjà présent sur Windows 11). Le bouton ˅ ouvre un onglet Ubuntu ou PowerShell. Vous pouvez choisir Ubuntu comme profil par défaut dans ses Paramètres."},{"q":"Comment désinstaller complètement WSL et Ubuntu ?","a":"Sauvegardez vos travaux, puis dans PowerShell : `wsl --unregister Ubuntu`. Désinstallez ensuite « Ubuntu » et « Sous-système Windows pour Linux » dans Paramètres > Applications."},{"q":"Pourquoi dois-je activer geoenv à chaque fois ?","a":"Chaque terminal démarre dans (base). L'activation indique quel Python et quelles bibliothèques utiliser. Pour l'automatiser : `echo \"conda activate geoenv\" >> ~/.bashrc`."},{"q":"J'ai installé un paquet avec pip par erreur. Est-ce grave ?","a":"Pas forcément. En cas d'erreurs (P5.13, P5.14), désinstallez-le avec `pip uninstall <nom>` et réinstallez-le avec conda. En dernier recours, recréez geoenv."},{"q":"Mon script fonctionne dans le terminal mais pas dans Jupyter (ou l'inverse).","a":"Les deux n'utilisent pas le même Python. Voir P6.3 : choisissez le noyau « Python (geoenv) »."},{"q":"Comment partager mon environnement avec un collègue ?","a":"Envoyez le fichier .yml exporté (tutoriel 05, étape 10) ; il le recrée avec `conda env create -f fichier.yml`."},{"q":"Les versions de mes paquets diffèrent de celles du tutoriel. Est-ce un problème ?","a":"Non. Les numéros de version évoluent ; les tutoriels montrent des exemples. Seul compte le « OK » des vérifications."},{"q":"Où trouver de l'aide sur une fonction Python ?","a":"Dans Python ou Jupyter : `help(xr.open_dataset)`, ou `xr.open_dataset?` dans Jupyter. La documentation officielle de chaque bibliothèque contient de nombreux exemples."}],"ver":"Version 2.0 - septembre 2026","part":"ref"},{"num":"09","title":"Mode d'emploi des trois outils du cours","sub":"Comment lancer les fichiers outil_04 (.sh), outil_05 (.yml) et outil_06 (.py), expliqué pas à pas avec un exemple concret.","obj":"Savoir lancer les trois fichiers outils, dans le bon ordre, sans les ouvrir ni copier leur contenu.","dur":"Environ 30 minutes en tout (dont 10 à 20 minutes d'installation automatique pour l'outil 05).","pre":"Tutoriels 00 à 03 terminés : Ubuntu installé et à jour.","ou":"Ubuntu (terminal WSL) uniquement. Jamais dans PowerShell, jamais par double-clic dans Windows.","fin":"Les raccourcis installés, l'environnement geoenv créé et vérifié, la carte de test affichée.","blocks":[{"h":"Toutes les instructions sont dans l'onglet Outils","i":[{"k":"p","t":"Un **fichier outil** est une liste de commandes déjà écrites à l'avance. On ne l'ouvre pas et on ne copie pas son contenu : on demande à Ubuntu de l'exécuter en tapant un mot devant son nom. C'est comme une recette confiée à un cuisinier : vous ne lisez pas la recette à voix haute ligne par ligne, vous la lui donnez et il l'exécute."},{"k":"goto","view":"outils","label":"Ouvrir le mode d'emploi des outils"}]}],"check":["`m` puis `pwd` affiche mon dossier Windows.","`conda env list` affiche geoenv.","L'outil 06 affiche « OK » pour tout le niveau 1.","La carte test_geoenv.png s'ouvre dans Windows."],"faq":[],"ver":"Version 2.0 - septembre 2026","part":"python"}],"problems":[{"code":"P1A.1","tuto":"01A","title":"Le BIOS demande un mot de passe","see":["Un cadre « Enter Password » ou « Supervisor Password » s'affiche à l'entrée du BIOS."],"why":"Le propriétaire du PC (souvent l'université, l'entreprise ou le vendeur) a protégé le BIOS.","fix":[{"k":"p","t":"N'essayez pas de deviner le mot de passe (le PC peut se bloquer). Demandez-le au propriétaire ou au service informatique. Sinon, utilisez un autre PC."}]},{"code":"P1A.2","tuto":"01A","title":"Impossible d'entrer dans le BIOS avec la touche","see":["Windows démarre normalement malgré les pressions sur F2, F1, F10..."],"why":"Le démarrage rapide de Windows est trop court pour laisser le temps d'appuyer, ou la touche F exige la touche Fn.","fix":[{"k":"ul","i":["Utilisez la **méthode A** (depuis Windows) : elle ne dépend d'aucune touche.","Essayez **Fn + F2** (ou Fn + la touche indiquée) : sur beaucoup de portables, les touches F servent d'abord au volume ou à la luminosité.","Faites un vrai **redémarrage** (Démarrer > Marche/Arrêt > Redémarrer, et non « Arrêter ») et commencez à appuyer dès que l'écran devient noir.","Lenovo IdeaPad : utilisez le **bouton Novo**."]}]},{"code":"P1A.3","tuto":"01A","title":"Option de virtualisation introuvable ou grisée","see":["Aucune option « Virtualization », « VT-x » ou « SVM » dans les menus, ou elle ne peut pas être modifiée."],"why":"L'option est dans un autre menu, le BIOS est trop ancien, elle est verrouillée par un mot de passe administrateur, ou le processeur ne la gère pas (très rare sur les PC de moins de 10 ans).","fix":[{"k":"ul","i":["Parcourez **tous** les onglets : Advanced, Configuration, Security, System Configuration, CPU Configuration, Chipset.","Asus : passez en mode avancé avec **F7**.","Mettez à jour le BIOS avec l'outil du fabricant, depuis Windows : Lenovo Vantage, HP Support Assistant, Dell SupportAssist ou MyASUS. **Ne coupez jamais le courant pendant une mise à jour du BIOS.**","Si l'option est grisée, voir P1A.1 (mot de passe administrateur du BIOS)."]}]},{"code":"P1A.4","tuto":"01A","title":"Toujours « Désactivé » après la modification","see":["La ligne « Virtualisation » indique toujours « Désactivé » après le redémarrage."],"why":"La modification n'a pas été enregistrée (sortie sans F10), ou la mauvaise option a été modifiée.","fix":[{"k":"p","t":"Retournez dans le BIOS, vérifiez que l'option est sur **Enabled**, puis sortez obligatoirement avec **F10 > Yes** (ou Save Changes and Exit). Faites un arrêt complet puis rallumez le PC si nécessaire."}]},{"code":"P1A.5","tuto":"01A","title":"Windows demande une clé de récupération BitLocker","see":["Écran bleu « Récupération BitLocker : entrez la clé de récupération pour ce lecteur »."],"why":"Le disque est chiffré par BitLocker, qui se méfie des modifications du BIOS.","fix":[{"k":"p","t":"La clé est un code de 48 chiffres. Elle se trouve dans votre compte Microsoft : depuis un téléphone, ouvrez **aka.ms/myrecoverykey**, connectez-vous avec le compte Microsoft du PC et recopiez la clé correspondant à l'identifiant affiché à l'écran."},{"k":"p","t":"**Prévention** (avant d'entrer dans le BIOS) : dans l'Explorateur, clic droit sur C: ; si « Gérer BitLocker » indique que BitLocker est activé, notez la clé via **Sauvegarder votre clé de récupération**, ou choisissez **Suspendre la protection** jusqu'au prochain redémarrage."}]},{"code":"P1A.6","tuto":"01A","title":"Windows ne démarre plus après passage dans le BIOS","see":["Écran noir, message « No bootable device » ou redémarrages en boucle."],"why":"Une autre option que la virtualisation a été modifiée par erreur (mode de démarrage, disque).","fix":[{"k":"p","t":"Retournez dans le BIOS, remettez les options modifiées à leur valeur d'origine, enregistrez avec F10. N'utilisez pas « Load Defaults » sans aide : cela peut modifier d'autres réglages. Demandez de l'aide à l'enseignant ou au service informatique."}]},{"code":"P1A.7","tuto":"01A","title":"Le clavier tape les mauvaises lettres dans le BIOS","see":["En tapant y pour « Yes », un autre caractère s'affiche."],"why":"Le BIOS utilise un clavier anglais (QWERTY) : sur un clavier français (AZERTY), certaines lettres sont inversées (A/Q, Z/W).","fix":[{"k":"p","t":"Utilisez les **flèches** et **Entrée** pour choisir « Yes » plutôt que de taper des lettres."}]},{"code":"P1.1","tuto":"01","title":"Windows trop ancien ou « wsl » non reconnu","see":["« wsl : Le terme « wsl » n'est pas reconnu comme nom d'applet de commande... »","ou `wsl --install` affiche seulement la liste des options, sans installer."],"why":"Votre Windows 10 est antérieur à la version 2004 : la commande `wsl --install` n'existe pas encore.","fix":[{"k":"ol","i":["Ouvrez Paramètres > Windows Update > Rechercher des mises à jour et installez tout, y compris les « mises à jour de fonctionnalités ». Redémarrez autant de fois que demandé.","Vérifiez de nouveau avec `winver`, puis reprenez l'étape 4.","Si la mise à jour est impossible, utilisez la méthode manuelle (étape 4 bis) ; sur un Windows 10 très ancien (1909 ou avant), WSL 2 ne sera pas disponible : la mise à jour de Windows est obligatoire."]}]},{"code":"P1.2","tuto":"01","title":"Virtualisation désactivée (erreur 0x80370102)","see":["« WslRegisterDistribution failed with error: 0x80370102 »","« Impossible de démarrer la machine virtuelle, car une fonctionnalité requise n'est pas installée. »","« Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. »"],"why":"La virtualisation du processeur est désactivée dans le BIOS/UEFI, ou le composant « Plateforme de machine virtuelle » n'est pas activé.","fix":[{"k":"p","t":"**A. Activer le composant Windows** (PowerShell Administrateur), puis redémarrer :"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"},{"k":"p","t":"**B. Activer la virtualisation dans le BIOS/UEFI** si le Gestionnaire des tâches indique toujours « Virtualisation : Désactivé » : suivez le **tutoriel 01A**, qui détaille la méthode pour chaque marque."},{"k":"p","t":"**C. Si la virtualisation est activée mais l'erreur persiste** (un ancien logiciel a désactivé l'hyperviseur) :"},{"k":"cmd","w":"psa","c":"bcdedit /set hypervisorlaunchtype auto"},{"k":"p","t":"Redémarrez, puis reprenez l'étape 4."},{"k":"note","n":"warn","t":"Dans le BIOS, ne modifiez aucune autre option. En cas de doute, choisissez « Exit without saving » et demandez de l'aide."}]},{"code":"P1.3","tuto":"01","title":"Pas de droits administrateur","see":["« Accès refusé », « The requested operation requires elevation », ou Windows demande un mot de passe administrateur inconnu."],"why":"Vous n'êtes pas administrateur de ce PC (ordinateur de l'université, d'une entreprise ou d'un tiers).","fix":[{"k":"p","t":"Il n'existe pas de contournement : demandez au service informatique d'installer WSL et Ubuntu (donnez-lui ce tutoriel), ou utilisez un ordinateur personnel. Les tutoriels 02 à 06 ne nécessitent ensuite plus les droits administrateur Windows."}]},{"code":"P1.4","tuto":"01","title":"Sous-système non activé (erreur 0x8007019e)","see":["« WslRegisterDistribution failed with error: 0x8007019e »","« Le sous-système Windows pour Linux n'a pas été activé. »"],"why":"Le composant « Sous-système Windows pour Linux » n'est pas activé.","fix":[{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart"},{"k":"p","t":"Redémarrez l'ordinateur, puis relancez Ubuntu depuis le menu Démarrer."}]},{"code":"P1.5","tuto":"01","title":"Mise à jour du noyau nécessaire (erreur 0x800701bc)","see":["« WslRegisterDistribution failed with error: 0x800701bc »","« WSL 2 nécessite une mise à jour de son composant noyau. »"],"why":"Le noyau Linux utilisé par WSL 2 est absent ou trop ancien.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown"},{"k":"p","t":"Relancez Ubuntu. Si `wsl --update` échoue faute de connexion, téléchargez le paquet de mise à jour du noyau depuis l'adresse **https://aka.ms/wsl2kernel**, installez-le par double-clic, puis redémarrez."}]},{"code":"P1.6","tuto":"01","title":"Téléchargement bloqué, très lent ou impossible","see":["Erreurs 0x80072ee7, 0x80072efd, 0x80072f8f, 0x80190001, ou blocage à « Téléchargement : Ubuntu 0,0 % ».","« Impossible de se connecter au Microsoft Store »."],"why":"Connexion instable, réseau universitaire avec proxy, Microsoft Store bloqué, VPN actif, ou date et heure du PC incorrectes (cas de l'erreur 0x80072f8f).","fix":[{"k":"ul","i":["Vérifiez la date et l'heure : Paramètres > Heure et langue > Date et heure, activez « Régler l'heure automatiquement », puis cliquez sur « Synchroniser maintenant ».","Désactivez temporairement le VPN.","Contournez le Microsoft Store en téléchargeant directement depuis le web :"]},{"k":"cmd","w":"psa","c":"wsl --install -d Ubuntu --web-download"},{"k":"ul","i":["Changez de réseau si possible (autre Wi-Fi, ou partage de connexion du téléphone ; comptez 0,5 à 1 Go de données).","Réessayez à une heure moins chargée (tôt le matin ou le soir)."]}]},{"code":"P1.7","tuto":"01","title":"Ubuntu est installé en VERSION 1","see":["`wsl -l -v` affiche `Ubuntu  Stopped  1`."],"why":"Ubuntu a été installé avant l'activation de WSL 2, ou la version par défaut est restée à 1.","fix":[{"k":"cmd","w":"psa","c":"wsl --set-default-version 2\nwsl --set-version Ubuntu 2"},{"k":"p","t":"La conversion dure quelques minutes. Remplacez `Ubuntu` par le nom exact affiché par `wsl -l -v` (par exemple `Ubuntu-24.04`). Si une erreur de virtualisation apparaît, voir Problème P1.2."}]},{"code":"P1.8","tuto":"01","title":"Aucune distribution installée","see":["« Le sous-système Windows pour Linux n'a aucune distribution installée. »","« Windows Subsystem for Linux has no installed distributions. »"],"why":"WSL est installé, mais pas Ubuntu (téléchargement interrompu, par exemple).","fix":[{"k":"cmd","w":"psa","c":"wsl --list --online\nwsl --install -d Ubuntu"},{"k":"p","t":"La première commande affiche les distributions disponibles ; utilisez exactement le nom de la colonne NAME (par exemple `Ubuntu` ou `Ubuntu-24.04`)."}]},{"code":"P1.9","tuto":"01","title":"« wsl --version » ne fonctionne pas","see":["« Option de ligne de commande non valide : --version », ou affichage de l'aide."],"why":"Vous utilisez l'ancienne version de WSL intégrée à Windows, et non la version à jour distribuée par Microsoft.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown\nwsl --version"}]},{"code":"P1.10","tuto":"01","title":"La fenêtre Ubuntu se ferme aussitôt ou affiche un code d'erreur","see":["La fenêtre s'ouvre puis disparaît immédiatement.","« Le processus s'est terminé avec le code 4294967295 » ou « [processus terminé avec le code 1] »."],"why":"WSL est dans un état incohérent, n'est pas à jour, la virtualisation est désactivée, ou un antivirus tiers bloque le démarrage.","fix":[{"k":"p","t":"Essayez dans l'ordre, en testant Ubuntu après chaque point :"},{"k":"cmd","w":"psa","c":"wsl --shutdown\nwsl --update"},{"k":"ul","i":["Redémarrez le PC.","Vérifiez la virtualisation (étape 2 et Problème P1.2).","Désactivez temporairement l'antivirus tiers (pas Microsoft Defender) et réessayez.","En dernier recours, **uniquement si Ubuntu vient d'être installé et ne contient aucun fichier**, supprimez puis réinstallez Ubuntu :"]},{"k":"cmd","w":"psa","c":"wsl --unregister Ubuntu\nwsl --install -d Ubuntu"},{"k":"note","n":"danger","t":"`wsl --unregister` efface définitivement Ubuntu et tous les fichiers qu'il contient (dossier personnel, environnements conda). Ne l'utilisez jamais sur une installation contenant des travaux non sauvegardés (voir tutoriel 08)."}]},{"code":"P1.11","tuto":"01","title":"Ubuntu installé sur un autre disque que C: (erreur 0x80070003)","see":["« WslRegisterDistribution failed with error: 0x80070003 » ou « Le chemin d'accès spécifié est introuvable »."],"why":"WSL ne fonctionne que si la distribution est installée sur le disque système (C:). Windows est réglé pour installer les nouvelles applications sur un autre disque (D:, E:...).","fix":[{"k":"ul","i":["Ouvrez Paramètres > Système > Stockage > Paramètres de stockage avancés > Emplacement d'enregistrement du nouveau contenu.","Réglez « Les nouvelles applications seront enregistrées sur » sur **C:**.","Désinstallez l'application Ubuntu (Paramètres > Applications), puis reprenez l'étape 4."]}]},{"code":"P1.12","tuto":"01","title":"Espace disque insuffisant","see":["« Espace insuffisant sur le disque », erreur 0x80070070, ou installation qui échoue sans message clair."],"why":"Moins de 15 Go libres sur C:.","fix":[{"k":"ul","i":["Libérez de l'espace : videz la Corbeille et le dossier Téléchargements, désinstallez les programmes inutiles.","Utilisez l'outil Nettoyage de disque (menu Démarrer > « Nettoyage de disque » > « Nettoyer les fichiers système »).","Visez au moins 15 Go libres (30 Go recommandés), puis reprenez l'étape 4."]}]},{"code":"P2.1","tuto":"02","title":"Nom d'utilisateur refusé","see":["« adduser: Please enter a username matching the regular expression configured via the NAME_REGEX configuration variable. »"],"why":"Le nom contient une majuscule, un espace, un accent ou commence par un chiffre.","fix":[{"k":"p","t":"Ubuntu repose la question : tapez un nom en minuscules, sans espace ni accent, par exemple `aminata`."}]},{"code":"P2.2","tuto":"02","title":"Mot de passe : erreur de saisie ou oubli","see":["« Sorry, passwords do not match », « Sorry, try again » ou « sudo: 3 incorrect password attempts »."],"why":"Les deux saisies sont différentes, ou le mot de passe est oublié. Attention au clavier : vérifiez la touche Verr. Maj.","fix":[{"k":"p","t":"**Réinitialiser un mot de passe oublié** : fermez Ubuntu, puis dans PowerShell :"},{"k":"cmd","w":"ps","c":"wsl -u root"},{"k":"p","t":"Vous êtes maintenant « root » (invite terminée par `#`). Tapez, en remplaçant par votre nom Linux :"},{"k":"cmd","w":"root","c":"passwd <votre_nom_linux>\nexit"},{"k":"p","t":"Nom Linux oublié ? Dans la session root, `ls /home` l'affiche."}]},{"code":"P2.3","tuto":"02","title":"Problème de nom de domaine (DNS) : Ubuntu n'accède pas à Internet","see":["« Temporary failure resolving 'archive.ubuntu.com' »","« Could not resolve host », « Failed to fetch ... »"],"why":"Ubuntu ne parvient pas à traduire les adresses web en adresses IP. Fréquent avec un VPN, certains réseaux Wi-Fi d'université ou après une mise en veille.","fix":[{"k":"p","t":"**Test** : `ping -c 3 8.8.8.8`. Si des réponses s'affichent, le réseau fonctionne et seul le DNS est en cause. Si « Network is unreachable », vérifiez d'abord la connexion Windows."},{"k":"p","t":"**Solution A** (souvent suffisante) : désactivez le VPN, tapez `wsl --shutdown` dans PowerShell, rouvrez Ubuntu et réessayez."},{"k":"p","t":"**Solution B** (DNS fixe) : dans Ubuntu, tapez :"},{"k":"cmd","w":"ub","c":"printf '[network]\\ngenerateResolvConf = false\\n' | sudo tee -a /etc/wsl.conf"},{"k":"p","t":"Dans PowerShell : `wsl --shutdown`. Rouvrez Ubuntu, puis :"},{"k":"cmd","w":"ub","c":"sudo rm -f /etc/resolv.conf\nprintf 'nameserver 8.8.8.8\\nnameserver 1.1.1.1\\n' | sudo tee /etc/resolv.conf\nsudo apt update"},{"k":"p","t":"**Solution C** (Windows 11, réseaux avec VPN) : dans Windows, créez avec le Bloc-notes le fichier `C:\\Users\\<VotreNom>\\.wslconfig` contenant les trois lignes ci-dessous, enregistrez (type « Tous les fichiers », sans extension .txt), puis `wsl --shutdown` :"},{"k":"cmd","w":"wslconfig","c":"[wsl2]\nnetworkingMode=mirrored\ndnsTunneling=true"}]},{"code":"P2.4","tuto":"02","title":"apt est bloqué par un autre processus","see":["« E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1234 (unattended-upgr) »"],"why":"Une autre installation (souvent la mise à jour automatique d'Ubuntu) est en cours.","fix":[{"k":"ul","i":["Attendez 2 à 5 minutes, puis réessayez.","Si le message persiste : fermez Ubuntu, tapez `wsl --shutdown` dans PowerShell, rouvrez Ubuntu et relancez la commande.","Ne supprimez pas les fichiers « lock » vous-même."]}]},{"code":"P2.5","tuto":"02","title":"Installation interrompue (dpkg)","see":["« E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. »"],"why":"Une installation précédente a été interrompue (fenêtre fermée, coupure de courant ou de réseau).","fix":[{"k":"cmd","w":"ub","c":"sudo dpkg --configure -a\nsudo apt install -f\nsudo apt update && sudo apt upgrade -y"}]},{"code":"P2.6","tuto":"02","title":"Horloge décalée","see":["« Release file for http://... is not valid yet (invalid for another 5h 12min). Updates for this repository will not be applied. »"],"why":"L'horloge d'Ubuntu est décalée, souvent après une mise en veille du PC.","fix":[{"k":"cmd","w":"ub","c":"sudo hwclock -s\nsudo apt update"},{"k":"p","t":"Si la commande hwclock ne corrige pas : `wsl --shutdown` dans PowerShell, puis vérifiez que l'heure de Windows est réglée automatiquement."}]},{"code":"P2.7","tuto":"02","title":"Réseau d'université ou d'entreprise avec proxy","see":["La commande reste bloquée sur « 0% [Connecting to archive.ubuntu.com] » ou échoue avec « Connection timed out »."],"why":"Le réseau impose un serveur proxy pour sortir sur Internet.","fix":[{"k":"p","t":"Demandez au service informatique l'adresse et le port du proxy (par exemple `http://proxy.univ-labe.edu.gn:3128`, valeur fictive), puis :"},{"k":"cmd","w":"ub","c":"echo 'Acquire::http::Proxy \"http://<adresse_proxy>:<port>\";' | sudo tee /etc/apt/apt.conf.d/95proxy\necho 'Acquire::https::Proxy \"http://<adresse_proxy>:<port>\";' | sudo tee -a /etc/apt/apt.conf.d/95proxy"},{"k":"p","t":"Pour wget et conda, ajoutez aussi dans la session : `export http_proxy=http://<adresse_proxy>:<port>` et `export https_proxy=http://<adresse_proxy>:<port>`. Plus simple : faites l'installation depuis un autre réseau (domicile, partage de connexion)."}]},{"code":"P2.8","tuto":"02","title":"Les applications graphiques ne s'ouvrent pas","see":["« Gtk-WARNING **: cannot open display: :0 » ou « Error: Can't open display ».","La commande se lance mais aucune fenêtre n'apparaît."],"why":"L'affichage graphique de WSL (WSLg) n'est pas disponible : Windows 10 ancien ou WSL pas à jour.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown"},{"k":"p","t":"Rouvrez Ubuntu et réessayez `gedit &`. Si cela ne fonctionne toujours pas, utilisez les solutions de remplacement, qui suffisent pour tout le parcours :"},{"k":"table","h":["Besoin","Solution sans affichage Linux"],"r":[["Modifier un fichier","`nano fichier.py` (Ctrl + O puis Entrée pour enregistrer, Ctrl + X pour quitter)"],["Modifier avec un éditeur Windows","`notepad.exe fichier.py`, ou Visual Studio Code : `code .` (tutoriel 06)"],["Voir une image","`explorer.exe figure.png` (ouvre l'application Photos de Windows)"],["Ouvrir le dossier courant","`explorer.exe .`"]]}]},{"code":"P2.9","tuto":"02","title":"pip refuse d'installer : « externally-managed-environment »","see":["« error: externally-managed-environment × This environment is externally managed »"],"why":"Ubuntu protège son propre Python. C'est un comportement normal, pas une panne.","fix":[{"k":"p","t":"N'utilisez pas l'option `--break-system-packages`. Installez les bibliothèques dans l'environnement geoenv (tutoriels 05 et 06), après `conda activate geoenv`."}]},{"code":"P2.10","tuto":"02","title":"Paquet introuvable","see":["« E: Unable to locate package kate » ou « E: Package '...' has no installation candidate »."],"why":"La liste des paquets n'a pas été mise à jour, faute de frappe dans le nom, ou dépôt « universe » désactivé.","fix":[{"k":"cmd","w":"ub","c":"sudo apt update\nsudo add-apt-repository universe -y\nsudo apt update\nsudo apt install -y kate"}]},{"code":"P2.11","tuto":"02","title":"« n'est pas dans le fichier sudoers »","see":["« aminata is not in the sudoers file. This incident will be reported. »"],"why":"Votre compte Linux n'a pas les droits d'administration (cas rare : compte créé à la main).","fix":[{"k":"cmd","w":"ps","c":"wsl -u root"},{"k":"cmd","w":"root","c":"usermod -aG sudo <votre_nom_linux>\nexit"},{"k":"p","t":"Puis `wsl --shutdown` dans PowerShell et rouvrez Ubuntu."}]},{"code":"P2.12","tuto":"02","title":"Ubuntu s'ouvre en « root » au lieu de votre compte","see":["L'invite est `root@NOM-DU-PC:~#` (avec #)."],"why":"L'utilisateur par défaut n'est pas défini (premier lancement interrompu, ou restauration).","fix":[{"k":"p","t":"Si votre compte n'existe pas encore, créez-le : `adduser <votre_nom_linux>` puis `usermod -aG sudo <votre_nom_linux>`. Ensuite, définissez-le par défaut :"},{"k":"cmd","w":"root","c":"printf '[user]\\ndefault=<votre_nom_linux>\\n' >> /etc/wsl.conf\nexit"},{"k":"p","t":"Puis `wsl --shutdown` dans PowerShell et rouvrez Ubuntu."}]},{"code":"P2.13","tuto":"02","title":"Une question « [Y/n] » ou un écran de configuration bloque l'installation","see":["« Do you want to continue? [Y/n] » ou un écran coloré avec des choix (« Configuring ... »)."],"why":"Ubuntu demande une confirmation.","fix":[{"k":"p","t":"Tapez **Y** puis Entrée pour une question [Y/n]. Dans un écran coloré, utilisez **Tab** pour aller sur « <Ok> » et Entrée. Pour éviter la question, ajoutez `-y` à la commande `apt install`."}]},{"code":"P3.1","tuto":"03","title":"Fichier ou dossier introuvable","see":["« bash: cd: Documents: No such file or directory » ou « Aucun fichier ou dossier de ce type »."],"why":"Faute de frappe, majuscule/minuscule, espace non protégé, ou vous n'êtes pas dans le dossier que vous croyez.","fix":[{"k":"ul","i":["Tapez `pwd` pour savoir où vous êtes, puis `ls` pour voir ce qui existe réellement.","Utilisez **Tab** pour compléter les noms au lieu de les taper entièrement.","Si le nom contient un espace, mettez le chemin entre guillemets."]}]},{"code":"P3.2","tuto":"03","title":"Permission refusée","see":["« Permission denied » en ouvrant, modifiant ou exécutant un fichier."],"why":"Dossier système de Windows protégé, fichier ouvert dans une application Windows, ou script sans droit d'exécution.","fix":[{"k":"ul","i":["Travaillez dans vos propres dossiers (`/mnt/c/Users/<NomWindows>/...` ou `~`), pas dans `/mnt/c/Windows` ou `/mnt/c/Program Files`.","Fermez le fichier s'il est ouvert dans Excel, Word ou une autre application Windows.","Pour un script : lancez-le avec `bash script.sh` ou `python3 script.py`, ou rendez-le exécutable avec `chmod +x script.sh`.","N'utilisez pas `sudo` pour contourner une erreur sur les fichiers Windows."]}]},{"code":"P3.3","tuto":"03","title":"Bureau ou Documents vide ou introuvable (OneDrive)","see":["`ls /mnt/c/Users/<NomWindows>/Desktop` n'affiche rien, alors que le Bureau contient des fichiers."],"why":"OneDrive « sauvegarde » votre Bureau et vos Documents : ils sont déplacés dans le dossier OneDrive.","fix":[{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/<NomWindows>/OneDrive/"},{"k":"p","t":"Vous y trouverez Desktop ou Bureau, et Documents. Exemple : `cd \"/mnt/c/Users/<NomWindows>/OneDrive/Documents\"`."},{"k":"note","n":"warn","t":"Les fichiers OneDrive « disponibles en ligne uniquement » (icône de nuage) ne sont pas réellement sur le disque et provoquent des erreurs de lecture. Dans l'Explorateur : clic droit sur le dossier > **Toujours conserver sur cet appareil**."}]},{"code":"P3.4","tuto":"03","title":"Tout est très lent dans les dossiers Windows","see":["`ls`, `git` ou l'ouverture de nombreux fichiers prennent plusieurs secondes dans `/mnt/c`."],"why":"L'accès aux fichiers Windows depuis WSL 2 est plus lent que l'accès aux fichiers Linux.","fix":[{"k":"p","t":"Pour les projets volumineux (beaucoup de petits fichiers, dépôts git), travaillez dans `~` :"},{"k":"cmd","w":"ub","c":"mkdir -p ~/projets && cp -r /mnt/c/Users/<NomWindows>/Documents/cours_climat ~/projets/"},{"k":"p","t":"Les gros fichiers NetCDF isolés restent utilisables depuis `/mnt/c`."}]},{"code":"P3.5","tuto":"03","title":"« explorer.exe . » ouvre un mauvais dossier ou ne fait rien","see":["L'Explorateur s'ouvre sur « Documents » au lieu du dossier courant, ou rien ne se passe."],"why":"Problème ponctuel de communication entre WSL et Windows.","fix":[{"k":"p","t":"Tapez `wsl --shutdown` dans PowerShell, rouvrez Ubuntu et réessayez. Sinon, utilisez l'adresse `\\\\wsl.localhost\\Ubuntu\\home\\<votre_nom_linux>` dans la barre d'adresse de l'Explorateur."}]},{"code":"P3.6","tuto":"03","title":"« explorer.exe » ou « cmd.exe » introuvable","see":["« explorer.exe: command not found »."],"why":"L'interopérabilité avec Windows a été désactivée dans `/etc/wsl.conf`.","fix":[{"k":"cmd","w":"ub","c":"cat /etc/wsl.conf"},{"k":"p","t":"Si vous voyez `enabled = false` ou `appendWindowsPath = false` sous `[interop]`, supprimez ces lignes avec `sudo nano /etc/wsl.conf`, enregistrez, puis `wsl --shutdown` dans PowerShell."}]},{"code":"P3.7","tuto":"03","title":"Fichier supprimé par erreur","see":["Un fichier ou dossier a disparu après `rm` ou `rm -r`."],"why":"Le terminal ne passe pas par la Corbeille.","fix":[{"k":"p","t":"La récupération est généralement impossible. Si le fichier était sous `/mnt/c` et synchronisé par OneDrive ou Google Drive, consultez la corbeille en ligne de ce service. **Prévention** : `rm -i`, vérifier avec `pwd` et `ls` avant de supprimer, et sauvegarder régulièrement (clé USB, cloud)."}]},{"code":"P3.8","tuto":"03","title":"Le terminal affiche « Stopped » après Ctrl + Z","see":["« [1]+  Stopped   python3 analyse.py »"],"why":"Ctrl + Z ne signifie pas « annuler » : il suspend le programme.","fix":[{"k":"p","t":"Tapez `fg` pour reprendre le programme, puis **Ctrl + C** si vous voulez l'arrêter."}]},{"code":"P3.9","tuto":"03","title":"Le terminal affiche « > » et n'exécute plus rien","see":["Chaque Entrée affiche seulement `>`."],"why":"Un guillemet ou une apostrophe n'a pas été fermé : le terminal attend la suite.","fix":[{"k":"p","t":"Appuyez sur **Ctrl + C** pour annuler, puis retapez la commande en vérifiant les guillemets. Attention aux apostrophes typographiques ‘ ’ copiées depuis un PDF ou Word : remplacez-les par l'apostrophe droite '."}]},{"code":"P3.10","tuto":"03","title":"Script écrit sous Windows qui ne s'exécute pas","see":["« /bin/bash^M: bad interpreter » ou « $'\\r': command not found »."],"why":"Le fichier a des fins de ligne Windows (CRLF) au lieu de Linux (LF).","fix":[{"k":"cmd","w":"ub","c":"dos2unix mon_script.sh"}]},{"code":"P4.1","tuto":"04","title":"Alias inconnu juste après l'ajout","see":["« m: command not found »."],"why":"`~/.bashrc` n'a pas été relu, ou l'alias n'a pas été écrit dans le fichier.","fix":[{"k":"cmd","w":"ub","c":"source ~/.bashrc\ngrep -n \"alias m=\" ~/.bashrc"},{"k":"p","t":"Si grep n'affiche rien, l'alias n'est pas dans le fichier : refaites l'étape 2 (méthode A de préférence)."}]},{"code":"P4.2","tuto":"04","title":"L'alias disparaît à chaque nouveau terminal","see":["L'alias fonctionne, puis « command not found » après réouverture d'Ubuntu."],"why":"L'alias a été tapé directement dans le terminal, et non enregistré dans `~/.bashrc`, ou il a été écrit dans un autre fichier .bashrc (par exemple dans un dossier Windows).","fix":[{"k":"p","t":"Utilisez toujours le chemin `~/.bashrc` (avec `~/`) et refaites l'étape 2. Vérifiez avec `grep -n \"ALIAS DU COURS\" ~/.bashrc`."}]},{"code":"P4.3","tuto":"04","title":"Le terminal affiche « > » après le collage du bloc","see":["Chaque Entrée affiche `>` et rien ne se termine."],"why":"Le mot `EOF` final manque, contient un espace, ou n'a pas été collé.","fix":[{"k":"p","t":"Tapez simplement `EOF` puis Entrée (seul sur la ligne). Si rien ne change, appuyez sur Ctrl + C. Vérifiez ensuite le fichier avec `tail -n 40 ~/.bashrc`. En cas de doute, restaurez la sauvegarde (P4.4) et utilisez la méthode A."}]},{"code":"P4.4","tuto":"04","title":"Bloc d'alias ajouté deux fois (doublons)","see":["`grep -c \"ALIAS DU COURS\" ~/.bashrc` affiche 4 au lieu de 2."],"why":"Le bloc a été collé ou ajouté plusieurs fois. Ce n'est pas grave (le dernier gagne), mais le fichier devient confus.","fix":[{"k":"p","t":"Solution simple : relancez la méthode A (le script nettoie les blocs du cours). Ou restaurez la sauvegarde puis recommencez une seule fois :"},{"k":"cmd","w":"ub","c":"ls -a ~ | grep bashrc\ncp ~/.bashrc.sauvegarde ~/.bashrc\nsource ~/.bashrc"}]},{"code":"P4.5","tuto":"04","title":"« m » : dossier introuvable","see":["« bash: cd: /mnt/c/Users/User: No such file or directory » ou « cd: : No such file or directory »."],"why":"La variable WIN est vide ou contient un mauvais nom Windows (souvent `User`, hérité de l'ancienne version du cours).","fix":[{"k":"cmd","w":"ub","c":"echo \"$WIN\"\nls /mnt/c/Users/\ngrep -n \"WIN=\" ~/.bashrc\ngrep -n \"/mnt/c/Users/User\" ~/.bashrc"},{"k":"p","t":"Ouvrez `nano ~/.bashrc`, corrigez la ligne `export WIN=\"...\"` avec votre vrai nom, et supprimez les anciennes lignes `alias m='cd /mnt/c/Users/User'` s'il en reste. Enregistrez, puis `source ~/.bashrc`."}]},{"code":"P4.6","tuto":"04","title":"Erreurs à l'ouverture du terminal","see":["« bash: /home/aminata/.bashrc: line 132: syntax error near unexpected token... »","« unexpected EOF while looking for matching `'' »","« bash: alias: = : not found » ou « bash: alias: 'python3': not found »."],"why":"Une ligne de `~/.bashrc` est mal écrite : espaces autour de `=`, apostrophe non fermée, ou apostrophes typographiques ‘ ’ copiées depuis un PDF.","fix":[{"k":"p","t":"Ouvrez le fichier à la ligne indiquée (ici 132) :"},{"k":"cmd","w":"ub","c":"nano +132 ~/.bashrc"},{"k":"table","h":["Incorrect","Correct"],"r":[["`alias p = 'python3'`","`alias p='python3'`"],["`alias p=‘python3’` (apostrophes courbes)","`alias p='python3'` (apostrophes droites)"],["`alias p='python3`","`alias p='python3'`"]]},{"k":"p","t":"Ou restaurez la sauvegarde (P4.4) et utilisez la méthode A."}]},{"code":"P4.7","tuto":"04","title":"Les alias k, g ou d ne font rien","see":["« kate: command not found », « display: command not found », ou aucune fenêtre."],"why":"L'application n'est pas installée, ou l'affichage graphique ne fonctionne pas.","fix":[{"k":"cmd","w":"ub","c":"sudo apt install -y gedit eog imagemagick kate"},{"k":"p","t":"Si aucune fenêtre n'apparaît : tutoriel 02, Problème P2.8 (utilisez `n` pour nano et `voir image.png` pour ouvrir l'image dans Windows)."}]},{"code":"P4.8","tuto":"04","title":"Les alias geo ou j ne fonctionnent pas","see":["« conda: command not found », « EnvironmentNameNotFound » ou « jupyter: command not found »."],"why":"Miniconda, l'environnement geoenv ou Jupyter ne sont pas encore installés.","fix":[{"k":"p","t":"C'est normal avant les tutoriels 05 (Miniconda, geoenv) et 06 (Jupyter). Pour `j`, activez d'abord l'environnement avec `geo`."}]},{"code":"P4.9","tuto":"04","title":"Ubuntu ne démarre plus correctement après modification de ~/.bashrc","see":["Le terminal affiche des erreurs en boucle ou se ferme."],"why":"Une commande placée dans `~/.bashrc` échoue ou bloque le démarrage.","fix":[{"k":"p","t":"Ouvrez un terminal sans lire `~/.bashrc`, depuis PowerShell :"},{"k":"cmd","w":"ps","c":"wsl ~ -e bash --norc"},{"k":"p","t":"Puis restaurez la sauvegarde : `cp ~/.bashrc.sauvegarde ~/.bashrc` (ou le fichier daté créé par le script, visible avec `ls -a ~`). Fermez et rouvrez Ubuntu."}]},{"code":"P5.1","tuto":"05","title":"conda introuvable","see":["« conda: command not found » ou « Commande 'conda' introuvable »."],"why":"conda n'est pas initialisé dans `~/.bashrc`, le terminal n'a pas été rouvert, ou l'installation a échoué.","fix":[{"k":"cmd","w":"ub","c":"ls ~/miniconda3/bin/conda"},{"k":"p","t":"Si le fichier existe : initialisez puis rechargez."},{"k":"cmd","w":"ub","c":"~/miniconda3/bin/conda init bash\nsource ~/.bashrc"},{"k":"p","t":"Si « No such file or directory » : l'installation n'a pas eu lieu ou a échoué. Refaites les étapes 3 et 4. Si vous avez installé Miniforge (P5.4), le chemin est `~/miniforge3`."}]},{"code":"P5.2","tuto":"05","title":"« Run 'conda init' before 'conda activate' »","see":["« CondaError: Run 'conda init' before 'conda activate' »."],"why":"conda est trouvé, mais l'initialisation du terminal n'a pas été faite ou pas rechargée.","fix":[{"k":"cmd","w":"ub","c":"conda init bash\nsource ~/.bashrc\nconda activate geoenv"}]},{"code":"P5.3","tuto":"05","title":"Échec du téléchargement avec wget","see":["« ERROR 404: Not Found. »","« Resolving repo.anaconda.com... failed: Temporary failure in name resolution. »","« ERROR: cannot verify repo.anaconda.com's certificate »","Téléchargement interrompu avant 100 %."],"why":"404 : adresse mal recopiée (souvent une ligne coupée en deux). Résolution : problème DNS. Certificat : date du PC fausse ou proxy. Coupure : connexion instable.","fix":[{"k":"ul","i":["**404** : retapez l'adresse sur une seule ligne, sans espace à l'intérieur, en respectant les majuscules (Miniconda3, Linux).","**Résolution** : tutoriel 02, Problème P2.3.","**Certificat** : vérifiez la date et l'heure de Windows (P1.6), puis `sudo hwclock -s` ; sur un réseau à proxy, voir P2.7 ou changez de réseau.","**Coupure** : reprenez le téléchargement là où il s'est arrêté en ajoutant `-c` :"]},{"k":"cmd","w":"ub","c":"wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh"}]},{"code":"P5.4","tuto":"05","title":"Conditions d'utilisation (Terms of Service) non acceptées","see":["« CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding: https://repo.anaconda.com/pkgs/main, https://repo.anaconda.com/pkgs/r »"],"why":"Les versions récentes de Miniconda demandent d'accepter les conditions d'utilisation d'Anaconda pour ses canaux par défaut (defaults). Le cours n'utilise que conda-forge.","fix":[{"k":"p","t":"**Solution 1 : retirer les canaux par défaut** (recommandée, étape 6), puis vérifier qu'ils n'apparaissent plus nulle part :"},{"k":"cmd","w":"ub","c":"conda config --remove channels defaults\nconda config --show-sources"},{"k":"p","t":"Si `defaults` apparaît encore dans un fichier listé (par exemple `~/miniconda3/.condarc`), ouvrez ce fichier avec nano et supprimez la ligne `- defaults`."},{"k":"p","t":"**Solution 2 : accepter les conditions** (après les avoir lues) :"},{"k":"cmd","w":"ub","c":"conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main\nconda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r"},{"k":"p","t":"**Solution 3 : utiliser Miniforge** à la place de Miniconda. Miniforge est un installateur de conda configuré d'origine sur conda-forge, sans ces conditions. Toutes les commandes du parcours restent identiques ; seul le dossier change (`~/miniforge3`) :"},{"k":"cmd","w":"ub","c":"wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O ~/miniforge.sh\nbash ~/miniforge.sh -b -p ~/miniforge3\n~/miniforge3/bin/conda init bash\nsource ~/.bashrc"},{"k":"note","n":"tip","t":"Pour un PC ARM, remplacez `x86_64` par `aarch64` dans le nom du fichier Miniforge."}]},{"code":"P5.5","tuto":"05","title":"Résolution interminable ou conflits","see":["« Solving environment » pendant plus de 30 minutes.","« LibMambaUnsatisfiableError », « UnsatisfiableError » ou « The following packages are incompatible »."],"why":"Mélange de canaux (defaults et conda-forge), versions imposées incompatibles (par exemple numpy=1.26 avec un paquet récent), ou environnement modifié par de nombreuses installations successives.","fix":[{"k":"ul","i":["Vérifiez les canaux : `conda config --show channels` doit afficher seulement conda-forge (étape 6).","Vérifiez le moteur de résolution : `conda config --show solver` doit afficher `libmamba`. Sinon : `conda install -n base conda-libmamba-solver -y` puis `conda config --set solver libmamba`.","Retirez les versions imposées (`=1.26`, `=2024.6.0`) de votre commande.","Repartez de zéro avec la méthode A (une seule commande) :"]},{"k":"cmd","w":"ub","c":"conda deactivate\nconda remove -n geoenv --all -y\nconda clean --all -y"},{"k":"p","t":"puis relancez la commande de la méthode A (étape 7)."}]},{"code":"P5.6","tuto":"05","title":"Environnement introuvable","see":["« EnvironmentNameNotFound: Could not find conda environment: geoenv ».","« Not a conda environment »."],"why":"La création de geoenv a échoué ou a été interrompue, ou faute de frappe dans le nom.","fix":[{"k":"p","t":"Vérifiez avec `conda env list`. Si geoenv n'apparaît pas, refaites l'étape 7 et lisez attentivement le dernier message affiché en cas d'échec."}]},{"code":"P5.7","tuto":"05","title":"Module introuvable ou mauvais Python","see":["« ModuleNotFoundError: No module named 'xarray' ».","`which python` affiche /usr/bin/python ou rien ; « python: command not found »."],"why":"geoenv n'est pas activé (l'invite affiche (base) ou rien), ou le paquet a été installé dans un autre environnement.","fix":[{"k":"cmd","w":"ub","c":"conda activate geoenv\nwhich python\nconda list xarray"},{"k":"p","t":"Si `conda list xarray` ne renvoie rien, installez-le dans geoenv : `conda install -c conda-forge xarray -y`. Dans Jupyter, voir tutoriel 06, Problème P6.3."}]},{"code":"P5.8","tuto":"05","title":"Plus d'espace disque","see":["« No space left on device » ou « OSError: [Errno 28] »."],"why":"Le disque C: est plein (Ubuntu stocke ses fichiers sur C:).","fix":[{"k":"cmd","w":"ub","c":"conda clean --all -y\nrm -f ~/miniconda.sh ~/miniforge.sh\nsudo apt clean\ndf -h ~"},{"k":"p","t":"Libérez aussi de l'espace côté Windows (P1.12), puis relancez l'étape qui a échoué."}]},{"code":"P5.9","tuto":"05","title":"Permission refusée dans conda","see":["« PermissionError: [Errno 13] Permission denied: '/home/aminata/miniconda3/...' » ou « EnvironmentNotWritableError »."],"why":"Une commande conda ou pip a été lancée avec sudo, et des fichiers appartiennent désormais à root.","fix":[{"k":"cmd","w":"ub","c":"sudo chown -R $USER:$USER ~/miniconda3 ~/.conda"},{"k":"p","t":"Puis relancez la commande **sans** sudo."}]},{"code":"P5.10","tuto":"05","title":"Miniconda installé dans un dossier Windows","see":["`which conda` affiche un chemin commençant par /mnt/c/... ; installation très lente ; erreurs de liens symboliques."],"why":"L'installation a été lancée depuis un dossier Windows ou un chemin Windows a été choisi.","fix":[{"k":"p","t":"Supprimez ce dossier depuis l'Explorateur Windows, retirez le bloc conda de `~/.bashrc` (P5.12), puis réinstallez dans `~` (étapes 3 et 4 avec `-p ~/miniconda3`)."}]},{"code":"P5.11","tuto":"05","title":"Erreur de connexion pendant l'installation des paquets","see":["« CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/...> ».","« Read timed out » ou « ConnectionResetError »."],"why":"Connexion instable, DNS, proxy ou pare-feu.","fix":[{"k":"cmd","w":"ub","c":"conda config --set remote_read_timeout_secs 120\nconda config --set remote_max_retries 5"},{"k":"p","t":"Relancez la même commande : conda reprend les paquets déjà téléchargés. Voir aussi P2.3 (DNS) et P2.7 (proxy : `conda config --set proxy_servers.http http://<adresse_proxy>:<port>` et la même chose avec `proxy_servers.https`)."}]},{"code":"P5.12","tuto":"05","title":"Erreurs au démarrage d'Ubuntu après suppression de conda","see":["« bash: /home/aminata/miniconda3/bin/conda: No such file or directory » à chaque ouverture du terminal."],"why":"Le bloc d'initialisation de conda est resté dans `~/.bashrc` alors que Miniconda a été supprimé.","fix":[{"k":"p","t":"Ouvrez `nano ~/.bashrc` et supprimez tout le bloc compris entre `# >>> conda initialize >>>` et `# <<< conda initialize <<<` (ces deux lignes incluses). Enregistrez, puis rouvrez Ubuntu. Si vous réinstallez Miniconda juste après, `conda init bash` recréera un bloc correct."}]},{"code":"P5.13","tuto":"05","title":"Erreurs GDAL, PROJ ou bibliothèques partagées","see":["« ImportError: libgdal.so.xx: cannot open shared object file ».","« pyproj.exceptions.DataDirError » ou « PROJ: proj_create: ... »."],"why":"Mélange de paquets installés par pip et par conda pour les bibliothèques géospatiales.","fix":[{"k":"cmd","w":"geo","c":"pip uninstall -y rasterio fiona geopandas pyproj shapely\nconda install -c conda-forge --force-reinstall rasterio fiona geopandas pyproj shapely gdal -y"},{"k":"p","t":"Si l'erreur persiste, recréez geoenv (P5.5). **Règle** : ne jamais installer ces bibliothèques avec pip."}]},{"code":"P5.14","tuto":"05","title":"Incompatibilité NumPy 1 / NumPy 2","see":["« A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x... »","« numpy.dtype size changed, may indicate binary incompatibility »."],"why":"Un paquet ancien, souvent installé par pip, a été compilé pour NumPy 1 alors que geoenv contient NumPy 2.","fix":[{"k":"p","t":"Réinstallez le paquet fautif depuis conda-forge : `conda install -c conda-forge <paquet> -y`. S'il n'existe pas en version compatible, limitez NumPy : `conda install -c conda-forge \"numpy<2\" -y`."}]},{"code":"P5.15","tuto":"05","title":"« (base) » s'affiche en permanence","see":["Chaque terminal commence par (base)."],"why":"Comportement normal de conda.","fix":[{"k":"p","t":"Rien à corriger. Si cela vous gêne : `conda config --set auto_activate_base false` (il faudra alors taper `conda activate geoenv` pour travailler, ce qui reste la bonne pratique)."}]},{"code":"P6.1","tuto":"06","title":"Package introuvable","see":["« PackagesNotFoundError: The following packages are not available from current channels: - pandas-profiling »."],"why":"Faute de frappe, nom propre à pip (différent du nom conda), package renommé ou abandonné, ou oubli de `-c conda-forge`.","fix":[{"k":"p","t":"Vérifiez le nom avec le tableau ci-dessous, puis cherchez :"},{"k":"cmd","w":"geo","c":"conda search -c conda-forge <nom>"},{"k":"table","h":["Nom avec pip / à l'importation","Nom avec conda"],"r":[["sklearn (import)","scikit-learn"],["PIL (import)","pillow"],["psycopg2-binary","psycopg2"],["pandas-profiling","ydata-profiling"],["shapefile (import)","pyshp"],["ee (import)","earthengine-api"]]}]},{"code":"P6.2","tuto":"06","title":"Installation très longue ou conflit","see":["« Solving environment » interminable, « LibMambaUnsatisfiableError », ou « The following packages are incompatible »."],"why":"Trop de paquets d'un coup avec des contraintes incompatibles, ou canaux mélangés.","fix":[{"k":"p","t":"Installez par petits groupes pour trouver le paquet responsable :"},{"k":"cmd","w":"geo","c":"conda install -c conda-forge seaborn statsmodels scikit-learn -y\nconda install -c conda-forge xesmf rasterstats -y\nconda install -c conda-forge folium streamlit streamlit-folium -y"},{"k":"p","t":"Voir aussi tutoriel 05, Problème P5.5 (canaux, solveur, recréation de l'environnement)."}]},{"code":"P6.3","tuto":"06","title":"Module introuvable (surtout dans Jupyter)","see":["« ModuleNotFoundError: No module named 'geopandas' » dans Jupyter, alors que le script de vérification dit OK."],"why":"Jupyter utilise un autre noyau que geoenv, ou le package a été installé dans (base).","fix":[{"k":"ul","i":["Dans Jupyter : menu **Kernel > Change Kernel > Python (geoenv)** (étape 3 si ce noyau n'apparaît pas).","Arrêtez Jupyter, tapez `conda activate geoenv`, puis relancez-le.","Vérifiez dans une cellule : `import sys; print(sys.executable)` doit contenir `envs/geoenv`.","Si le package avait été installé dans (base), installez-le dans geoenv."]}]},{"code":"P6.4","tuto":"06","title":"Jupyter : navigateur, port ou jeton","see":["« No web browser found » ou « Could not open browser ».","« The port 8888 is already in use, trying another port. »","Jupyter demande un « token » ou un mot de passe."],"why":"Ubuntu n'a pas de navigateur (normal), une autre session Jupyter est ouverte, ou l'adresse copiée ne contient pas le jeton.","fix":[{"k":"ul","i":["**Navigateur** : c'est normal, copiez l'adresse `http://localhost:...` dans votre navigateur Windows (option `--no-browser` pour supprimer le message).","**Port** : Jupyter utilise alors 8889, 8890... Utilisez l'adresse réellement affichée. Arrêtez les anciennes sessions (fermez les terminaux ou Ctrl + C).","**Jeton** : dans un autre terminal Ubuntu avec geoenv actif, `jupyter server list` affiche les adresses complètes avec leur jeton.","Si `localhost` ne répond pas, essayez `http://127.0.0.1:8888/...`."]}]},{"code":"P6.5","tuto":"06","title":"Cartopy : échec du téléchargement des côtes","see":["« URLError: <urlopen error [Errno -3] Temporary failure in name resolution> » ou un avertissement « DownloadWarning » au tracé d'une carte."],"why":"Au premier usage, cartopy télécharge les données Natural Earth : Internet est nécessaire.","fix":[{"k":"p","t":"Connectez-vous à Internet et relancez. En cas de problème DNS : tutoriel 02, P2.3. Après un premier téléchargement réussi, les cartes fonctionnent hors ligne."}]},{"code":"P6.6","tuto":"06","title":"plt.show() n'affiche aucune fenêtre","see":["Le script se termine sans afficher le graphique, ou « UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown »."],"why":"Pas d'affichage graphique disponible (P2.8), ou script lancé hors d'un notebook.","fix":[{"k":"p","t":"Enregistrez la figure puis ouvrez-la dans Windows (méthode la plus fiable) :"},{"k":"cmd","w":"py","c":"plt.savefig(\"figures/carte_pluie.png\", dpi=150, bbox_inches=\"tight\")"},{"k":"cmd","w":"geo","c":"explorer.exe figures/carte_pluie.png"}]},{"code":"P6.7","tuto":"06","title":"xesmf ne s'importe pas","see":["« ImportError: ... esmpy ... » ou « ModuleNotFoundError: No module named 'ESMF' »."],"why":"xesmf dépend de la bibliothèque compilée ESMF, disponible uniquement via conda-forge (pas via pip).","fix":[{"k":"cmd","w":"geo","c":"pip uninstall -y xesmf\nconda install -c conda-forge esmpy xesmf -y"}]},{"code":"P6.8","tuto":"06","title":"Mémoire insuffisante avec de gros fichiers","see":["Le programme s'arrête avec « Killed », ou « MemoryError », « Unable to allocate ... GiB »."],"why":"Le fichier chargé dépasse la mémoire attribuée à WSL (par défaut, environ la moitié de la RAM du PC).","fix":[{"k":"p","t":"**1. Ne charger que le nécessaire** (région et période), et travailler par morceaux avec dask :"},{"k":"cmd","w":"py","c":"ds = xr.open_dataset(\"era5_t2m.nc\", chunks={\"time\": 365})\nsn = ds.sel(latitude=slice(17, 12), longitude=slice(-18, -11), time=slice(\"1991\", \"2020\"))"},{"k":"p","t":"**2. Augmenter la mémoire de WSL** : créez ou modifiez `C:\\Users\\<VotreNom>\\.wslconfig` (Bloc-notes) :"},{"k":"cmd","w":"wslconfig","c":"[wsl2]\nmemory=6GB\nswap=4GB"},{"k":"p","t":"Adaptez `memory` à votre PC (au maximum environ 75 % de la RAM), puis `wsl --shutdown` dans PowerShell."}]},{"code":"P6.9","tuto":"06","title":"Lecture d'Excel impossible","see":["« XLRDError: Excel xlsx file; not supported » ou « Missing optional dependency 'openpyxl' »."],"why":"xlrd ne lit plus que les anciens fichiers .xls ; les fichiers .xlsx nécessitent openpyxl.","fix":[{"k":"cmd","w":"geo","c":"conda install -c conda-forge openpyxl -y"},{"k":"p","t":"Puis dans Python : `pd.read_excel(\"fichier.xlsx\", engine=\"openpyxl\")`."}]},{"code":"P6.10","tuto":"06","title":"Modèle spaCy introuvable","see":["« OSError: [E050] Can't find model 'fr_core_news_sm' »."],"why":"Les modèles de langue se téléchargent séparément.","fix":[{"k":"cmd","w":"geo","c":"python -m spacy download fr_core_news_sm"}]},{"code":"P6.11","tuto":"06","title":"Erreur de lecture d'un fichier NetCDF","see":["« OSError: [Errno -101] NetCDF: HDF error », « [Errno -51] NetCDF: Unknown file format » ou « Permission denied »."],"why":"Fichier incomplet (téléchargement interrompu), fichier OneDrive « en ligne uniquement », fichier ouvert dans un logiciel Windows (Panoply, QGIS), ou mauvais format (.grib, .zip).","fix":[{"k":"ul","i":["Vérifiez la taille et le contenu : `ls -lh fichier.nc` puis `ncdump -h fichier.nc`.","OneDrive : clic droit > « Toujours conserver sur cet appareil » (P3.3), ou copiez le fichier dans `~`.","Fermez le fichier dans les logiciels Windows.","Retéléchargez le fichier s'il est incomplet ; décompressez-le s'il s'agit d'une archive (`unzip`, `gunzip`).","Fichier GRIB : `conda install -c conda-forge cfgrib -y`, puis `xr.open_dataset(\"f.grib\", engine=\"cfgrib\")`."]}]},{"code":"P6.12","tuto":"06","title":"Earth Engine : authentification ou projet","see":["« ee.ee_exception.EEException: Please authorize access to your Earth Engine account » ou « no project found »."],"why":"Earth Engine exige un compte enregistré, une authentification et un projet Google Cloud.","fix":[{"k":"cmd","w":"py","c":"import ee\nee.Authenticate(auth_mode=\"notebook\")\nee.Initialize(project=\"<identifiant-de-votre-projet>\")"},{"k":"p","t":"Suivez le lien affiché, connectez-vous avec le compte Google enregistré sur Earth Engine, puis collez le code obtenu."}]},{"code":"P9.1","tuto":"09","title":"Fichier outil introuvable","see":["« bash: outil_04_installer_alias.sh: No such file or directory » (ou la même erreur avec .yml ou .py)."],"why":"Vous n'êtes pas dans le dossier Téléchargements, le fichier n'y a pas été enregistré, ou son nom a été modifié.","fix":[{"k":"p","t":"Tapez `pwd` : vous devez être dans `/mnt/c/Users/<NomWindows>/Downloads`. Sinon, tapez `cd /mnt/c/Users/<NomWindows>/Downloads`. Puis `ls` pour voir les noms exacts."},{"k":"p","t":"Si le navigateur ou WhatsApp a renommé le fichier, par exemple `outil_04_installer_alias(1).sh`, utilisez ce nom exact entre guillemets :"},{"k":"cmd","w":"ub","c":"bash \"outil_04_installer_alias(1).sh\""}]},{"code":"P9.2","tuto":"09","title":"Dossier Windows introuvable","see":["« cd: /mnt/c/Users/Aminata/Downloads: No such file or directory »."],"why":"Le nom de dossier Windows est mal écrit (majuscules, espace) ou n'est pas le bon.","fix":[{"k":"p","t":"Tapez `ls /mnt/c/Users/` et recopiez le nom exact. Utilisez la touche **Tab** pour compléter automatiquement. Si le nom contient un espace, mettez le chemin entre guillemets : `cd \"/mnt/c/Users/Aminata Diallo/Downloads\"`."}]},{"code":"P9.3","tuto":"09","title":"Le fichier .sh a été ouvert avec le Bloc-notes","see":["« $'\\r': command not found » ou « syntax error near unexpected token » au lancement de l'outil 04."],"why":"Le fichier a été enregistré au format Windows.","fix":[{"k":"cmd","w":"ub","c":"dos2unix outil_04_installer_alias.sh\nbash outil_04_installer_alias.sh"},{"k":"p","t":"Ou téléchargez de nouveau le fichier d'origine."}]},{"code":"P9.4","tuto":"09","title":"Permission refusée sur l'outil","see":["« Permission denied » en tapant `./outil_04_installer_alias.sh`."],"why":"Le fichier a été lancé sans le mot bash devant.","fix":[{"k":"p","t":"Tapez toujours `bash` devant le nom : `bash outil_04_installer_alias.sh`."}]},{"code":"P9.5","tuto":"09","title":"conda introuvable (outil 05)","see":["« conda: command not found »."],"why":"Miniconda n'est pas encore installé ou pas initialisé.","fix":[{"k":"p","t":"Terminez les étapes 1 à 6 du tutoriel 05, puis voir Problème P5.1."}]},{"code":"P9.6","tuto":"09","title":"geoenv existe déjà (outil 05)","see":["« CondaValueError: prefix already exists: /home/aminata/miniconda3/envs/geoenv »."],"why":"L'environnement a déjà été créé (par exemple avec une autre méthode du tutoriel 05).","fix":[{"k":"p","t":"Pour le compléter avec le fichier :"},{"k":"cmd","w":"ub","c":"conda env update -n geoenv -f outil_05_geoenv.yml"},{"k":"p","t":"Pour repartir de zéro : `conda remove -n geoenv --all -y`, puis relancez l'outil 05."}]},{"code":"P9.7","tuto":"09","title":"Mauvais Python (outil 06)","see":["« ATTENTION : ce Python n'est pas celui de geoenv » ou beaucoup de lignes « MANQUANT »."],"why":"geoenv n'est pas activé : la ligne de commande ne commence pas par (geoenv).","fix":[{"k":"p","t":"Tapez `geo` (ou `conda activate geoenv`), puis relancez `python outil_06_verifier_geoenv.py`."}]}],"wincodes":[["0x80370102","P1.2","virtualisation (voir aussi tutoriel 01A)"],["0x8007019e","P1.4","sous-système non activé"],["0x800701bc","P1.5","noyau à mettre à jour"],["0x80072ee7, 0x80072efd, 0x80072f8f, 0x80190001","P1.6","téléchargement, réseau, date"],["0x80070003","P1.11","disque autre que C:"],["0x80070070","P1.12","disque plein"],["4294967295","P1.10","Ubuntu se ferme aussitôt"]],"pkgs":[[1,"numpy","calcul numérique, tableaux multidimensionnels","moyennes, anomalies, percentiles",""],[1,"pandas","tableaux de données et séries temporelles","données de stations, fichiers CSV",""],[1,"scipy","calcul avancé : interpolation, statistiques, optimisation","tests de tendance, ajustement de lois",""],[1,"xarray","données multidimensionnelles étiquetées (temps, lat, lon)","ouvrir et analyser CHIRPS, ERA5, CMIP6",""],[1,"netCDF4, h5netcdf","lecture et écriture des fichiers NetCDF","moteurs utilisés par xarray",""],[1,"cftime","calendriers non standards des modèles (360 jours, sans bissextile)","sorties CMIP et CORDEX",""],[1,"matplotlib","graphiques et cartes simples","séries temporelles, cartes de pluie",""],[1,"shapely","géométries : points, lignes, polygones","contours de régions, zones tampons",""],[1,"pyproj","systèmes de coordonnées et projections","conversion WGS84 / UTM",""],[1,"geopandas","données vectorielles (shapefile, GeoJSON, GeoPackage)","limites administratives GADM",""],[1,"rasterio","lecture et écriture de rasters (GeoTIFF)","altitude (SRTM), occupation du sol",""],[1,"rioxarray","extension géographique de xarray","découper un NetCDF avec un shapefile",""],[1,"regionmask","masques de régions","moyenne de pluie par région ou par pays",""],[1,"cartopy","cartes avec projections, côtes, frontières","cartes de qualité publication",""],[1,"CDO, NCO","outils en ligne de commande pour NetCDF","moyennes annuelles, découpage rapide",""],[2,"seaborn","graphiques statistiques","boîtes à moustaches, cartes de corrélation",""],[2,"statsmodels","modèles statistiques : régression, ARIMA, SARIMA, GLM","relation climat - paludisme",""],[2,"scikit-learn","apprentissage automatique","forêts aléatoires, classification, validation croisée",""],[2,"bottleneck","accélère les calculs sur grands tableaux","utilisé automatiquement par xarray",""],[2,"dask","calcul parallèle et « paresseux » sur données plus grandes que la mémoire","ERA5 sur 40 ans",""],[2,"zarr, fsspec","formats et accès aux données dans le cloud","données CMIP6 en ligne",""],[2,"xesmf","regrillage (changement de grille)","mettre un modèle sur la grille CHIRPS",""],[2,"rasterstats","statistiques zonales raster / vecteur","pluie moyenne par département",""],[2,"fiona, pyshp","lecture et écriture de fichiers géographiques et de shapefiles","formats vecteur",""],[2,"contextily","fonds de carte en tuiles (OpenStreetMap)","arrière-plan de carte",""],[2,"plotly","graphiques interactifs","séries zoomables",""],[2,"folium, branca","cartes interactives Leaflet et leurs légendes","carte web des stations",""],[2,"dash, streamlit, streamlit-folium","applications web et tableaux de bord","tableau de bord d'alerte précoce",""],[2,"openpyxl","lire et écrire les fichiers Excel .xlsx","pd.read_excel(\"cas.xlsx\")",""],[2,"xlrd","lire les anciens fichiers Excel .xls (uniquement .xls)","pd.read_excel(\"vieux.xls\")",""],[2,"tabulate","affichage de tableaux lisibles dans le terminal","résumés",""],[2,"tqdm","barre de progression","boucles sur de nombreux fichiers",""],[2,"jupyterlab, ipywidgets, nbformat","notebooks, widgets interactifs, manipulation des .ipynb","travaux pratiques",""],[2,"pillow, imageio","images et animations","GIF animé de cartes mensuelles",""],[3,"pykrige","Interpolation : krigeage (interpoler des stations sur une grille)","","conda install -c conda-forge pykrige -y"],[3,"osmnx, pyrosm","OpenStreetMap : réseaux routiers et bâtiments ; lecture rapide des fichiers OSM","","conda install -c conda-forge osmnx pyrosm -y"],[3,"geoplot","Cartes statistiques thématiques (peu maintenu, facultatif)","","conda install -c conda-forge geoplot -y"],[3,"sympy","Mathématiques : calcul symbolique","","conda install -c conda-forge sympy -y"],[3,"ydata-profiling","Exploration de données : rapport automatique (ancien nom : pandas-profiling)","","conda install -c conda-forge ydata-profiling -y"],[3,"sqlalchemy, psycopg2","Bases de données : PostgreSQL / PostGIS","","conda install -c conda-forge sqlalchemy psycopg2 -y"],[3,"click, typer, fire","Scripts en ligne de commande : créer ses propres commandes","","conda install -c conda-forge click typer fire -y"],[3,"nltk, spacy","Traitement du langage (+ modèle français)","","conda install -c conda-forge nltk spacy -y\npython -m spacy download fr_core_news_sm"],[3,"transformers, pytorch","Modèles de langage (volumineux : 1 à 2 Go)","","conda install -c conda-forge pytorch transformers -y"],[3,"geemap, earthengine-api","Google Earth Engine (compte Earth Engine et projet Google Cloud requis)","","conda install -c conda-forge geemap earthengine-api -y"]],"cmdcats":[["wsl","Gérer WSL"],["fichiers","Fichiers et dossiers"],["windows","Passerelles Windows"],["apt","Logiciels Ubuntu (apt)"],["editeurs","Éditeurs et images"],["conda","Conda et Python"],["cdo","NetCDF : CDO et NCO"],["clavier","Raccourcis clavier"],["alias","Alias du cours"]],"commands":[["wsl","ps","wsl","ouvrir Ubuntu dans PowerShell",""],["wsl","ps","wsl -l -v","lister les distributions et leur version (1 ou 2)","doit afficher VERSION 2"],["wsl","ps","wsl --shutdown","arrêter complètement WSL","remède n° 1 en cas de problème"],["wsl","psa","wsl --update","mettre WSL à jour","PowerShell administrateur"],["wsl","ps","wsl --version","versions de WSL, du noyau, de WSLg et de Windows","à joindre à une demande d'aide"],["wsl","ps","wsl --status","état de WSL",""],["wsl","ps","wsl --list --online","distributions disponibles",""],["wsl","psa","wsl --install -d Ubuntu","installer Ubuntu","tutoriel 01"],["wsl","psa","wsl --install -d Ubuntu --web-download","installer sans passer par le Microsoft Store","P1.6"],["wsl","psa","wsl --set-version Ubuntu 2","convertir Ubuntu en WSL 2","P1.7"],["wsl","ps","wsl -u root","ouvrir Ubuntu en administrateur (root)","mot de passe oublié (P2.2)"],["wsl","ps","wsl --export Ubuntu D:\\sauv\\ubuntu.tar","sauvegarder tout Ubuntu dans un fichier","tutoriel 08"],["wsl","psa","wsl --unregister Ubuntu","supprimer Ubuntu et tous ses fichiers","irréversible"],["fichiers","ub","pwd","dossier courant",""],["fichiers","ub","ls -lh","lister en détail, tailles lisibles","ls -lrt : par date ; ls -a : avec les cachés"],["fichiers","ub","cd <dossier>","entrer dans un dossier","cd .. remonte ; cd revient chez vous ; cd - dossier précédent"],["fichiers","ub","cd /mnt/c/Users/<NomWindows>","aller dans le dossier Windows","ou l'alias m"],["fichiers","ub","mkdir -p <chemin>","créer des dossiers (avec les intermédiaires)","mkdir -p projet/figures"],["fichiers","ub","touch <fichier>","créer un fichier vide",""],["fichiers","ub","cp <source> <destination>","copier un fichier (cp -r : un dossier)","cp a.nc ~/donnees/"],["fichiers","ub","mv <ancien> <nouveau>","déplacer ou renommer","mv t.py pluie.py"],["fichiers","ub","rm -i <fichier>","supprimer avec confirmation (définitif)","rm -r : un dossier et son contenu"],["fichiers","ub","rmdir <dossier>","supprimer un dossier vide (sans risque)",""],["fichiers","ub","cat <fichier>","afficher un fichier court","less, head -n 5, tail -n 5"],["fichiers","ub","wc -l <fichier>","compter les lignes",""],["fichiers","ub","find . -name \"*.nc\"","chercher des fichiers par nom","-iname ignore les majuscules"],["fichiers","ub","grep -n \"<mot>\" <fichier>","chercher un mot (avec numéro de ligne)","grep -n xarray *.py"],["fichiers","ub","du -sh <dossier>","taille d'un dossier","df -h ~ : espace libre"],["fichiers","ub","tree -L 2","arborescence sur 2 niveaux",""],["fichiers","ub","chmod +x <script.sh>","rendre un script exécutable",""],["fichiers","ub","dos2unix <fichier>","corriger les fins de ligne Windows","P3.10"],["fichiers","ub","unzip <f.zip>","décompresser un .zip","tar -xzf <f.tar.gz> ; gunzip <f.gz>"],["fichiers","ub","wget -c <url>","télécharger (avec reprise)",""],["fichiers","ub","history | grep conda","retrouver une commande déjà tapée",""],["windows","ub","explorer.exe .","ouvrir le dossier courant dans l'Explorateur","alias ex"],["windows","ub","explorer.exe <fichier>","ouvrir un fichier avec l'application Windows","explorer.exe carte.png"],["windows","ub","notepad.exe <fichier>","modifier avec le Bloc-notes",""],["windows","ub","code .","ouvrir le dossier dans VS Code","tutoriel 06"],["windows","win","\\\\wsl.localhost\\Ubuntu\\home\\<nom>","adresse des fichiers Linux dans l'Explorateur","barre d'adresse de l'Explorateur"],["apt","ub","sudo apt update && sudo apt upgrade -y","mettre Ubuntu à jour","alias maj"],["apt","ub","sudo apt install -y <paquet>","installer un logiciel","sudo apt install -y gedit"],["apt","ub","sudo apt remove <paquet>","désinstaller",""],["apt","ub","apt search <mot>","chercher un logiciel","sans sudo"],["apt","ub","sudo apt autoremove -y && sudo apt clean","faire le ménage",""],["editeurs","ub","nano <fichier>","éditeur dans le terminal","Ctrl + O enregistrer, Ctrl + X quitter, Alt + / fin ; alias n"],["editeurs","ub","gedit <fichier> &","éditeur graphique simple","alias g"],["editeurs","ub","kate <fichier> &","éditeur graphique avancé","alias k"],["editeurs","ub","eog <image> &","visionneuse d'images",""],["editeurs","ub","display <image> &","afficher une image (ImageMagick)","alias d"],["conda","ub","conda activate geoenv","activer l'environnement du cours","alias geo ; à chaque terminal"],["conda","ub","conda deactivate","quitter l'environnement",""],["conda","ub","conda env list","lister les environnements",""],["conda","geo","conda list <paquet>","paquets installés","conda list xarray"],["conda","geo","conda install -c conda-forge <paquet> -y","installer dans l'environnement actif","jamais sudo"],["conda","geo","conda search -c conda-forge <paquet>","vérifier qu'un paquet existe",""],["conda","geo","conda update -c conda-forge <paquet> -y","mettre à jour un paquet",""],["conda","geo","conda remove <paquet> -y","retirer un paquet",""],["conda","geo","conda env export --from-history > geoenv.yml","sauvegarder la recette de l'environnement",""],["conda","ub","conda env create -f geoenv.yml","recréer un environnement depuis une recette",""],["conda","ub","conda remove -n geoenv --all -y","supprimer un environnement","depuis (base)"],["conda","ub","conda clean --all -y","libérer de l'espace",""],["conda","ub","conda info","informations complètes pour une demande d'aide",""],["conda","geo","python <script.py>","exécuter un script","alias p"],["conda","geo","python -m pip install <paquet>","dernier recours si absent de conda-forge","dans geoenv"],["conda","geo","jupyter lab --no-browser","lancer Jupyter Lab (Ctrl + C puis y pour arrêter)","alias jl"],["conda","geo","jupyter notebook --no-browser","lancer Jupyter Notebook","alias j"],["conda","geo","jupyter server list","retrouver l'adresse et le jeton",""],["cdo","geo","ncdump -h <f.nc>","afficher l'en-tête : variables, dimensions, unités",""],["cdo","geo","cdo -V","vérifier que CDO est installé",""],["cdo","geo","cdo sinfon <f.nc>","résumé du fichier (grille, dates, variables)",""],["cdo","geo","cdo showname <f.nc>","noms des variables","cdo showyear : années disponibles"],["cdo","geo","cdo selname,<var> <in.nc> <out.nc>","extraire une variable","par exemple precip"],["cdo","geo","cdo selyear,1991/2020 <in.nc> <out.nc>","extraire une période",""],["cdo","geo","cdo sellonlatbox,-18,-11,12,17 <in.nc> <out.nc>","découper une zone","ici, un cadre autour du Sénégal (lon1,lon2,lat1,lat2)"],["cdo","geo","cdo yearsum <in.nc> <out.nc>","cumul annuel","yearmean, monmean : moyennes annuelle, mensuelle"],["cdo","geo","cdo ymonmean <in.nc> <out.nc>","climatologie mensuelle (12 mois)",""],["cdo","geo","cdo fldmean <in.nc> <out.nc>","moyenne spatiale (série temporelle de la zone)",""],["cdo","geo","cdo timmean <in.nc> <out.nc>","moyenne sur toute la période",""],["cdo","geo","cdo mergetime <f1.nc> <f2.nc> <out.nc>","fusionner des fichiers successifs dans le temps",""],["cdo","geo","ncks -v <var> <in.nc> <out.nc>","extraire une variable avec NCO",""],["cdo","geo","cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc pluie_annuelle_senegal.nc","enchaîner des opérateurs CDO","exécutés de droite à gauche"],["clavier","key","Tab","compléter un nom (deux fois : liste des choix)",""],["clavier","key","Flèche haut / bas","historique des commandes","Ctrl + R : recherche dans l'historique"],["clavier","key","Ctrl + C","interrompre la commande en cours","ne copie pas"],["clavier","key","Ctrl + Maj + C / Ctrl + Maj + V","copier / coller","ou clic droit pour coller"],["clavier","key","Ctrl + L","effacer l'écran",""],["clavier","key","Ctrl + D","quitter le terminal",""],["clavier","key","Ctrl + Z puis fg","suspendre puis reprendre un programme","P3.8"],["clavier","key","Alt Gr + 6 ; Alt Gr + 2","taper | (pipe) ; taper ~ (puis Espace)","clavier AZERTY"],["alias","ub","m","aller dans le dossier Windows","aussi M, myhome"],["alias","ub","docs / dl","aller dans Documents / Téléchargements",""],["alias","ub","ll / la / lt","ls -lh / ls -lha / ls -lrt",""],["alias","ub","p","python3","aussi P"],["alias","ub","geo","conda activate geoenv","après le tutoriel 05"],["alias","ub","j / jl","Jupyter Notebook / Jupyter Lab","après le tutoriel 06 ; aussi J"],["alias","ub","k / g / n","kate / gedit / nano",""],["alias","ub","d","display (afficher une image)",""],["alias","ub","ex / voir","explorer.exe . / explorer.exe",""],["alias","ub","maj","mise à jour d'Ubuntu",""],["alias","ub","source ~/.bashrc","recharger les alias",""]],"qcm":[["00","Vous voyez `PS C:\\Users\\Aminata>` au début de la ligne. Où êtes-vous ?",["Dans PowerShell (Windows)","Dans le terminal Ubuntu","Dans Ubuntu avec geoenv actif","Dans le BIOS"],0,"Le début de ligne `PS ...>` est celui de PowerShell. Dans Ubuntu, il se termine par `$` (par exemple `aminata@PC:~$`)."],["00","Quelle est la configuration minimale de Windows pour suivre le parcours ?",["Windows 10 version 2004 (build 19041) ou Windows 11, en 64 bits","Windows 7 ou plus récent","Windows 10 Professionnel uniquement","N'importe quel Windows, en 32 ou 64 bits"],0,"WSL 2 avec `wsl --install` exige Windows 10 version 2004 (build 19041) ou plus, ou Windows 11, en 64 bits. L'édition Famille suffit."],["00","Pendant que vous tapez votre mot de passe Linux, rien ne s'affiche. Que faire ?",["Continuer à taper, puis Entrée : c'est normal","Fermer Ubuntu : le clavier est bloqué","Taper `wsl --shutdown` dans Ubuntu","Réinstaller Ubuntu"],0,"Ubuntu n'affiche ni lettres ni étoiles pendant la saisie d'un mot de passe. C'est une protection normale."],["00","Laquelle de ces règles d'or est correcte ?",["Ne jamais mettre `sudo` devant `conda` ou `pip`","Toujours mettre `sudo` devant `conda` pour éviter les erreurs","Installer les bibliothèques Python avec `sudo pip`","Passer à l'étape suivante même si l'étape en cours a échoué"],0,"`sudo` sert uniquement aux commandes `apt`. Devant conda ou pip, il rend des fichiers propriété de root (Problème P5.9)."],["01A","La virtualisation est « Désactivé ». Quelle méthode permet d'entrer dans le BIOS sans dépendre d'une touche de démarrage ?",["Paramètres > Récupération > Démarrage avancé > Dépannage > Options avancées > Paramètres du microprogramme UEFI","Taper `wsl --bios` dans PowerShell","Ouvrir le Gestionnaire des tâches et cliquer sur « Activer »","Appuyer sur Ctrl + Alt + Suppr dans Windows"],0,"La méthode A passe par le démarrage avancé de Windows et redémarre directement dans le BIOS (UEFI). Elle ne dépend d'aucune touche."],["01A","Sur un processeur AMD, comment s'appelle généralement l'option de virtualisation dans le BIOS ?",["SVM Mode (ou AMD-V)","Intel VT-x","Secure Boot","Fast Boot"],0,"Chez AMD, l'option s'appelle SVM Mode, AMD-V ou AMD SVM Technology. Intel VT-x concerne les processeurs Intel. Secure Boot et Fast Boot sont d'autres options à ne pas modifier."],["01A","Comment enregistrer la modification et quitter le BIOS ?",["F10 (Save and Exit), puis Yes","Échap puis Discard Changes","Couper le courant","Load Defaults"],0,"F10 enregistre et quitte. « Discard Changes » ou « Exit Without Saving » abandonnent les modifications. « Load Defaults » peut modifier d'autres réglages (P1A.6)."],["01A","Après la modification du BIOS, Windows demande une clé de récupération BitLocker. Où la trouver ?",["Dans le compte Microsoft du PC, sur aka.ms/myrecoverykey","Dans le Gestionnaire des tâches","Dans le fichier ~/.bashrc","En tapant `systeminfo`"],0,"La clé BitLocker (48 chiffres) est enregistrée dans le compte Microsoft du PC. Prévention : la noter ou suspendre la protection avant d'entrer dans le BIOS (P1A.5)."],["01","Quelle commande installe WSL et Ubuntu (méthode recommandée) ?",["`wsl --install -d Ubuntu` dans PowerShell (Administrateur)","`sudo apt install wsl` dans Ubuntu","`wsl --install -d Ubuntu` dans le terminal Ubuntu","`conda install wsl`"],0,"L'installation se fait dans PowerShell ouvert en administrateur. Ubuntu n'existe pas encore à ce stade."],["01","L'installation de WSL échoue avec l'erreur `0x80370102`. Quelle est la cause la plus probable ?",["La virtualisation est désactivée dans le BIOS","Le disque C: est plein","Le mot de passe Linux est faux","geoenv n'est pas activé"],0,"0x80370102 correspond à la virtualisation désactivée ou à la Plateforme de machine virtuelle non activée (P1.2, tutoriel 01A). Le disque plein donne 0x80070070."],["01","`wsl -l -v` affiche `Ubuntu  Stopped  1`. Que faut-il faire ?",["Convertir en WSL 2 : `wsl --set-version Ubuntu 2`","Rien : « Stopped » est une erreur grave","Réinstaller Windows","Taper `sudo apt upgrade`"],0,"La colonne VERSION doit valoir 2. « Stopped » est un état normal. La conversion se fait avec `wsl --set-default-version 2` puis `wsl --set-version Ubuntu 2` (P1.7)."],["01","Après `wsl --install`, pourquoi faut-il choisir « Redémarrer » et non « Arrêter » ?",["Avec le démarrage rapide, « Arrêter » puis rallumer ne finalise pas toujours l'installation","« Arrêter » efface Ubuntu","« Redémarrer » active automatiquement geoenv","Il n'y a aucune différence"],0,"Le démarrage rapide de Windows fait de « Arrêter » une mise en veille prolongée : les composants ne sont pas toujours finalisés."],["02","Lequel de ces noms d'utilisateur Linux sera accepté ?",["aminata2","Aminata","2aminata","aminata diallo"],0,"Le nom doit contenir uniquement des minuscules et des chiffres, sans espace ni accent, et commencer par une lettre (P2.1)."],["02","Que fait `sudo apt update` ?",["Il télécharge la liste des logiciels disponibles","Il installe toutes les mises à jour","Il met à jour conda","Il met à jour Windows"],0,"`apt update` met à jour la liste des paquets. C'est `apt upgrade` qui installe les mises à jour."],["02","Dans Ubuntu (avant le tutoriel 05), `python` répond « command not found ». Que signifie ce message ?",["C'est normal : la commande s'appelle `python3` hors environnement conda","Python n'est pas installé : il faut `sudo pip install python`","WSL est en version 1","Le DNS ne fonctionne pas"],0,"Ubuntu fournit `python3`. La commande `python` n'existe qu'une fois geoenv activé."],["02","Ubuntu affiche « Temporary failure resolving 'archive.ubuntu.com' ». Quelle est la cause ?",["Ubuntu n'arrive pas à traduire les adresses web (DNS)","Le mot de passe est faux","Le disque est plein","L'alias m est mal défini"],0,"C'est un problème de résolution de noms (DNS), fréquent avec un VPN ou après une mise en veille. Voir P2.3."],["02","Votre mot de passe Linux est oublié. Quelle commande, tapée dans PowerShell, ouvre Ubuntu en administrateur pour le réinitialiser ?",["`wsl -u root`","`sudo passwd`","`wsl --reset-password`","`wsl --shutdown`"],0,"`wsl -u root` ouvre une session root sans mot de passe ; on y tape ensuite `passwd <votre_nom_linux>` (P2.2)."],["03","Quel est le chemin Ubuntu de `C:\\Users\\Aminata\\Documents` ?",["/mnt/c/Users/Aminata/Documents","/mnt/C/Users/Aminata/Documents","C:/Users/Aminata/Documents","/home/Aminata/Documents"],0,"`C:` devient `/mnt/c` (en minuscule) et les barres `\\` deviennent `/`."],["03","Comment connaître exactement votre nom de dossier Windows (<NomWindows>) ?",["`ls /mnt/c/Users/` puis garder le nom qui n'est pas All Users, Default, Default User, Public ou desktop.ini","Le nom affiché sur l'écran de connexion de Windows","`whoami` dans Ubuntu","Le nom d'utilisateur Linux"],0,"Seul le résultat de `ls /mnt/c/Users/` fait foi. Avec un compte Microsoft, le dossier peut être tronqué (par exemple `amina`)."],["03","Le dossier s'appelle `Mes donnees`. Quelle commande est correcte ?",["`cd \"Mes donnees\"`","`cd Mes donnees`","`cd Mes_donnees`","`cd Mes-donnees`"],0,"Un nom contenant un espace doit être mis entre guillemets, sinon Ubuntu voit deux noms."],["03","Dans l'Explorateur Windows, comment ouvrir le dossier où vous êtes dans Ubuntu ?",["`explorer.exe .`","`explorer.exe ~`","`open .`","`cd /mnt/c`"],0,"Le point `.` désigne le dossier courant. `open .` est l'équivalent sur Mac."],["03","Votre Bureau est vide dans `/mnt/c/Users/<NomWindows>/Desktop` alors qu'il contient des fichiers. Où regarder ?",["Dans `/mnt/c/Users/<NomWindows>/OneDrive/`","Dans `/home/<nom>/Desktop`","Dans `/mnt/d/Desktop`","Dans `/etc/wsl.conf`"],0,"OneDrive déplace souvent le Bureau et les Documents dans son propre dossier (P3.3)."],["03A","Que fait `echo \"texte\" > notes.txt` si notes.txt contient déjà des lignes ?",["Il remplace tout le contenu par « texte »","Il ajoute « texte » à la fin","Il refuse car le fichier existe","Il crée une copie notes(1).txt"],0,"Un seul `>` remplace tout le contenu, sans confirmation. Pour ajouter à la fin, il faut `>>`."],["03A","Comment quitter `less` ?",["Touche q","Ctrl + X","Ctrl + O","Échap"],0,"Dans less, q (« quit ») quitte. Ctrl + X sert à quitter nano."],["03A","Dans nano, comment enregistrer le fichier ?",["Ctrl + O puis Entrée","Ctrl + S","Ctrl + X puis N","Ctrl + C"],0,"Ctrl + O (« Output ») puis Entrée pour confirmer le nom. Ctrl + X quitte ; à la question « Save modified buffer? », N abandonne les modifications."],["03A","`cp donnees sauvegarde` affiche « cp: -r not specified; omitting directory ». Pourquoi ?",["`donnees` est un dossier : il faut `cp -r`","Le dossier `sauvegarde` existe déjà","Il faut `sudo`","Le nom contient une majuscule"],0,"Pour copier un dossier et tout son contenu, l'option `-r` (récursif) est obligatoire."],["03A","Avant une suppression, quelle est la règle des trois vérifications ?",["`pwd`, puis `ls`, puis `rm -i`","`rm -rf *`, puis `ls`, puis `pwd`","`sudo`, puis `rm`, puis `exit`","`cd ~`, puis `rm -r`, puis `tree`"],0,"On vérifie où l'on est (`pwd`), ce qu'on va supprimer (`ls`), puis on confirme fichier par fichier (`rm -i`). Il n'y a pas de corbeille."],["03A","Le terminal affiche `[1]+ Stopped python3 analyse.py`. Que s'est-il passé ?",["Vous avez appuyé sur Ctrl + Z : le programme est en pause","Le script est terminé avec succès","Le script a été supprimé","Le disque est plein"],0,"Ctrl + Z suspend le programme. `fg` le reprend ; Ctrl + C l'arrête ensuite si nécessaire."],["03A","Que fait `ls donnees | wc -l` ?",["Il compte les éléments listés dans `donnees`","Il supprime le dossier `donnees`","Il écrit la liste dans un fichier nommé wc","Il affiche les fichiers cachés"],0,"Le « pipe » `|` envoie le résultat de `ls` à `wc -l`, qui compte les lignes, donc les éléments listés."],["03A","Quelle commande trouve tous les fichiers .csv dans le dossier courant et ses sous-dossiers ?",["`find . -name \"*.csv\"`","`grep \"*.csv\"`","`ls -r *.csv`","`cd *.csv`"],0,"`find` cherche par nom dans un dossier et tous ses sous-dossiers. `grep` cherche un mot à l'intérieur des fichiers."],["04","Pourquoi les alias du cours utilisent-ils `$WIN` au lieu de `/mnt/c/Users/User` ?",["Pour fonctionner sur tous les PC, quel que soit le nom du dossier Windows","Parce que `/mnt/c` n'existe pas dans WSL 2","Pour accélérer Ubuntu","Parce que les alias ne peuvent pas contenir de /"],0,"`User` est le nom du dossier Windows du PC de l'auteur. La variable WIN contient le vrai dossier de chaque étudiant (P4.5)."],["04","Laquelle de ces lignes est une définition d'alias correcte ?",["`alias p='python3'`","`alias p = 'python3'`","`alias p=‘python3’`","`alias p='python3`"],0,"Pas d'espace autour de `=`, des apostrophes droites, et l'apostrophe fermée (P4.6)."],["04","Vous venez d'installer les alias. `m` répond « command not found ». Que tapez-vous d'abord ?",["`source ~/.bashrc`","`sudo apt install m`","`conda activate geoenv`","`wsl --unregister Ubuntu`"],0,"`source ~/.bashrc` relit le fichier dans le terminal ouvert. Les nouveaux terminaux le lisent automatiquement (P4.1)."],["04","Après le collage du bloc d'alias, chaque Entrée affiche `>`. Quelle est la cause ?",["Le mot EOF final manque ou n'est pas seul sur sa ligne","Le disque est plein","geoenv n'est pas activé","Le dossier Windows contient un espace"],0,"Le terminal attend la fin du bloc. Tapez `EOF` seul sur la ligne, ou Ctrl + C (P4.3)."],["05","Où doit-on installer Miniconda ?",["Dans le dossier Linux `~` (par exemple `~/miniconda3`)","Dans `/mnt/c/Users/<NomWindows>/Documents`","Dans `C:\\Program Files`","Dans `/usr/bin` avec sudo"],0,"Miniconda s'installe dans Linux, jamais dans un dossier Windows (lenteur, erreurs de liens : P5.10), et jamais avec sudo."],["05","`uname -m` affiche `x86_64`. Quel installateur choisir ?",["Miniconda3-latest-Linux-x86_64.sh","Miniconda3-latest-Linux-aarch64.sh","Miniconda3-latest-MacOSX-arm64.sh","L'installateur Windows .exe"],0,"x86_64 correspond aux processeurs Intel et AMD. aarch64 correspond aux processeurs ARM."],["05","Pourquoi exécuter `conda config --remove channels defaults` ?",["Pour n'utiliser que conda-forge et éviter les conflits entre canaux et l'erreur des conditions d'utilisation","Pour supprimer Python","Pour désactiver geoenv","Pour accélérer Windows"],0,"Le cours n'utilise que conda-forge. Retirer `defaults` évite les mélanges de canaux (P5.5) et l'erreur CondaToSNonInteractiveError (P5.4)."],["05","Après `conda activate geoenv`, `which python` doit afficher :",["un chemin contenant `miniconda3/envs/geoenv`","`/usr/bin/python3`","`C:\\Python311\\python.exe`","rien"],0,"Si le chemin ne contient pas `envs/geoenv`, geoenv n'est pas actif ou l'installation a échoué (P5.7)."],["05","« PermissionError: [Errno 13] Permission denied: '/home/aminata/miniconda3/...' ». Cause la plus probable ?",["Une commande conda ou pip a été lancée avec sudo","Le BIOS est verrouillé","WSL est en version 1","L'alias geo est mal écrit"],0,"sudo a rendu des fichiers propriété de root. Réparation : `sudo chown -R $USER:$USER ~/miniconda3 ~/.conda`, puis relancer sans sudo (P5.9)."],["05","Quelle commande sauvegarde la recette de geoenv pour la recréer sur un autre PC ?",["`conda env export --from-history > geoenv.yml`","`cp -r ~/miniconda3 /mnt/c/`","`conda clean --all -y`","`pip freeze > geoenv.yml`"],0,"`conda env export --from-history` écrit la liste des paquets demandés. On recrée ensuite avec `conda env create -f geoenv.yml`."],["06","Avant d'installer un package du niveau 2, que doit afficher l'invite ?",["`(geoenv)`","`(base)`","`PS C:\\>`","`root@...#`"],0,"Installer dans (base) est une erreur fréquente : le package ne sera pas trouvé dans geoenv ni dans Jupyter (P6.3)."],["06","Un package n'existe pas sur conda-forge. Quelle commande utiliser, en dernier recours ?",["`python -m pip install <nom>` dans geoenv","`sudo pip install <nom>`","`sudo apt install <nom>`","`pip install --break-system-packages <nom>`"],0,"Toujours `python -m pip` dans geoenv activé, jamais `sudo pip`, et seulement après les installations conda."],["06","Dans Jupyter, `import geopandas` échoue alors que le script de vérification affiche OK. Que faire ?",["Choisir le noyau « Python (geoenv) » (Kernel > Change Kernel)","Réinstaller Windows","Supprimer geoenv","Taper `sudo jupyter lab`"],0,"Jupyter utilise un autre noyau que geoenv. L'étape 3 du tutoriel 06 enregistre le noyau « Python (geoenv) » (P6.3)."],["06","Quel package sert au regrillage (mettre un modèle sur la grille CHIRPS) ?",["xesmf","tqdm","openpyxl","folium"],0,"xesmf fait le regrillage. Il dépend d'ESMF, disponible seulement via conda-forge (P6.7)."],["06","Comment arrêter Jupyter lancé dans le terminal ?",["Ctrl + C, puis y et Entrée","Fermer l'onglet du navigateur suffit","Ctrl + Z","`wsl --unregister Ubuntu`"],0,"Ctrl + C puis y arrête le serveur. Fermer l'onglet ne l'arrête pas ; Ctrl + Z le met seulement en pause."],["06","Le programme s'arrête avec « Killed » sur un gros fichier ERA5. Première chose à faire ?",["Ne charger que la région et la période utiles, avec `chunks` (dask)","Relancer avec sudo","Installer xlrd","Changer de navigateur"],0,"Le fichier dépasse la mémoire de WSL. On sélectionne le nécessaire avec `.sel(...)` et `chunks`, puis on peut augmenter `memory` dans `.wslconfig` (P6.8)."],["07","Que fait `cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc out.nc` ?",["Découpe la zone, cumule par année, puis fait la moyenne spatiale","Fait la moyenne spatiale, puis découpe, puis cumule","Fusionne deux fichiers","Affiche l'en-tête du fichier"],0,"Les opérateurs CDO enchaînés s'exécutent de droite à gauche : sellonlatbox d'abord, puis yearsum, puis fldmean."],["07","Quelle commande affiche les variables, dimensions et unités d'un fichier NetCDF sans le charger ?",["`ncdump -h fichier.nc`","`cat fichier.nc`","`cdo mergetime fichier.nc`","`head fichier.nc`"],0,"`ncdump -h` affiche l'en-tête. `cat` ou `head` sur un fichier binaire remplissent l'écran de caractères illisibles."],["08","Remède universel quand WSL se comporte bizarrement ?",["Fermer Ubuntu, `wsl --shutdown` dans PowerShell, rouvrir Ubuntu","`rm -rf ~`","`wsl --unregister Ubuntu`","Réinstaller Windows"],0,"`wsl --shutdown` arrête complètement WSL sans rien effacer. `wsl --unregister` efface définitivement Ubuntu."],["08","Que supprime `wsl --unregister Ubuntu` ?",["Ubuntu, le dossier personnel ~, Miniconda et geoenv, définitivement","Seulement les alias","Seulement les fichiers de vos Documents Windows","Rien, il met Ubuntu en pause"],0,"C'est irréversible pour tout ce qui est dans Ubuntu. Les fichiers situés dans les dossiers Windows ne sont pas touchés."],["09","Comment lancer l'outil `outil_04_installer_alias.sh` ?",["`bash outil_04_installer_alias.sh` dans Ubuntu, depuis Téléchargements","Double-clic dans l'Explorateur Windows","L'ouvrir dans le Bloc-notes et copier son contenu","`python outil_04_installer_alias.sh`"],0,"Un fichier .sh se lance avec `bash`. Ne l'ouvrez pas dans le Bloc-notes : il pourrait être enregistré au format Windows (P9.3)."],["09","Dans quel ordre utiliser les trois outils ?",["outil 04 après le tutoriel 03 ; outil 05 après Miniconda (tutoriel 05, étapes 1 à 6) ; outil 06 après le tutoriel 06, étape 1","outil 06, puis 05, puis 04","Les trois avant le tutoriel 01","outil 05 avant d'installer Miniconda"],0,"L'outil 05 ne fonctionne pas sans Miniconda, et l'outil 06 ne fonctionne pas sans geoenv."],["09","`conda env create -f outil_05_geoenv.yml` répond « prefix already exists ». Que faire pour compléter l'environnement ?",["`conda env update -n geoenv -f outil_05_geoenv.yml`","`sudo conda env create -f outil_05_geoenv.yml`","`bash outil_05_geoenv.yml`","Supprimer Miniconda"],0,"geoenv existe déjà : on le met à jour avec le fichier. Pour repartir de zéro : `conda remove -n geoenv --all -y` (P9.6)."]],"outils":[{"id":"04","file":"outil_04_installer_alias.sh","type":"script bash (.sh)","mot":"bash","quand":"Juste après le tutoriel 03.","fait":"Détecte votre dossier Windows (ou vous le demande), sauvegarde ~/.bashrc, retire un éventuel ancien bloc d'alias du cours et ajoute le nouveau. Peut être relancé sans créer de doublons.","steps":[["Ouvrir Ubuntu","Menu Démarrer, tapez « Ubuntu », puis Entrée.",null,null],["Aller dans Téléchargements","Remplacez <NomWindows> par votre nom de dossier Windows.","cd /mnt/c/Users/<NomWindows>/Downloads",null],["Vérifier que le fichier est là","","ls","outil_04_installer_alias.sh apparaît dans la liste (avec les deux autres outils)."],["Lancer le fichier","S'il vous demande votre nom de dossier Windows, tapez-le exactement, puis Entrée.","bash outil_04_installer_alias.sh",null],["Activer le résultat","","source ~/.bashrc",null],["Tester","","m\npwd","L'écran affiche /mnt/c/Users/<NomWindows>. Les raccourcis m, dl, ll, geo, ex, maj sont installés. dl vous ramène désormais directement dans Téléchargements."]],"pb":["P9.1","P9.2","P9.3","P9.4"]},{"id":"05","file":"outil_05_geoenv.yml","type":"recette conda (.yml)","mot":"conda env create -f","quand":"Après les étapes 1 à 6 du tutoriel 05 (Miniconda installé et canaux configurés).","fait":"Crée l'environnement geoenv avec Python 3.11 et le socle scientifique, en une seule résolution. Équivaut à la méthode C de l'étape 7 du tutoriel 05.","steps":[["Vérifier que conda répond","Sinon, terminez le tutoriel 05 (étapes 1 à 6) avant de continuer.","conda --version","Un numéro de version s'affiche, par exemple conda 25.x.x."],["Aller dans Téléchargements","Grâce à l'alias de l'outil 04.","dl",null],["Lancer le fichier","L'installation dure 10 à 20 minutes et se fait toute seule. Ne fermez pas la fenêtre et ne tapez rien pendant ce temps.","conda env create -f outil_05_geoenv.yml",null],["Activer geoenv","Passez ensuite au tutoriel 06, étape 1 (installation des packages du niveau 2).","conda activate geoenv","La ligne de commande commence maintenant par (geoenv)."]],"pb":["P9.5","P9.6","P5.4","P5.5","P5.11"]},{"id":"06","file":"outil_06_verifier_geoenv.py","type":"programme Python (.py)","mot":"python","quand":"À la fin, après l'étape 1 du tutoriel 06 (niveau 2 installé).","fait":"Vérifie chaque package des niveaux 1, 2 et 3, écrit et relit un fichier NetCDF de test, produit la carte test_geoenv.png et donne dans le Bilan la commande exacte pour installer ce qui manque.","steps":[["Activer geoenv et aller dans Téléchargements","","geo\ndl",null],["Lancer le fichier","","python outil_06_verifier_geoenv.py","« OK » pour tout le niveau 1 (et le niveau 2)."],["Voir la carte de test","","explorer.exe test_geoenv.png","La carte s'ouvre dans Windows. Votre poste est prêt."],["Si des lignes « MANQUANT » apparaissent","Lisez le Bilan en bas de l'écran : il donne la commande exacte à copier pour installer ce qui manque. Relancez ensuite le script.","python outil_06_verifier_geoenv.py",null]],"pb":["P9.7","P6.3","P6.5"]}],"order":[["1","Installer WSL et Ubuntu, mettre à jour, apprendre les commandes de base","00 à 03"],["2","Mettre les trois fichiers outils dans Téléchargements, sans les renommer","09"],["3","Outil 04 : installer les raccourcis","09"],["4","Installer Miniconda et configurer conda (étapes 1 à 6)","05"],["5","Outil 05 : créer l'environnement geoenv","09"],["6","Installer les packages du niveau 2 (étape 1)","06"],["7","Outil 06 : vérifier toute l'installation","09"]]},"en":{"files":{"pdf":{"05":{"name":"Tutoriel_05_Installer_Miniconda_et_creer_lenvironnement_geoenv.pdf","size":221510},"03":{"name":"Tutoriel_03_Naviguer_entre_Ubuntu_et_Windows_commandes_de_base.pdf","size":225064},"02":{"name":"Tutoriel_02_Premier_demarrage_et_mise_a_jour_Ubuntu.pdf","size":194274},"09":{"name":"Tutoriel_09_Mode_demploi_des_trois_outils_du_cours.pdf","size":158812},"01A":{"name":"Tutoriel_01A_Activer_la_virtualisation_dans_le_BIOS.pdf","size":163956},"00":{"name":"Tutoriel_00_Guide_du_parcours_A_LIRE_EN_PREMIER.pdf","size":156806},"03A":{"name":"Tutoriel_03A_Commandes_Ubuntu.pdf","size":430759},"07":{"name":"Tutoriel_07_Aide-memoire_commandes_WSL_Ubuntu_Conda_CDO.pdf","size":189725},"04":{"name":"Tutoriel_04_Creer_ses_raccourcis_de_commandes_alias.pdf","size":182864},"01":{"name":"Tutoriel_01_Installer_WSL2_et_Ubuntu_sous_Windows.pdf","size":168480},"08":{"name":"Tutoriel_08_Depannage_general_et_FAQ.pdf","size":256375},"06":{"name":"Tutoriel_06_Installer_les_packages_Python_climat_et_donnees.pdf","size":248727}},"tools":{"outil_04_installer_alias.sh":{"name":"outil_04_installer_alias.sh","size":2886},"outil_06_verifier_geoenv.py":{"name":"outil_06_verifier_geoenv.py","size":5799},"outil_05_geoenv.yml":{"name":"outil_05_geoenv.yml","size":1444}},"zip":{"name":"Parcours_WSL_Python_Climat_Tutoriels_PDF_et_outils.zip","size":1388633}},"tutos":[{"num":"00","title":"Guide to the path (read first)","sub":"How the tutorials are organised, minimum PC configuration, reading conventions and how to ask for help.","obj":"Understand the order of the tutorials, check that your computer is compatible and learn how to read the boxes.","dur":"10 to 15 minutes","pre":"None.","ou":"No commands in this tutorial (except checking the Windows version).","fin":"A clear view of the path and a PC whose readiness you know.","blocks":[{"h":"1. What is this path for?","i":[{"k":"p","t":"This path installs a real Linux system (Ubuntu) on your Windows computer using **WSL 2** (Windows Subsystem for Linux), then a complete Python environment for processing climate and geographic data (NetCDF files, GeoTIFF, shapefiles, maps, statistics, dashboards)."},{"k":"p","t":"**Why Linux?** The main climate tools (CDO, NCO, xESMF, ESMF) are designed for Linux, and they use the same commands as computing servers and HPC centres. With WSL, you keep Windows and add Linux alongside it: nothing is erased."}]},{"h":"2. Is your computer compatible?","i":[{"k":"table","h":["Item","Minimum","Recommended","How to check"],"r":[["Windows","Windows 10 version 2004 (build 19041)","Windows 11, up to date","Windows + R keys, type `winver`, Enter"],["System type","64-bit","64-bit","Settings > System > About"],["Memory (RAM)","4 GB (slow)","8 GB or more","Same \"About\" screen"],["Free space on C:","15 GB","30 GB or more","File Explorer > This PC"],["Virtualization","Enabled","Enabled","Ctrl + Shift + Esc > Performance > CPU > \"Virtualization\""],["Rights","Administrator of the PC","Administrator of the PC","You can install software"],["Internet","3 to 5 GB to download in total","Stable connection","Plan a place with a good connection"]]},{"k":"note","n":"warn","t":"On a university or company computer, you often do not have administrator rights: ask the IT department before the session, or use your personal computer."},{"k":"note","n":"tip","t":"Are you on a Mac or already on Linux? Skip tutorial 01 and tutorial 02. Simply open the Terminal and start at tutorial 03 (except the \"Windows\" parts), then at tutorial 05 with the Miniconda installer for your system (see tutorial 08, FAQ). Chromebooks are not supported by this path."}]},{"h":"3. The two places where you type commands","i":[{"k":"p","t":"Each command is shown in a box, preceded by the exact place where you must type it. There are two different places. **Confusing them is the most common beginner mistake.**"},{"k":"table","h":["Place","How to open it","How to recognise it (start of line)"],"r":[["PowerShell (Administrator)","Start menu > type \"PowerShell\" > right-click > Run as administrator","`PS C:\\Windows\\system32>` and the window title starts with \"Administrator\""],["PowerShell (normal)","Start menu > \"PowerShell\" > Enter","`PS C:\\Users\\YourName>`"],["Ubuntu (WSL terminal)","Start menu > \"Ubuntu\" > Enter","`ibrahima@PC-NAME:~$` (in green and blue)"],["Ubuntu with geoenv active","In Ubuntu: `conda activate geoenv`","`(geoenv) ibrahima@PC-NAME:~$`"]]}]},{"h":"4. Typing rules","i":[{"k":"ul","i":["Never type the start of the line (`PS C:\\...>` or `ibrahima@PC:~$`): it is displayed by the computer.","Replace what is between angle brackets, brackets included: `<YourName>` becomes, for example, `Aminata`.","One command = one single line. If a long command appears on two lines, type it on a single line, with a space where the line was broken.","Lines starting with `#` are comments: there is no need to type them.","Press Enter after each command and wait for the start of the line to reappear before typing the next one.","In Ubuntu, upper and lower case matter: `Documents` and `documents` are two different names.","When Ubuntu asks for a password, nothing is displayed while you type (no letters, no asterisks). This is normal: type it, then Enter."]},{"k":"table","h":["Action","In the Ubuntu terminal","Remark"],"r":[["Paste","Right-click, or Ctrl + Shift + V","Ctrl + V alone does not always work"],["Copy","Select with the mouse, then Ctrl + Shift + C","Ctrl + C is used to interrupt a command"]]},{"k":"note","n":"warn","t":"Copying and pasting from a PDF can turn straight apostrophes ' into typographic apostrophes ‘ ’ and break lines. If a copied command fails, retype it by hand or use the outil_... files provided. In this dashboard, the **Copy** button copies the exact command, without this problem."}]},{"h":"5. The coloured boxes","i":[{"k":"note","n":"ok","t":"**Expected result**: what you should see if everything went well."},{"k":"note","n":"warn","t":"**Caution**: a point where students often make mistakes."},{"k":"note","n":"tip","t":"**Tip**: a shortcut or a good practice."},{"k":"note","n":"danger","t":"**Danger**: a command that can erase data. Read it twice before running it."},{"k":"note","n":"fail","t":"**If it does not work**: reference to the corresponding problem, for example \"see Problem P1.2\" (P1 = tutorial 01, problem no. 2)."}]},{"h":"6. The golden rules","i":[{"k":"ul","i":["**Read the error message**, especially the last lines: it almost always indicates the cause.","**Do not move on to the next step if the current step has failed**: errors add up.","**Never put `sudo` in front of `conda` or `pip`.** `sudo` is only used for `apt` commands (installing Ubuntu software).","**Do not install Python libraries with pip into the system.** Everything is done in the geoenv environment (tutorial 05 and tutorial 06).","**If something behaves strangely**, the universal remedy: close Ubuntu, type `wsl --shutdown` in PowerShell, reopen Ubuntu. If that is not enough: restart the PC.","**There is no Recycle Bin in Linux**: a file deleted with `rm` is lost permanently, including in your Windows folders."]}]},{"h":"7. How to ask for help effectively","i":[{"k":"p","t":"Before asking for help, look up the error message in the \"Common problems\" section of the current tutorial, then in the **Troubleshooting** tab (index of tutorial 08). If the problem persists, send a message containing these five items:"},{"k":"cmd","w":"msg","c":"1. Tutorial and step: Tutorial 05, step 7\n2. Command typed: conda create -n geoenv ...\n3. COMPLETE error message (copied as text, not a blurry photo)\n4. Output of: wsl -l -v (in PowerShell)\n   and, if conda is involved: conda info (in Ubuntu)\n5. What you have already tried"},{"k":"note","n":"tip","t":"A sharp screenshot (Windows + Shift + S keys) is accepted, but copied text is more useful: it can be searched and copied."}]}],"check":["My Windows version is Windows 11, or Windows 10 version 2004 or later (winver).","My system is 64-bit.","I have at least 15 GB free on drive C:.","Virtualization is \"Enabled\" in Task Manager (otherwise, see tutorial 01A).","I am an administrator of my computer.","I have a decent Internet connection for 1 to 2 hours.","I can tell PowerShell and the Ubuntu terminal apart."],"faq":[],"ver":"Version 2.0 - September 2026","part":"guide"},{"num":"01A","title":"Enable virtualization in the BIOS","sub":"Check whether virtualization is enabled and, if it is \"Disabled\", enable it in the BIOS (HP, Lenovo, Dell, Asus, Acer, MSI...). To be done before tutorial 01.","obj":"Get \"Virtualization: Enabled\" in Task Manager, an essential condition for WSL 2.","dur":"10 to 20 minutes, including one or two restarts.","pre":"Tutorial 00 read. Be the owner of the PC (or have the owner's permission).","ou":"In Windows (check), then in the BIOS (the PC configuration screen, before Windows starts).","fin":"The line \"Virtualization: Enabled\" in Task Manager.","blocks":[{"h":"Why this tutorial?","i":[{"k":"p","t":"WSL 2 runs Ubuntu in a small virtual machine. For this, **CPU virtualization** must be enabled. On many laptops, it is disabled by default in the **BIOS** (or UEFI), the small program that starts the PC before Windows. Without it, the WSL installation fails with error `0x80370102`."},{"k":"note","n":"ok","t":"If virtualization is already \"Enabled\" on your PC, you have nothing to do: go directly to tutorial 01."}]},{"h":"Step 1 - Check the virtualization status","i":[{"k":"ul","i":["Press **Ctrl + Shift + Esc** at the same time: Task Manager opens.","If the window is small, click **More details** at the bottom left.","Open **Performance** (tab at the top in Windows 10, curve-shaped icon on the left in Windows 11), then click **CPU**.","At the bottom right, read the **Virtualization** line."]},{"k":"table","h":["What you read","Meaning","What to do"],"r":[["Virtualization: Enabled","Everything is ready","Nothing. Go to tutorial 01"],["Virtualization: Disabled and \"Hyper-V support: Yes\"","The processor is compatible, but the option is turned off in the BIOS","Follow steps 2 to 6"],["No \"Virtualization\" line","Windows may already be using it","Do the command check below"]]},{"k":"p","t":"**Command check (if needed)**: open PowerShell and type:"},{"k":"cmd","w":"ps","c":"systeminfo"},{"k":"p","t":"Wait a few seconds and read the last lines: \"Virtualization Enabled In Firmware: Yes\" or \"A hypervisor has been detected\" means that everything is ready. \"No\" means that you must follow steps 2 to 6."}]},{"h":"Step 2 - Get ready","i":[{"k":"ul","i":["Save your documents and close your applications: the PC will restart.","Plug in the charger.","Write down the brand and model of the PC (label under the PC, or Settings > System > About). Example: Lenovo IdeaPad 320, HP ProBook 450 G5, Dell Latitude 5490.","Check **BitLocker** (disk encryption): see Problem P1A.5 before going further.","In the BIOS, the mouse often does not work: you move with the keyboard **arrow keys**, confirm with **Enter**, and go back with **Esc**."]},{"k":"note","n":"danger","t":"In the BIOS, change **only** the virtualization option. Do not touch anything else (boot, security, disks, passwords). If in doubt, exit without saving: **Exit Without Saving** (or Esc, then \"Discard Changes\")."}]},{"h":"Step 3 - Enter the BIOS","i":[{"k":"p","t":"**Method A (recommended, works on all recent PCs): from Windows**"},{"k":"ul","i":["**Windows 11**: Settings > System > Recovery > \"Advanced startup\" > Restart now.","**Windows 10**: Settings > Update & Security > Recovery > \"Advanced startup\" > Restart now.","On the blue screen, choose **Troubleshoot > Advanced options > UEFI Firmware Settings > Restart**."]},{"k":"note","n":"ok","t":"The PC restarts directly into the BIOS screen (often blue, grey or black, in English)."},{"k":"note","n":"tip","t":"If \"UEFI Firmware Settings\" does not appear, your PC runs in the old mode (Legacy): use method B."},{"k":"p","t":"**Method B: with a key at startup.** Shut the PC down completely. Turn it back on and press your brand's key repeatedly (about twice per second) as soon as the screen lights up:"},{"k":"table","h":["Brand","Key to press at startup","Remark"],"r":[["HP","Esc, then F10 in the menu that appears","\"Startup Menu\""],["Lenovo ThinkPad","Enter, then F1","\"ThinkPad\" screen at startup"],["Lenovo IdeaPad, Yoga, V","F2 or Fn + F2","Or the Novo button (see below)"],["Dell","F2","F12 opens a menu where you can choose \"BIOS Setup\""],["Asus","F2 (laptops) or Del (desktops)","In \"EZ Mode\", press F7 for advanced mode"],["Acer","F2",""],["MSI","Del",""],["Toshiba / Dynabook, Samsung, Fujitsu","F2",""],["Microsoft Surface","Hold Volume + then press Power","Virtualization usually already enabled"]]},{"k":"p","t":"**Novo button (Lenovo IdeaPad, Yoga)**: with the PC off, press with the tip of a paper clip into the small hole (or on the small button) marked with a curved arrow, on the side or near the power socket. In the \"Novo Button Menu\", choose **BIOS Setup** with the arrow keys, then Enter."},{"k":"note","n":"fail","t":"Windows starts normally without entering the BIOS: see Problem P1A.2."}]},{"h":"Step 4 - Find and enable the option","i":[{"k":"p","t":"The option has one of these names: **Intel Virtualization Technology, Intel VT-x, VTx, Virtualization Technology, Intel Virtual Technology** (Intel processors), or **SVM Mode, AMD-V, AMD SVM Technology** (AMD processors). Here is where to find it:"},{"k":"table","h":["Brand","Path in the BIOS","Setting"],"r":[["HP","Advanced > System Options (or Configuration, or Security > System Security)","Tick Virtualization Technology (VTx)"],["Lenovo ThinkPad","Security > Virtualization","Intel Virtualization Technology: Enabled"],["Lenovo IdeaPad, Yoga, V","Configuration","Intel Virtual Technology (or AMD SVM Technology): Enabled"],["Dell","Virtualization Support > Virtualization (or Virtualization in the left-hand list)","Tick Enable Intel Virtualization Technology"],["Asus","Advanced > CPU Configuration (Intel) or Advanced > SVM Mode (AMD)","Enabled"],["Acer","Advanced (or Main)","Intel Virtualization Technology: Enabled"],["MSI","OC > CPU Features (or Advanced > CPU Configuration)","Intel Virtualization Tech or SVM Mode: Enabled"]]},{"k":"p","t":"**To change the value**: move to the option with the arrow keys, press Enter, choose **Enabled**, then Enter. On some BIOSes, you use +/-, F5/F6, or the space bar to tick."},{"k":"p","t":"**Example 1**: Lenovo IdeaPad with Intel Core i5: F2 at startup > Configuration tab (right arrow) > go down to Intel Virtual Technology > Enter > Enabled > Enter."},{"k":"p","t":"**Example 2**: HP ProBook: Esc then F10 > Advanced tab > System Options > tick Virtualization Technology (VTx) with the space bar."},{"k":"note","n":"fail","t":"Option not found or greyed out: see Problem P1A.3."}]},{"h":"Step 5 - Save and restart","i":[{"k":"ul","i":["Press **F10** (Save and Exit), then choose **Yes** and Enter.","If F10 does not work: go to the **Exit > Save Changes and Exit** tab (or Exit Saving Changes) > Yes.","The PC restarts into Windows. It may restart twice: this is normal."]},{"k":"note","n":"fail","t":"Windows asks for a \"BitLocker recovery key\": see Problem P1A.5."}]},{"h":"Step 6 - Check again","i":[{"k":"p","t":"Repeat step 1: Ctrl + Shift + Esc > Performance > CPU."},{"k":"note","n":"ok","t":"Virtualization: **Enabled**. You can go to tutorial 01, step 3."}]},{"h":"Step 7 - (Only if WSL still shows error 0x80370102)","i":[{"k":"p","t":"If virtualization is \"Enabled\" but the WSL installation still shows error `0x80370102`, open PowerShell as administrator and type these two commands, one after the other:"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart\nbcdedit /set hypervisorlaunchtype auto"},{"k":"p","t":"Restart the PC, then resume tutorial 01, step 4."}]}],"check":["Task Manager shows \"Virtualization: Enabled\".","I did not change any other BIOS option.","Windows starts normally."],"faq":[{"q":"Is enabling virtualization dangerous for my PC?","a":"No. It is a normal processor feature, enabled out of the box on many PCs. It does not damage anything and does not slow Windows down."},{"q":"Will I have to do this again later?","a":"No, the setting is kept. A BIOS update may exceptionally reset it: in that case, repeat step 1 to check."},{"q":"My PC is a Mac. Does this concern me?","a":"No. This tutorial and WSL only concern Windows (see tutorial 08, FAQ)."}],"ver":"Version 2.0 - September 2026","part":"install"},{"num":"01","title":"Install WSL 2 and Ubuntu on Windows","sub":"Enable the Windows Subsystem for Linux, install Ubuntu and check that everything works in WSL 2.","obj":"Install WSL 2 and the Ubuntu distribution on Windows 10 or 11.","dur":"30 to 60 minutes, including one restart and the download (about 500 MB to 1 GB).","pre":"Tutorial 00 read; tutorial 00 checkpoint ticked; administrator rights.","ou":"PowerShell (Administrator) for this whole tutorial.","fin":"The command `wsl -l -v` shows \"Ubuntu\" with VERSION 2.","blocks":[{"h":"Step 1 - Check the Windows version","i":[{"k":"ul","i":["Press the **Windows + R** keys, type `winver`, then Enter.","Windows 11: perfect. Windows 10: the version must be **2004 or later** (build 19041 or later)."]},{"k":"note","n":"fail","t":"Older version: see Problem P1.1."}]},{"h":"Step 2 - Check that virtualization is enabled","i":[{"k":"ul","i":["Press **Ctrl + Shift + Esc** to open Task Manager.","**Performance** tab, then **CPU**.","At the bottom right, read the **Virtualization** line."]},{"k":"note","n":"ok","t":"\"Virtualization: Enabled\"."},{"k":"note","n":"fail","t":"\"Disabled\": you must enable it in the BIOS before continuing: follow tutorial 01A (and Problem P1.2)."}]},{"h":"Step 3 - Open PowerShell in Administrator mode","i":[{"k":"ul","i":["Click the Start menu and type \"PowerShell\".","**Right-click** \"Windows PowerShell\" and choose **Run as administrator**.","Answer **Yes** to the question \"Do you want to allow this app to make changes to your device?\"."]},{"k":"note","n":"ok","t":"The window title starts with \"Administrator: Windows PowerShell\" and the line ends with `PS C:\\Windows\\system32>`."},{"k":"note","n":"fail","t":"Windows asks for an administrator password that you do not have: see Problem P1.3."},{"k":"note","n":"tip","t":"On Windows 11, you can also right-click the Start button and choose \"Terminal (Admin)\"."}]},{"h":"Step 4 - Install WSL and Ubuntu (recommended method)","i":[{"k":"p","t":"Type this single command:"},{"k":"cmd","w":"psa","c":"wsl --install -d Ubuntu"},{"k":"p","t":"Windows enables the required components and downloads the Linux kernel and the Ubuntu distribution. This takes 5 to 20 minutes depending on the connection. **Do not close the window.**"},{"k":"note","n":"ok","t":"Lines \"Installing: Virtual Machine Platform\", \"Installing: Windows Subsystem for Linux\", \"Downloading: Ubuntu\", then \"The requested operation is successful. Changes will not be effective until the system is rebooted.\""},{"k":"note","n":"fail","t":"The command only shows a long list of options (wsl help): see Problem P1.1. An error code 0x8...: look it up in problems P1.2 to P1.6. If nothing works, use the manual method (step 4 bis)."}]},{"h":"Step 4 bis - Manual method (only if step 4 failed)","i":[{"k":"p","t":"Type the following two commands, one after the other (each on a single line):"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart\ndism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"},{"k":"note","n":"ok","t":"For each one: a progress bar up to 100% and \"The operation completed successfully.\""},{"k":"p","t":"Restart the computer (step 5), reopen PowerShell as Administrator, then type:"},{"k":"cmd","w":"psa","c":"wsl --update\nwsl --set-default-version 2\nwsl --install -d Ubuntu"}]},{"h":"Step 5 - Restart the computer","i":[{"k":"p","t":"Save your open documents, then **Start > Power > Restart**. This step is essential."},{"k":"note","n":"warn","t":"Make sure you choose \"Restart\" and not \"Shut down\": with Windows fast startup, \"Shut down\" and then turning the PC back on does not always complete the installation."}]},{"h":"Step 6 - First launch of Ubuntu","i":[{"k":"p","t":"After the restart, an Ubuntu window often opens by itself with the message \"Installing, this may take a few minutes...\". If it does not open, click Start, type \"Ubuntu\", then Enter."},{"k":"p","t":"When the window shows `Enter new UNIX username:`, go to **tutorial 02, step 2** to create your Linux account, then come back here for step 7."},{"k":"note","n":"fail","t":"The window opens and closes immediately, or shows an error code: see Problem P1.10."}]},{"h":"Step 7 - Check the installation","i":[{"k":"p","t":"In a PowerShell window (normal or administrator), type:"},{"k":"cmd","w":"ps","c":"wsl -l -v"},{"k":"out","t":"  NAME      STATE           VERSION\n* Ubuntu    Running         2"},{"k":"note","n":"ok","t":"A line \"Ubuntu\" (or \"Ubuntu-24.04\") with **VERSION 2**. The state can be \"Running\" or \"Stopped\": both are normal."},{"k":"note","n":"fail","t":"VERSION 1: see Problem P1.7. Message \"Windows Subsystem for Linux has no installed distributions.\": see Problem P1.8."}]},{"h":"Step 8 - Update WSL and note its version","i":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --version"},{"k":"out","t":"WSL version: 2.x.x.x\nKernel version: 6.x.x.x\nWSLg version: 1.x.x\nWindows version: 10.0.2xxxx.xxxx"},{"k":"note","n":"fail","t":"`wsl --version` returns an error or the list of options: see Problem P1.9."},{"k":"note","n":"tip","t":"Keep a copy of this output: it is requested when you ask for help (tutorial 00, section 7)."}]}],"check":["`wsl -l -v` shows Ubuntu with VERSION 2.","`wsl --version` shows a WSL version 2.x.","I opened Ubuntu from the Start menu and created my account (tutorial 02, steps 1 to 3)."],"faq":[{"q":"Do I need Windows Pro?","a":"No. Windows 10 or 11 Home is enough."},{"q":"Does this erase Windows or my files?","a":"No. Ubuntu is installed alongside Windows, like an application. Your Windows files remain intact and accessible from Ubuntu (tutorial 03)."},{"q":"How much disk space is used?","a":"About 2 to 3 GB for Ubuntu, then 5 to 8 GB for Miniconda and the geoenv environment (tutorial 05 and tutorial 06)."},{"q":"Which Ubuntu version should I choose?","a":"The one installed by default (an LTS version, with long-term support, for example 24.04). The command `wsl --list --online` shows the available versions if you need to choose a specific one."},{"q":"The Microsoft Store is blocked on my PC. Can I still install Ubuntu?","a":"Yes, with the `--web-download` option (Problem P1.6)."},{"q":"I already have VirtualBox, VMware or an Android emulator. Is there a conflict?","a":"Recent versions of these programs work with WSL 2. Update them. A very old version of VirtualBox may become slow or refuse to start its machines."},{"q":"Do I have to repeat this tutorial every time I use it?","a":"No. The installation is done only once. Afterwards, you simply open \"Ubuntu\" from the Start menu."}],"ver":"Version 2.0 - September 2026","part":"install"},{"num":"02","title":"First start and update of Ubuntu","sub":"Create your Linux account, update the system and install the basic tools (text editors, image viewer).","obj":"Configure Ubuntu at first launch and prepare it for the rest of the path.","dur":"20 to 40 minutes (the update depends on the connection).","pre":"Tutorial 01 completed (Ubuntu installed in WSL 2).","ou":"Ubuntu (WSL terminal), unless stated otherwise.","fin":"A Linux account with a password, an up-to-date Ubuntu, and the tools wget, git, nano, gedit, eog... installed.","blocks":[{"h":"Step 1 - Launch Ubuntu","i":[{"k":"ul","i":["Start menu, type \"Ubuntu\", then Enter;","or, in Windows Terminal, click the small arrow ˅ next to the tab and choose \"Ubuntu\";","or, in PowerShell, simply type `wsl`."]},{"k":"p","t":"At the very first launch, Ubuntu prepares its system: \"Installing, this may take a few minutes...\". Wait (1 to 5 minutes)."}]},{"h":"Step 2 - Create your Linux user name","i":[{"k":"p","t":"Ubuntu displays: `Enter new UNIX username:`. Type a name, then Enter. Rules to follow:"},{"k":"ul","i":["only **lowercase letters and digits**, no spaces, no accents, starting with a letter;","short and easy to remember: for example `ibrahima`, `adiallo`, `fatou2`."]},{"k":"note","n":"tip","t":"This name does not need to be the same as your Windows name."},{"k":"note","n":"fail","t":"Message \"adduser: Please enter a username matching the regular expression...\": see Problem P2.1."}]},{"h":"Step 3 - Create your Linux password","i":[{"k":"p","t":"Ubuntu displays `New password:`. Type a password, then Enter, then type it again after `Retype new password:`."},{"k":"note","n":"warn","t":"Nothing is displayed while you type (no letters, no asterisks): this is normal and intended. Type calmly, then Enter."},{"k":"note","n":"warn","t":"Write this password down in a safe place. It will be requested for every command starting with `sudo`. It is **independent** of your Windows password."},{"k":"out","t":"passwd: password updated successfully\nInstallation successful!\nibrahima@PC-NAME:~$"},{"k":"p","t":"The last line is the **command prompt**. It reads as follows:"},{"k":"table","h":["Part","Meaning"],"r":[["ibrahima","your Linux user name"],["@PC-NAME","the name of your computer"],["~","the folder you are in; `~` means your home folder `/home/ibrahima`"],["$","Ubuntu is waiting for your command (`#` instead of `$` means that you are \"root\", see Problem P2.12)"]]},{"k":"note","n":"fail","t":"\"Sorry, passwords do not match\": start again, see Problem P2.2."}]},{"h":"Step 4 - Update Ubuntu","i":[{"k":"p","t":"Type the following two commands, one after the other:"},{"k":"cmd","w":"ub","c":"sudo apt update\nsudo apt upgrade -y"},{"k":"ul","i":["`sudo` runs the command with Linux administrator rights: it asks for your Linux password (invisible). It does not ask again for about 15 minutes.","`apt update` downloads the list of available software; `apt upgrade -y` installs the updates (`-y` answers \"yes\" automatically).","Duration: 2 to 15 minutes. Do not close the window during the operation."]},{"k":"out","t":"Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease\n...\nReading package lists... Done\n...\nProcessing triggers for man-db ...\nibrahima@PC-NAME:~$"},{"k":"note","n":"tip","t":"If a purple or blue screen appears with a question (for example \"Which services should be restarted?\"), simply press Enter to accept the proposed choice."},{"k":"note","n":"fail","t":"\"Temporary failure resolving\": P2.3; \"Could not get lock\": P2.4; \"dpkg was interrupted\": P2.5; \"is not valid yet\": P2.6; stuck at \"0% [Connecting to...]\": P2.7."}]},{"h":"Step 5 - Install the basic tools","i":[{"k":"cmd","w":"ub","c":"sudo apt install -y build-essential wget curl git nano unzip zip tree htop dos2unix"},{"k":"table","h":["Tool","Role"],"r":[["build-essential","compilers (gcc, make) required by some software"],["wget, curl","download files from the Internet (Miniconda, data)"],["git","manage code versions and retrieve projects (GitHub)"],["nano","text editor in the terminal; always works, even without a graphical display"],["unzip, zip","extract and create .zip archives"],["tree","display the tree structure of a folder"],["htop","see processor and memory usage (quit with q)"],["dos2unix","fix the line endings of files written on Windows"]]}]},{"h":"Step 6 - Install the graphical applications (editors and images)","i":[{"k":"p","t":"WSL can display Linux windows on Windows 11, and on an up-to-date Windows 10 (after `wsl --update`). Install:"},{"k":"cmd","w":"ub","c":"sudo apt install -y gedit eog imagemagick\n# Optional (large, about 500 MB): the Kate editor\nsudo apt install -y kate"},{"k":"table","h":["Application","Role","Launch"],"r":[["gedit","simple text editor","`gedit mon_script.py &`"],["kate","advanced text editor (line numbers, syntax highlighting)","`kate mon_script.py &`"],["eog","image viewer","`eog figure.png &`"],["imagemagick","provides the display command to show an image","`display figure.png &`"]]},{"k":"p","t":"Test:"},{"k":"cmd","w":"ub","c":"gedit &"},{"k":"note","n":"ok","t":"A gedit window opens on the Windows desktop. Close it."},{"k":"note","n":"tip","t":"The final `&` runs the application \"in the background\": the terminal remains usable while the window is open."},{"k":"note","n":"fail","t":"\"cannot open display\" or no window: see Problem P2.8. This does not block the rest of the path."}]},{"h":"Step 7 - Check Python (without installing anything)","i":[{"k":"cmd","w":"ub","c":"python3 --version"},{"k":"out","t":"Python 3.12.3"},{"k":"note","n":"warn","t":"Do not install Python libraries with `pip` at this stage, and do not use `sudo pip`. All libraries will be installed in the conda environment geoenv (tutorial 05 and tutorial 06). On recent Ubuntu, `pip install` outside an environment actually produces the error \"externally-managed-environment\" (Problem P2.9)."},{"k":"p","t":"**Note**: in Ubuntu, the command is called `python3`. The `python` command only exists once the conda environment is activated (tutorial 05). \"python: command not found\" at this stage is therefore normal."}]},{"h":"Step 8 - Quit and relaunch Ubuntu properly","i":[{"k":"ul","i":["To quit: type `exit` or close the window.","To restart Ubuntu completely (useful in case of a problem), type in **PowerShell**: `wsl --shutdown`, then reopen Ubuntu.","To update Ubuntu in the future (once a month, for example): `sudo apt update && sudo apt upgrade -y` (or the `maj` alias from tutorial 04)."]}]}],"check":["The prompt shows my_name@PC-NAME:~$ (with $, not #).","I know my Linux password and `sudo apt update` works without errors.","`sudo apt upgrade -y` finished without errors.","`wget --version` and `git --version` display a version number.","`gedit &` opens a window, or I know how to use nano instead (Problem P2.8).","`python3 --version` displays Python 3.x."],"faq":[{"q":"Is my Ubuntu password the same as my Windows password?","a":"No, they are two independent accounts."},{"q":"Can I change my Linux password?","a":"Yes: type `passwd` in Ubuntu (it asks for the old one, then the new one)."},{"q":"How often should I update Ubuntu?","a":"About once a month, and always before installing new software: `sudo apt update && sudo apt upgrade -y`."},{"q":"Can I close the window during an update?","a":"No. Wait for the `$` prompt to return. An interruption causes Problem P2.5."},{"q":"What is the difference between apt and pip/conda?","a":"`apt` installs Ubuntu system software (with `sudo`). `conda` installs Python libraries in an isolated environment (without `sudo`). In this path: apt for system tools, conda for Python."}],"ver":"Version 2.0 - September 2026","part":"install"},{"num":"03","title":"Moving between Ubuntu and Windows: the basic commands","sub":"Find your Windows files from Ubuntu (and the other way round), move around, and create, copy and delete files safely.","obj":"Master Linux paths, access Windows folders and use the essential terminal commands.","dur":"30 to 45 minutes, including the exercise.","pre":"tutorial 02 completed.","ou":"Ubuntu (WSL terminal).","fin":"A cours_climat project folder created in your Windows Documents and a good command of the basic commands.","blocks":[{"h":"1. Two file systems on the same PC","i":[{"k":"p","t":"Ubuntu has its own file space (your home folder `/home/<name>`, abbreviated `~`). Your Windows drives are visible in Ubuntu under `/mnt`: drive C: becomes `/mnt/c`, drive D: becomes `/mnt/d`."},{"k":"table","h":["In Windows","In Ubuntu"],"r":[["`C:\\Users\\Aminata\\Documents`","`/mnt/c/Users/Aminata/Documents`"],["`C:\\Users\\Aminata\\Downloads` (shown as Téléchargements on a French-language Windows)","`/mnt/c/Users/Aminata/Downloads`"],["`D:\\Donnees\\CHIRPS`","`/mnt/d/Donnees/CHIRPS`"],["`\\\\wsl.localhost\\Ubuntu\\home\\aminata`","`/home/aminata` or `~`"]]},{"k":"p","t":"**Three conversion rules** (try them in the **Paths** tab):"},{"k":"ul","i":["the Windows backslash `\\` becomes `/`;","`C:` becomes `/mnt/c` (always lowercase);","Ubuntu is case-sensitive: `Documents` ≠ `documents`."]}]},{"h":"Step 1 - Find the name of your Windows folder","i":[{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/"},{"k":"out","t":"'All Users'   Default   'Default User'   Public   Aminata   desktop.ini"},{"k":"p","t":"Ignore `All Users`, `Default`, `Default User`, `Public` and `desktop.ini`. The remaining name (here `Aminata`) is your Windows folder name. Write it down **exactly** (including capital letters): it will be used everywhere in the form `<WindowsName>`."},{"k":"note","n":"warn","t":"The folder name may differ from the name displayed by Windows. With a Microsoft account, it is often shortened to the first 5 letters of the email address (for example `amina` for aminata.diallo@outlook.com). Only the result of `ls /mnt/c/Users/` is reliable. On the author's PC, this name is `User`: this is why older versions of the tutorials used `/mnt/c/Users/User`."},{"k":"note","n":"tip","t":"Automatic method, which directly gives the full path:"},{"k":"cmd","w":"ub","c":"wslpath \"$(cd /mnt/c && cmd.exe /c 'echo %USERPROFILE%' | tr -d '\\r')\""}]},{"h":"Step 2 - Go to your Windows folders","i":[{"k":"cmd","w":"ub","c":"cd /mnt/c/Users/<WindowsName>\nls\ncd Documents\npwd"},{"k":"out","t":"/mnt/c/Users/Aminata/Documents"},{"k":"p","t":"In Ubuntu, Windows folders always have their real **English** names. On a French-language Windows, File Explorer may display translated names, but Ubuntu shows the real ones:"},{"k":"table","h":["File Explorer (French-language Windows)","Name in Ubuntu"],"r":[["Bureau","Desktop"],["Documents","Documents"],["Téléchargements","Downloads"],["Images","Pictures"]]},{"k":"note","n":"fail","t":"Desktop or Documents folder empty or not found: it is probably in OneDrive, see Problem P3.3."}]},{"h":"Step 3 - Handle spaces in names","i":[{"k":"p","t":"A space separates the parts of a command. A name containing a space must therefore be put **in double quotes**:"},{"k":"cmd","w":"ub","c":"cd \"/mnt/c/Users/<WindowsName>/Documents/Mes donnees\""},{"k":"note","n":"tip","t":"The **Tab** key completes names automatically and adds the necessary protections itself. Type `cd Doc` then Tab: Ubuntu completes it to `cd Documents/`. Press Tab twice to see all possibilities."},{"k":"note","n":"tip","t":"For your own files, avoid spaces and accents: prefer `donnees_chirps_2020.nc` to `Données CHIRPS 2020.nc`."}]},{"h":"Step 4 - Go from the terminal to Windows File Explorer (and back)","i":[{"k":"cmd","w":"ub","c":"explorer.exe ."},{"k":"p","t":"The dot `.` means the current folder: Windows File Explorer opens at the place where you are in Ubuntu. In the other direction, to see your Linux files from Windows:"},{"k":"ul","i":["in the left pane of File Explorer, click **Linux > Ubuntu > home > <your_linux_name>**;","or type in the address bar: `\\\\wsl.localhost\\Ubuntu\\home\\<your_linux_name>` (on older versions: `\\\\wsl$\\Ubuntu\\home\\<your_linux_name>`)."]},{"k":"note","n":"danger","t":"Never try to open or modify Ubuntu's hidden `ext4.vhdx` file in the Windows AppData folders: you could make Ubuntu unusable."}]},{"h":"Step 5 - Where should you store your work?","i":[{"k":"table","h":["Location","Advantages","Disadvantages"],"r":[["Windows folders (`/mnt/c/Users/<WindowsName>/...`)","Directly visible in File Explorer, easy to share and back up","Slower with very many small files (git, conda)"],["Linux folder (`~/...`)","Fast; required for Miniconda","Accessible from Windows only through `\\\\wsl.localhost\\...`"]]},{"k":"note","n":"tip","t":"**Recommendation for this course**: Miniconda is always installed in `~` (tutorial 05); your scripts, data and figures can be kept in your Windows Documents to start with."}]},{"h":"The essential commands","i":[{"k":"p","t":"The details of each command, with examples and pitfalls, are in **tutorial 03A**. The **Commands** tab gathers all the commands of the course."},{"k":"table","h":["Command","Purpose","Example"],"r":[["`pwd`","show the current folder","`pwd`"],["`ls`, `ls -lh`, `ls -lrt`, `ls -a`","list; in detail; by date; including hidden files","`ls -lh donnees/`"],["`tree -L 2`","folder tree over 2 levels","`tree -L 2 cours_climat`"],["`cd folder`, `cd ..`, `cd`, `cd -`","enter; go up; home folder; previous folder","`cd Desktop`"],["`mkdir -p a/b/c`","create several levels at once","`mkdir -p projet/donnees/brutes`"],["`cp`, `cp -r`","copy a file, a whole folder","`cp -r scripts scripts_v2`"],["`mv old new`","move or rename","`mv test.py analyse_pluie.py`"],["`touch file`","create an empty file","`touch notes.txt`"],["`rm`, `rm -i`, `rm -r`, `rmdir`","delete; with confirmation; a folder and its contents; an empty folder","`rm -i *.png`"],["`cat`, `less`, `head -n 20`, `tail -n 20`","read a file","`head -n 5 stations.csv`"],["`wc -l file`","count lines","`wc -l stations.csv`"],["`find . -name \"*.nc\"`","search for files by name","`find . -name \"*chirps*\"`"],["`grep -n \"word\" file`","search for a word in a file","`grep -n \"import\" analyse.py`"],["`du -sh folder`, `df -h`","size of a folder; free space","`df -h ~`"],["`clear`, `history`, `--help`, `man`, `exit`","clear the screen; history; help; manual; quit","`ls --help`"]]},{"k":"note","n":"danger","t":"There is **no recycle bin** in the terminal. `rm` deletes permanently, including Windows files under `/mnt/c`. Always check with `pwd` and `ls` before `rm -r`. Never run `rm -rf /`, `rm -rf ~` or `rm -rf *` without knowing exactly where you are."}]},{"h":"Essential keyboard shortcuts","i":[{"k":"table","h":["Key","Effect"],"r":[["Tab","complete a name (twice: see the possible choices)"],["Up / Down arrow","recall previous commands"],["Ctrl + C","interrupt the running command (it does not copy)"],["Ctrl + Shift + C / Ctrl + Shift + V","copy / paste (or right-click to paste)"],["Ctrl + R","search the command history"],["Ctrl + L","clear the screen"],["Ctrl + D","quit the terminal (like exit)"],["Ctrl + Z","suspend (it does not undo): see Problem P3.8"]]}]},{"h":"Guided exercise: create the course folder","i":[{"k":"cmd","w":"ub","c":"cd /mnt/c/Users/<WindowsName>/Documents\nmkdir -p cours_climat/donnees cours_climat/scripts cours_climat/figures\ncd cours_climat\ntree\nexplorer.exe ."},{"k":"out","t":".\n├── donnees\n├── figures\n└── scripts\n\n3 directories, 0 files"},{"k":"note","n":"ok","t":"Windows File Explorer opens on `Documents\\cours_climat` with the three subfolders."},{"k":"p","t":"Continue the exercise: create a file, rename it, copy it, then delete the copy."},{"k":"cmd","w":"ub","c":"touch scripts/essai.py\nmv scripts/essai.py scripts/premier_script.py\ncp scripts/premier_script.py scripts/copie.py\nls -l scripts\nrm -i scripts/copie.py"}]}],"check":["I know my exact <WindowsName>.","I can go to my Windows Documents from Ubuntu and come back to ~.","I can open Windows File Explorer on the current folder (`explorer.exe .`).","I use the Tab key to complete names.","The cours_climat folder with its three subfolders exists in my Documents.","I know that `rm` deletes permanently."],"faq":[{"q":"How do I copy a file from my Windows Downloads folder to Ubuntu?","a":"`cp /mnt/c/Users/<WindowsName>/Downloads/donnees.nc ~/`"},{"q":"And from Ubuntu to my Windows Desktop?","a":"`cp ~/figure.png /mnt/c/Users/<WindowsName>/Desktop/`"},{"q":"How do I access a USB stick?","a":"If the stick appears as E: in Windows, it is usually visible under `/mnt/e`. Otherwise: `sudo mkdir -p /mnt/e && sudo mount -t drvfs E: /mnt/e`."},{"q":"Can I edit my Linux files with Windows software?","a":"Yes, through `\\\\wsl.localhost\\Ubuntu\\...` in File Explorer (step 4), or with Visual Studio Code (tutorial 06)."}],"ver":"Version 2.0 - September 2026","part":"install"},{"num":"03A","title":"Ubuntu commands explained simply","sub":"Each useful command explained one by one: what it is for, how to write it, what appears on the screen and the mistake to avoid.","obj":"Be able to use the basic Ubuntu commands on your own: find your way, create, write, read, copy, rename, search, delete, install software and run a script.","dur":"1 h 30 to 2 h, including the exercises. You can do it in two sessions (parts 1 to 8, then 9 to 18).","pre":"tutorial 02 completed (Ubuntu installed and up to date). Read it together with tutorial 03 or just after it.","ou":"Ubuntu (WSL terminal). Never in PowerShell.","fin":"A practice folder ~/entrainement that you have filled yourself, and a summary sheet of all the commands.","blocks":[{"h":"How to use this tutorial","i":[{"k":"table","h":["Part","What it tells you"],"r":[["What it is for","The purpose of the command, in one sentence."],["How to write it","The pattern to follow. Whatever is between `< >` must be replaced by your own value."],["Example","A dark box: the exact command to type."],["What you see","A green box: what should appear on the screen."],["Watch out","The mistake that beginners often make."]]},{"k":"note","n":"tip","t":"Most important: **type every example yourself**. You learn commands with your fingers, not with your eyes. All the examples are done in a practice folder: there is no risk."}]},{"h":"1. Before you start: the prompt and the shape of a command","i":[{"k":"p","t":"Open Ubuntu. The last line looks like `aminata@PC-AMINATA:~$`. This line is called the **prompt**. It means: \"I am ready, type a command\"."},{"k":"table","h":["Part","Meaning"],"r":[["aminata","your Linux user name"],["@PC-AMINATA","the name of your computer"],["~","the folder you are in right now (~ = your home folder)"],["$","Ubuntu is waiting for your command"]]},{"k":"note","n":"warn","t":"Never type the prompt. It is displayed by the computer. You only type what comes after it."},{"k":"p","t":"A command looks like a short sentence: a **verb** (what you do), sometimes a **manner** (the option, which starts with a hyphen), and an **object** (what you act on)."},{"k":"cmd","w":"ub","c":"ls -l Documents"},{"k":"table","h":["Piece","Name","Role"],"r":[["ls","the command (the verb)","\"list\", that is, show the contents"],["-l","the option (the manner)","\"in detail\" (size, date...)"],["Documents","the target (the object)","the folder whose contents you want to see"]]},{"k":"p","t":"**The six typing rules**:"},{"k":"ol","i":["Put a space between each piece: `ls -l Documents`, not `ls-lDocuments`.","Capital letters matter: `Documents` and `documents` are two different names.","Press Enter to run the command.","Wait for the `$` prompt to come back before typing the next command.","One command = one single line.","Lines starting with `#` are comments (explanations). Do not type them."]},{"k":"table","h":["Key","What it does"],"r":[["Tab","Completes a name by itself. Type `cd Doc` then Tab: Ubuntu writes `cd Documents/`. Tab twice: the list of choices."],["Up arrow","Brings back the previous command. Very useful to fix a typo without retyping everything."],["Ctrl + C","Stops the running command. In the terminal, Ctrl + C is not used to copy."],["Right-click or Ctrl + Shift + V","Paste into the terminal."],["Ctrl + Shift + C","Copy the text selected with the mouse."],["Ctrl + L","Clear the screen (your files are not affected)."]]},{"k":"note","n":"ok","t":"**If nothing happens**: after a successful command, Ubuntu often displays nothing: the prompt comes back, that is all. In Linux, no message = everything went well. A problem, on the other hand, is always displayed, for example `No such file or directory` (file or folder not found). Part 17 explains the most frequent messages."}]},{"h":"2. Finding your way: pwd, ls and paths","i":[{"k":"p","t":"**pwd**: show the folder you are in right now. It is your \"You are here\" on a map."},{"k":"cmd","w":"ub","c":"pwd"},{"k":"out","t":"/home/aminata"},{"k":"note","n":"tip","t":"Before any important command (and especially before deleting), type `pwd` to check where you are."},{"k":"p","t":"**ls**: list the contents of a folder. `ls` for the folder you are in, or `ls <folder>` for another folder."},{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/"},{"k":"out","t":"'All Users'  Default  'Default User'  Public  Aminata  desktop.ini"},{"k":"table","h":["Command","What it shows"],"r":[["`ls`","names only"],["`ls -l`","a detailed list: type, size, date, name"],["`ls -lh`","the same list, with readable sizes (K, M, G)"],["`ls -a`","hidden files too (their name starts with a dot, for example .bashrc)"],["`ls -lrt`","the detailed list, sorted by date: the most recent file is at the bottom"]]},{"k":"out","t":"drwxr-xr-x 2 aminata aminata 4.0K Oct 12 10:15 donnees\n-rw-r--r-- 1 aminata aminata  120 Oct 12 10:20 notes.txt"},{"k":"p","t":"To read a line: the first letter gives the type (`d` = folder, `-` = file). Then come the owner, the size, the modification date and the name. The rest (`rwx...`) concerns permissions: you can ignore it for now."},{"k":"p","t":"**Paths.** A path is the address of a file or folder. Folders are separated by a slash `/` (not `\\` as in Windows)."},{"k":"table","h":["Symbol","Meaning"],"r":[["/","the root: the very first folder, which contains all the others"],["~","your home folder (/home/aminata)"],[".","the folder you are in (\"here\")"],["..","the parent folder, just above"],["/mnt/c","the Windows C: drive"]]},{"k":"ul","i":["**Full (absolute) path**: it starts with `/` or `~`. Valid from anywhere. Example: `/home/aminata/entrainement/donnees`.","**Relative path**: it starts from the folder you are in. Example: if you are in `/home/aminata/entrainement`, then `donnees` is enough."]},{"k":"note","n":"tip","t":"When in doubt, use the full path: it always works, wherever you are."}]},{"h":"3. Creating and moving around: mkdir, cd, touch, tree","i":[{"k":"p","t":"**mkdir** creates a folder (\"make directory\"). Let us create your practice folder:"},{"k":"cmd","w":"ub","c":"cd ~\nmkdir entrainement\nls"},{"k":"out","t":"entrainement"},{"k":"p","t":"The `-p` option also creates any missing intermediate folders, with no error if they already exist:"},{"k":"cmd","w":"ub","c":"mkdir -p entrainement/donnees entrainement/scripts entrainement/figures"},{"k":"note","n":"warn","t":"Avoid spaces and accents in your names: write `donnees_pluie`, not `Données pluie`. Use the underscore `_` instead of a space."},{"k":"p","t":"**cd** changes folder (\"change directory\"). It is the equivalent of double-clicking a folder."},{"k":"cmd","w":"ub","c":"cd entrainement\npwd\nls"},{"k":"out","t":"/home/aminata/entrainement\ndonnees  figures  scripts"},{"k":"table","h":["Command","Effect"],"r":[["`cd donnees`","enter the donnees subfolder"],["`cd ..`","go up one level"],["`cd ../scripts`","go up one level then enter scripts"],["`cd` or `cd ~`","go straight back to your home folder"],["`cd -`","go back to the folder you were in just before"],["`cd ~/entrainement`","go directly to a full address"],["`cd /mnt/c/Users/<WindowsName>/Documents`","go to your Windows Documents"]]},{"k":"cmd","w":"ub","c":"cd ~/entrainement/donnees\npwd\ncd ..\npwd\ncd\npwd"},{"k":"out","t":"/home/aminata/entrainement/donnees\n/home/aminata/entrainement\n/home/aminata"},{"k":"note","n":"warn","t":"A name containing a space must be put in double quotes: `cd \"Mes donnees\"`. Without quotes, Ubuntu thinks there are two names and displays an error."},{"k":"p","t":"**touch** creates an empty file, which you will fill later:"},{"k":"cmd","w":"ub","c":"cd ~/entrainement\ntouch notes.txt\nls -l"},{"k":"out","t":"drwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 donnees\ndrwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 figures\n-rw-r--r-- 1 aminata aminata    0 Oct 12 10:20 notes.txt\ndrwxr-xr-x 2 aminata aminata 4096 Oct 12 10:15 scripts"},{"k":"p","t":"The file `notes.txt` exists, with a size of 0: it is empty. **tree** draws the folder tree (installed in tutorial 02):"},{"k":"cmd","w":"ub","c":"tree ~/entrainement"},{"k":"out","t":"/home/aminata/entrainement\n├── donnees\n├── figures\n├── notes.txt\n└── scripts\n\n3 directories, 1 file"}]},{"h":"4. Writing to a file: nano and echo","i":[{"k":"p","t":"**nano** opens a text file in the terminal. It always works, even when graphical windows (gedit, kate) do not open. If nano seems difficult to you and graphical display works, `gedit file &` or `kate file &` do the same thing with the mouse."},{"k":"p","t":"Step 1. Open the file:"},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nnano donnees/stations.csv"},{"k":"p","t":"Step 2. Type (or paste with a right-click) these five lines:"},{"k":"cmd","w":"nano","c":"station,annee,pluie_mm\nLabe,2020,1620\nDakar,2020,410\nKedougou,2020,1180\nZiguinchor,2020,1450"},{"k":"p","t":"Step 3. Save: **Ctrl + O**, then **Enter**. Step 4. Quit: **Ctrl + X**."},{"k":"table","h":["Key in nano","Effect"],"r":[["Ctrl + O then Enter","save (\"O\" as in \"Output\")"],["Ctrl + X","quit"],["Ctrl + K","cut the whole line"],["Ctrl + U","paste the cut line"],["Ctrl + W","search for a word"],["Alt + /","go to the end of the file"],["Arrow keys","move around (the mouse does not move the cursor)"]]},{"k":"note","n":"warn","t":"At the bottom of the nano screen, the `^` sign means Ctrl. `^X Exit` means \"Ctrl + X to quit\". If you quit without saving, nano asks \"Save modified buffer?\": type Y (yes) then Enter, or N (no) to discard the changes."},{"k":"p","t":"**echo** displays a text. With `>` or `>>`, this text is written to a file:"},{"k":"cmd","w":"ub","c":"echo \"Premiere note du cours\" > notes.txt\necho \"Deuxieme note\" >> notes.txt\ncat notes.txt"},{"k":"out","t":"Premiere note du cours\nDeuxieme note"},{"k":"table","h":["Sign","Effect"],"r":[["`>`","**replaces** the whole content of the file with the text (the old content is lost)"],["`>>`","**adds** the text at the end of the file (the old content is kept)"]]},{"k":"note","n":"danger","t":"A single `>` erases the existing content of the file, without asking for confirmation. To add a line, always use `>>` (two signs)."}]},{"h":"5. Reading a file: cat, less, head, tail, wc","i":[{"k":"cmd","w":"ub","c":"cat donnees/stations.csv"},{"k":"out","t":"station,annee,pluie_mm\nLabe,2020,1620\nDakar,2020,410\nKedougou,2020,1180\nZiguinchor,2020,1450"},{"k":"note","n":"warn","t":"Do not use `cat` on a very long file or on a non-text file (.nc, .tif, .png): the screen fills with unreadable characters. If this happens, type Ctrl + C then the command `reset`."},{"k":"p","t":"**less** reads a long file page by page, without modifying it: Space (next page), b (previous page), `/word` then Enter (search), **q (quit, absolutely remember this)**."},{"k":"cmd","w":"ub","c":"less donnees/stations.csv"},{"k":"p","t":"**head** and **tail** show the first or the last lines (10 by default without `-n`):"},{"k":"cmd","w":"ub","c":"head -n 2 donnees/stations.csv\ntail -n 1 donnees/stations.csv"},{"k":"out","t":"station,annee,pluie_mm\nLabe,2020,1620\nZiguinchor,2020,1450"},{"k":"p","t":"**wc -l** counts lines (\"word count\", option `-l` for \"lines\"):"},{"k":"cmd","w":"ub","c":"wc -l donnees/stations.csv"},{"k":"out","t":"5 donnees/stations.csv"},{"k":"p","t":"The file has 5 lines: 1 header line and 4 stations."}]},{"h":"6. Copying, moving, renaming: cp and mv","i":[{"k":"p","t":"**cp source destination**. Always in this order: first what you copy, then where you put it."},{"k":"cmd","w":"ub","c":"cd ~/entrainement\ncp donnees/stations.csv donnees/stations_copie.csv\nls donnees"},{"k":"out","t":"stations.csv  stations_copie.csv"},{"k":"p","t":"To copy a whole folder, add `-r` (\"recursive\": the folder and everything it contains)."},{"k":"cmd","w":"ub","c":"cp -r donnees donnees_sauvegarde\nls"},{"k":"out","t":"donnees  donnees_sauvegarde  figures  notes.txt  scripts"},{"k":"table","h":["Useful example","Effect"],"r":[["`cp ~/carte.png /mnt/c/Users/<WindowsName>/Desktop/`","copy a figure from Ubuntu to the Windows Desktop"],["`cp /mnt/c/Users/<WindowsName>/Downloads/data.nc ~/entrainement/donnees/`","copy a file downloaded in Windows to Ubuntu"]]},{"k":"note","n":"warn","t":"Without `-r`, copying a folder fails with `cp: -r not specified; omitting directory`. If a file with the same name already exists at the destination, `cp` overwrites it without warning. To be warned, use `cp -i`."},{"k":"p","t":"**mv old new** has two uses: rename (same folder, new name) or move (same name, other folder). It also works for folders, with no option."},{"k":"cmd","w":"ub","c":"mv donnees/stations_copie.csv donnees/stations_2020.csv\nls donnees"},{"k":"out","t":"stations.csv  stations_2020.csv"},{"k":"cmd","w":"ub","c":"mv notes.txt scripts/\nls scripts"},{"k":"out","t":"notes.txt"},{"k":"note","n":"tip","t":"A `/` at the end of the destination (`scripts/`) clearly shows that it is a folder. If this folder does not exist, Ubuntu displays an error instead of renaming your file by mistake."}]},{"h":"7. Deleting (carefully): rm, rm -r, rmdir","i":[{"k":"note","n":"danger","t":"The terminal **has no recycle bin**. A file deleted with `rm` is lost permanently, even if it is in your Windows folders (`/mnt/c/...`)."},{"k":"p","t":"**rm -i** asks for confirmation for each file:"},{"k":"cmd","w":"ub","c":"rm -i donnees/stations_2020.csv"},{"k":"out","t":"rm: remove regular file 'donnees/stations_2020.csv'?"},{"k":"p","t":"Type `y` (\"yes\") then Enter to delete, or `n` then Enter to cancel. **rm -r** deletes a folder and all its contents, without confirmation:"},{"k":"cmd","w":"ub","c":"rm -r donnees_sauvegarde"},{"k":"p","t":"**rmdir folder** deletes a folder only if it is empty. If it contains something, the command refuses (`Directory not empty`). It is the safest way to clean up."},{"k":"p","t":"**The three-check rule**, before every deletion:"},{"k":"ol","i":["`pwd`: I check where I am.","`ls`: I check what I am going to delete.","`rm -i`: I confirm file by file."]},{"k":"note","n":"danger","t":"Never run `rm -rf /`, `rm -rf ~`, `rm -rf *` or `sudo rm -rf ...` without knowing exactly what you are doing. These commands can erase all your work in one second."}]},{"h":"8. Searching: find, grep and the * wildcard","i":[{"k":"p","t":"**find where -name \"name\"** searches for files in a folder and all its subfolders. The dot `.` means \"here and below\"."},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nfind . -name \"*.csv\""},{"k":"out","t":"./donnees/stations.csv"},{"k":"note","n":"tip","t":"Always put the searched name in double quotes. `-iname` instead of `-name` ignores capital letters: `find . -iname \"*chirps*\"`."},{"k":"p","t":"**grep \"word\" file** displays the lines that contain a word:"},{"k":"cmd","w":"ub","c":"grep \"Dakar\" donnees/stations.csv"},{"k":"out","t":"Dakar,2020,410"},{"k":"table","h":["Variant","Effect"],"r":[["`grep -i \"dakar\" file`","ignores upper and lower case"],["`grep -n \"import\" analyse.py`","also displays the line number"],["`grep -r \"xarray\" scripts/`","searches in all the files of a folder"],["`grep -c \"2020\" file`","counts the number of matching lines"]]},{"k":"p","t":"The **wildcard** `*` stands for \"any characters\":"},{"k":"table","h":["Example","What it refers to"],"r":[["`ls *.csv`","all files ending in .csv"],["`ls chirps_*`","all files starting with chirps_"],["`cp *.png figures/`","copies all PNG images into figures"],["`ls *2020*`","all files whose name contains 2020"]]},{"k":"note","n":"warn","t":"With `rm`, the wildcard is dangerous: `rm *` deletes all the files in the folder. Check first with `ls *.png`, and only then `rm -i *.png`."}]},{"h":"9. Chaining commands: &&, |, >, >>","i":[{"k":"table","h":["Sign","Effect","Example"],"r":[["`&&`","runs the second command if the first one succeeded","`cd ~/entrainement && ls`"],["`|`","sends the result of the first command to the second one (\"pipe\")","`ls donnees | wc -l`"],["`>`","writes the result to a file (replaces)","`ls -l > liste.txt`"],["`>>`","adds the result at the end of a file","`date >> journal.txt`"]]},{"k":"p","t":"Find a previously typed command that contained the word \"conda\":"},{"k":"cmd","w":"ub","c":"history | grep conda"},{"k":"note","n":"tip","t":"On a French AZERTY keyboard, the `|` sign is typed with **Alt Gr + 6** and the `~` sign with **Alt Gr + 2** then Space. On a US QWERTY keyboard: Shift + \\ for `|`, and Shift + the key to the left of 1 for `~`."}]},{"h":"10. Disk space and file sizes","i":[{"k":"table","h":["Command","What it shows"],"r":[["`df -h ~`","the free space on the disk where Ubuntu is located (Avail column = available)"],["`du -sh <folder>`","the total size of a folder"],["`du -sh *`","the size of each item in the current folder"],["`free -h`","the memory (RAM) used and available"]]},{"k":"cmd","w":"ub","c":"du -sh ~/entrainement"},{"k":"out","t":"24K   /home/aminata/entrainement"},{"k":"note","n":"tip","t":"The `-h` option (\"human\") displays sizes in K, M or G, which are easier to read."}]},{"h":"11. Downloading and extracting: wget, unzip, tar","i":[{"k":"p","t":"**wget address** downloads a file into the folder you are in. `-c` resumes an interrupted download."},{"k":"cmd","w":"ub","c":"cd ~/entrainement/donnees\nwget -c https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"},{"k":"out","t":"ne_110m_admin_0_countries.zip 100%[==========>] 210K --.-KB/s in 0.3s\n... 'ne_110m_admin_0_countries.zip' saved"},{"k":"note","n":"warn","t":"The address must be typed on a single line, with no space inside. A broken address gives the error `404 Not Found`."},{"k":"table","h":["Archive type","Command"],"r":[[".zip","`unzip file.zip` (or `unzip file.zip -d target_folder`)"],[".tar.gz or .tgz","`tar -xzf file.tar.gz`"],[".gz (a single file)","`gunzip file.nc.gz`"],["create a .zip","`zip -r archive.zip folder/`"]]},{"k":"cmd","w":"ub","c":"unzip ne_110m_admin_0_countries.zip -d pays\nls pays"},{"k":"out","t":"ne_110m_admin_0_countries.dbf  ne_110m_admin_0_countries.shp  ..."},{"k":"p","t":"You have just downloaded and extracted a real shapefile of the countries of the world, which you will use later with Python."}]},{"h":"12. Installing Ubuntu software: sudo and apt","i":[{"k":"p","t":"`sudo` means \"do it as administrator\". Ubuntu then asks for your Linux password (nothing is displayed while you type: this is normal). `apt` is Ubuntu's software store."},{"k":"table","h":["Command","Effect"],"r":[["`sudo apt update`","updates the list of available software"],["`sudo apt upgrade -y`","installs the updates"],["`sudo apt install -y <software>`","installs a piece of software, for example `sudo apt install -y tree`"],["`sudo apt remove <software>`","uninstalls a piece of software"],["`apt search <word>`","searches for software (without sudo)"]]},{"k":"cmd","w":"ub","c":"sudo apt update && sudo apt upgrade -y"},{"k":"note","n":"warn","t":"`sudo` is only for `apt` and system files. Never put `sudo` in front of `conda`, `pip`, `python`, `cd`, `ls` or `rm` in your own folders."},{"k":"note","n":"tip","t":"The `-y` option automatically answers \"yes\" to the question \"Do you want to continue? [Y/n]\"."}]},{"h":"13. Running a script: bash and python3","i":[{"k":"table","h":["File type","Command","Example"],"r":[["bash script .sh","`bash <file>`","`bash installer.sh`"],["Python script .py","`python3 <file>`","`python3 analyse.py`"]]},{"k":"cmd","w":"ub","c":"cd ~/entrainement\nnano scripts/bonjour.py"},{"k":"p","t":"Write this line in nano, save (Ctrl + O, Enter) and quit (Ctrl + X):"},{"k":"cmd","w":"nano","c":"print(\"Bonjour, mon premier script Python fonctionne\")"},{"k":"cmd","w":"ub","c":"python3 scripts/bonjour.py"},{"k":"out","t":"Bonjour, mon premier script Python fonctionne"},{"k":"note","n":"tip","t":"To run a script with `./script.sh` (without bash in front), you must first make it executable: `chmod +x script.sh`. In this course, the simplest way remains `bash script.sh`."},{"k":"note","n":"warn","t":"Before tutorial 05, you must type `python3`. Once the geoenv environment is activated, both `python` and `python3` work."}]},{"h":"14. Monitoring and stopping a program","i":[{"k":"table","h":["Command or key","Effect"],"r":[["Ctrl + C","stop the running program (remember this first)"],["`htop`","see the running programs, the processor and the memory; q to quit"],["`free -h`","see the available memory"],["Ctrl + Z","pauses the program (it does not stop it)"],["`fg`","resume a program paused with Ctrl + Z"]]},{"k":"note","n":"warn","t":"If the terminal displays `[1]+ Stopped`, you pressed Ctrl + Z. Type `fg` to resume, then Ctrl + C to stop."}]},{"h":"15. Finding help and making life easier","i":[{"k":"table","h":["Command","Effect"],"r":[["`<command> --help`","quick help, for example `ls --help`"],["`man <command>`","the full manual; q to quit"],["`history`","the list of commands already typed"],["`clear` (or Ctrl + L)","clear the screen"],["`which <command>`","where the program is located, for example `which python3`"],["`explorer.exe .`","open the current folder in Windows File Explorer"],["`exit` (or Ctrl + D)","close the terminal"]]}]},{"h":"16. Final exercise: do it all again on your own","i":[{"k":"p","t":"Do this exercise **without looking at the previous parts**. Only look at the solution if you are stuck."},{"k":"ol","i":["Go to your home folder and check where you are.","Create the folder `~/exercice` with three subfolders: `entrees`, `resultats`, `archives`.","Enter `~/exercice` and display its folder tree.","With nano, create the file `entrees/pluie.csv` containing a header line `mois,pluie_mm` and three months of your choice.","With echo, add a fourth line at the end of the file.","Display the file, then count its lines.","Copy `pluie.csv` into `archives` under the name `pluie_copie.csv`.","Rename `entrees/pluie.csv` to `entrees/pluie_2026.csv`.","Search for all the .csv files in the `~/exercice` folder.","Delete `archives/pluie_copie.csv` with confirmation, then the empty `archives` folder.","Open `~/exercice` in Windows File Explorer."]},{"k":"solution","c":"# 1\ncd ~\npwd\n# 2\nmkdir -p ~/exercice/entrees ~/exercice/resultats ~/exercice/archives\n# 3\ncd ~/exercice\ntree\n# 4 (write the lines, then Ctrl + O, Enter, Ctrl + X)\nnano entrees/pluie.csv\n# 5\necho \"septembre,210\" >> entrees/pluie.csv\n# 6\ncat entrees/pluie.csv\nwc -l entrees/pluie.csv\n# 7\ncp entrees/pluie.csv archives/pluie_copie.csv\n# 8\nmv entrees/pluie.csv entrees/pluie_2026.csv\n# 9\nfind . -name \"*.csv\"\n# 10\nrm -i archives/pluie_copie.csv\nrmdir archives\n# 11\nexplorer.exe ."},{"k":"note","n":"ok","t":"`tree` shows `entrees` (with `pluie_2026.csv`) and `resultats`, `find` finds `./entrees/pluie_2026.csv`, and Windows File Explorer opens on the exercice folder."}]},{"h":"17. The most frequent errors","i":[{"k":"table","h":["Message displayed","What it means","What to do"],"r":[["No such file or directory","file or folder not found","`pwd` then `ls`; check the spelling and capital letters; use Tab (P3.1)"],["command not found","unknown command","typo, or software not installed: `sudo apt install -y <software>`"],["Permission denied","access refused","work in your own folders; close the file if it is open in Excel or Word; run a script with bash (P3.2)"],["Is a directory","the command expects a file, not a folder","to copy a folder: `cp -r`; to delete it: `rm -r`"],["Directory not empty","rmdir refuses a folder that contains files","check its contents with `ls`, then `rm -r` if you are sure"],["File exists","the folder or file already exists","choose another name, or use `mkdir -p`"],["The prompt becomes >","a quotation mark was not closed","Ctrl + C, then retype the command (P3.9)"],["[1]+ Stopped","program paused with Ctrl + Z","`fg`, then Ctrl + C (P3.8)"],["Screen full of strange characters","cat on a non-text file","Ctrl + C then `reset`"],["sudo: ... incorrect password","wrong Linux password","check Caps Lock; nothing is displayed while typing, this is normal (P2.2)"],["Unable to locate package","software not found","`sudo apt update` then try again (P2.10)"]]}]}],"check":["I can read the prompt and I never type it.","I know where I am (`pwd`) and what is in a folder (`ls`, `ls -lh`).","I can move around with `cd`, `cd ..`, `cd ~` and a full path.","I can create a folder (`mkdir -p`) and a file (`touch`, `nano`).","I can save and quit nano (Ctrl + O, Enter, Ctrl + X).","I can read a file (`cat`, `head`, `less` with q to quit).","I can copy (`cp`), move and rename (`mv`).","I always delete carefully: `pwd`, `ls`, then `rm -i`.","I can search for a file (`find`) and a word (`grep`).","I can install software with `sudo apt install` and I never put sudo in front of conda.","I completed the final exercise of part 16."],"faq":[],"ver":"Version 2.0 - October 2026","part":"install"},{"num":"04","title":"Creating your own command shortcuts (aliases)","sub":"Replace long commands with one- or two-letter shortcuts, permanently and without errors.","obj":"Install the course aliases in the ~/.bashrc file and know how to use, modify and repair them.","dur":"15 minutes.","pre":"tutorial 02 and tutorial 03 completed; know your <WindowsName> (tutorial 03, step 1).","ou":"Ubuntu (WSL terminal).","fin":"Permanent shortcuts: m (Windows folder), ll, p, geo, j, ex, maj...","blocks":[{"h":"1. What is an alias?","i":[{"k":"p","t":"An **alias** is a nickname given to a command. For example, `m` can replace `cd /mnt/c/Users/Aminata`. Try it:"},{"k":"cmd","w":"ub","c":"alias bonjour='echo Bonjour, le terminal fonctionne'\nbonjour"},{"k":"p","t":"This alias disappears as soon as you close the terminal. For an alias to be **permanent**, it must be written in the `~/.bashrc` file, which Ubuntu reads automatically every time the terminal opens."},{"k":"p","t":"In this course, the Windows folder is saved only once in a variable named **WIN** (for example `WIN=\"/mnt/c/Users/Aminata\"`). The aliases then use `$WIN`: they therefore work on every PC, whatever the Windows name."},{"k":"note","n":"warn","t":"Older versions of the tutorials used `/mnt/c/Users/User`, which is the Windows name on the author's PC. On your PC, this path probably does not exist: this is the most frequent cause of the \"No such file or directory\" error with the m alias."}]},{"h":"2. The course aliases","i":[{"k":"table","h":["Alias","Actual command","Use"],"r":[["m, M, myhome","`cd \"$WIN\"`","go to your Windows folder"],["docs, dl","`cd \"$WIN/Documents\"`, `cd \"$WIN/Downloads\"`","go to Documents, Downloads"],["ll, la, lt","`ls -lh`, `ls -lha`, `ls -lrt`","detailed list, with hidden files, by date"],["p, P","`python3`","`p analyse.py`"],["geo","`conda activate geoenv`","activate the environment (after tutorial 05)"],["j, J, jl","`jupyter notebook/lab --no-browser`","start Jupyter (after tutorial 06)"],["k, g, n","`kate`, `gedit`, `nano`","`g analyse.py &`"],["d","`display`","display an image: `d carte.png &`"],["voir, ex","`explorer.exe`, `explorer.exe .`","open a file or the current folder in Windows"],["maj","`sudo apt update && sudo apt upgrade -y`","update Ubuntu"]]}]},{"h":"Step 1 - Choose a method","i":[{"k":"table","h":["Method","For whom","Risk of error"],"r":[["A. Automatic script (recommended)","Everyone, especially beginners","Very low"],["B. Copy and paste into the terminal","If you do not have the script file","Medium (copying and pasting from a PDF)"],["C. Text editor (nano, gedit, kate)","To understand or customize","Medium"]]},{"k":"note","n":"warn","t":"Use **only one** method. All three give the same result."}]},{"h":"Step 2A - Method A: automatic script","i":[{"k":"p","t":"Copy the file `outil_04_installer_alias.sh` into your Windows Downloads folder, then:"},{"k":"cmd","w":"ub","c":"bash /mnt/c/Users/<WindowsName>/Downloads/outil_04_installer_alias.sh"},{"k":"p","t":"The script detects your Windows folder (or asks you for it), backs up `~/.bashrc`, removes any old course alias block and adds the new one. It can be run again without creating duplicates."},{"k":"out","t":"1/4 - Recherche de votre dossier Windows...\n      Dossier Windows : /mnt/c/Users/Aminata\n2/4 - Sauvegarde de ~/.bashrc...\n3/4 - Suppression d'un éventuel ancien bloc d'alias du cours...\n4/4 - Ajout des alias...\nTerminé. Pour activer les alias maintenant, tapez :\n   source ~/.bashrc"},{"k":"p","t":"Go directly to step 3."},{"k":"note","n":"fail","t":"\"No such file or directory\" for the script: check its location with `ls /mnt/c/Users/<WindowsName>/Downloads/`. If the browser renamed it (for example `outil_04_installer_alias(1).sh`), put the name in double quotes."}]},{"h":"Step 2B - Method B: copy and paste into the terminal","i":[{"k":"p","t":"1. Back up the current file:"},{"k":"cmd","w":"ub","c":"cp ~/.bashrc ~/.bashrc.sauvegarde"},{"k":"p","t":"2. Detect your Windows folder and check the result:"},{"k":"cmd","w":"ub","c":"WIN=$(wslpath \"$(cd /mnt/c && cmd.exe /c 'echo %USERPROFILE%' | tr -d '\\r')\")\necho \"$WIN\"\nls \"$WIN\""},{"k":"note","n":"ok","t":"`echo` displays for example `/mnt/c/Users/Aminata` and `ls` lists Desktop, Documents, Downloads... If echo displays nothing, type instead `WIN=\"/mnt/c/Users/<WindowsName>\"` with your exact name."},{"k":"p","t":"3. Save this folder in `~/.bashrc`:"},{"k":"cmd","w":"ub","c":"echo \"export WIN=\\\"$WIN\\\"\" >> ~/.bashrc"},{"k":"p","t":"4. Add the aliases: copy and paste **the whole block** below in one go, from `cat` up to and including `EOF`, then press Enter:"},{"k":"cmd","w":"ub","c":"cat << 'EOF' >> ~/.bashrc\n# >>> ALIAS DU COURS DIOUF >>>\n# Dossiers\nalias myhome='cd \"$WIN\"'\nalias m='cd \"$WIN\"'\nalias M='cd \"$WIN\"'\nalias docs='cd \"$WIN/Documents\"'\nalias dl='cd \"$WIN/Downloads\"'\n# Listes de fichiers\nalias ls='ls --color=auto'\nalias ll='ls -lh'\nalias la='ls -lha'\nalias lt='ls -lrt'\n# Python, conda et Jupyter\nalias p='python3'\nalias P='python3'\nalias geo='conda activate geoenv'\nalias j='jupyter notebook --no-browser'\nalias J='jupyter notebook --no-browser'\nalias jl='jupyter lab --no-browser'\n# Éditeurs de texte\nalias k='kate'\nalias g='gedit'\nalias n='nano'\n# Images et Explorateur Windows\nalias d='display'\nalias voir='explorer.exe'\nalias ex='explorer.exe .'\n# Mise à jour d'Ubuntu\nalias maj='sudo apt update && sudo apt upgrade -y'\n# <<< ALIAS DU COURS DIOUF <<<\nEOF"},{"k":"note","n":"warn","t":"The final word `EOF` must be alone on its line, with no space before or after it. If the terminal displays `>` and waits, see Problem P4.3. Paste this block **only once** (otherwise, see Problem P4.4)."}]},{"h":"Step 2C - Method C: with a text editor","i":[{"k":"p","t":"1. Back up: `cp ~/.bashrc ~/.bashrc.sauvegarde`"},{"k":"p","t":"2. Open the file. Always write `~/.bashrc` (with `~/`), whatever folder you are in:"},{"k":"cmd","w":"ub","c":"nano ~/.bashrc\n# or, if graphical windows work:\ngedit ~/.bashrc &\nkate ~/.bashrc &"},{"k":"p","t":"3. Go to the end of the file (in nano: Alt + /) and add the following line, replacing `<WindowsName>`:"},{"k":"cmd","w":"file","c":"export WIN=\"/mnt/c/Users/<WindowsName>\""},{"k":"p","t":"4. Below it, add the alias block from method B (the lines between `cat << 'EOF'` and `EOF`, **without these two lines**)."},{"k":"p","t":"5. Save and close: in nano, Ctrl + O then Enter, Ctrl + X; in gedit or kate, Ctrl + S then close the window."}]},{"h":"Step 3 - Activate the aliases","i":[{"k":"cmd","w":"ub","c":"source ~/.bashrc"},{"k":"p","t":"This command rereads `~/.bashrc` without closing the terminal. It is needed only once: new terminals will load the aliases automatically."},{"k":"note","n":"fail","t":"\"syntax error\" or \"unexpected EOF\" error messages: see Problem P4.6."}]},{"h":"Step 4 - Check","i":[{"k":"cmd","w":"ub","c":"echo \"$WIN\"\ntype m\nm\npwd\nll\nex"},{"k":"out","t":"/mnt/c/Users/Aminata\nm is aliased to `cd \"$WIN\"'\n/mnt/c/Users/Aminata\ntotal 0\ndrwxrwxrwx 1 aminata aminata 4.0K Sep 28 10:12 Desktop\n..."},{"k":"note","n":"ok","t":"`m` takes you to your Windows folder, `ll` displays a detailed list, `ex` opens Windows File Explorer at that location."},{"k":"p","t":"Close the terminal, reopen Ubuntu and type `m` then `pwd` again: the alias must still work."}]},{"h":"Modifying, adding or removing an alias","i":[{"k":"ul","i":["See all active aliases: `alias`.","See where they are written: `grep -n \"alias\" ~/.bashrc` (the line number is displayed at the start).","Modify: `nano ~/.bashrc`, correct the line, save, then `source ~/.bashrc`.","Add your own, for example for a project: the simplest way is to write it with nano, gedit or kate at the end of `~/.bashrc`, then `source ~/.bashrc`.","Disable an alias for the current session: `unalias name`."]},{"k":"cmd","w":"ub","c":"echo \"alias proj='cd \\\"\\$WIN/Documents/cours_climat\\\"'\" >> ~/.bashrc\nsource ~/.bashrc"},{"k":"note","n":"warn","t":"Syntax of an alias: `alias name='command'`, **with no space** around the `=` sign, and with **straight** single quotes."}]}],"check":["`echo \"$WIN\"` displays my real Windows folder.","`m` then `pwd` displays this folder, even after closing and reopening Ubuntu.","`ll` displays a detailed list.","`ex` opens Windows File Explorer.","A backup copy ~/.bashrc.sauvegarde... exists (`ls -a ~`)."],"faq":[{"q":"What is the .bashrc file?","a":"A hidden text file (its name starts with a dot) located in your Linux home folder. Ubuntu runs it every time a terminal opens. It holds the aliases, variables such as WIN and, later, the conda initialization."},{"q":"Why can't I see .bashrc with ls?","a":"Files whose name starts with a dot are hidden. Use `ls -a ~` or the `la` alias."},{"q":"Can I open geoenv automatically in every terminal?","a":"Yes, after tutorial 05: `echo \"conda activate geoenv\" >> ~/.bashrc`. This is optional."},{"q":"Will my aliases work in a Python or bash script?","a":"No. Aliases only work in the interactive terminal. In a script, write the full commands (for example `python3`, not `p`)."}],"ver":"Version 2.0 - September 2026","part":"install"},{"num":"05","title":"Install Miniconda and create the geoenv environment","sub":"Install the conda package manager, configure it to use the conda-forge channel and create the Python environment \"geoenv\" dedicated to climate and geographic data.","obj":"Have Python 3.11 and the scientific core (xarray, geopandas, rioxarray, regionmask, cartopy, CDO...) in an isolated environment.","dur":"30 to 45 minutes (including 10 to 20 minutes of download).","pre":"Tutorials 02 to 04 completed; about 10 GB of free space; good Internet connection (about 2 GB to download).","ou":"Ubuntu (WSL terminal). Never in PowerShell, never with sudo.","fin":"The prompt (geoenv) name@PC:~$ and an import test that prints \"OK\".","blocks":[{"h":"1. Vocabulary","i":[{"k":"table","h":["Term","Meaning"],"r":[["conda","manager that installs Python and libraries, including their compiled components (GDAL, PROJ, NetCDF, ESMF)"],["Miniconda","minimal conda installer (used in this path); Miniforge is an equivalent alternative (Problem P5.4)"],["environment","isolated folder containing one version of Python and its libraries; you can have several without conflict"],["base","the default conda environment: install nothing in it"],["geoenv","the course environment"],["conda-forge","the community \"channel\" (repository) that provides the most complete and up-to-date scientific packages"]]},{"k":"p","t":"**The 4 golden rules of conda**"},{"k":"ol","i":["**Never use `sudo`** in front of conda or pip.","**Always activate geoenv** (`conda activate geoenv`) before installing or running anything.","**Prefer `conda install -c conda-forge`** to `pip install`. Use pip only if the package does not exist on conda-forge, and always after the conda installations.","**Install Miniconda in Linux (`~`)**, never in a Windows folder (`/mnt/c/...`)."]}]},{"h":"Step 1 - Preliminary checks","i":[{"k":"cmd","w":"ub","c":"cd ~\nuname -m\ndf -h ~\nconda --version"},{"k":"table","h":["Command","Expected result","Otherwise"],"r":[["`uname -m`","x86_64 (Intel or AMD PC, the most common case)","aarch64: PC with an ARM processor (Snapdragon), use the ARM installer in step 3"],["`df -h ~`","\"Avail\" column greater than 10G","Free up space on C: (P1.12)"],["`conda --version`","\"conda: command not found\" (conda absent: normal)","If a version is displayed, conda is already installed: go to step 6, or clean up first (step 2)"]]}]},{"h":"Step 2 - (Optional) Remove an old installation","i":[{"k":"p","t":"Only if a previous conda installation failed or is in a mess:"},{"k":"cmd","w":"ub","c":"rm -rf ~/miniconda3 ~/.conda ~/.condarc ~/.continuum"},{"k":"note","n":"danger","t":"This command permanently deletes Miniconda and all existing environments. Do not use it if you have environments to keep."},{"k":"p","t":"If opening Ubuntu then shows errors mentioning miniconda3, see Problem P5.12."}]},{"h":"Step 3 - Download the Miniconda installer","i":[{"k":"cmd","w":"ub","c":"# Intel or AMD PC (uname -m = x86_64), the most common case:\nwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh\n# ARM PC only (uname -m = aarch64):\nwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O ~/miniconda.sh"},{"k":"note","n":"warn","t":"The wget command is **a single line**: the address and `-O ~/miniconda.sh` must be on the same line, separated by a space. The O in `-O` is a capital letter, not a zero. Type only **one** of the two commands, the one for your processor."},{"k":"out","t":"miniconda.sh   100%[===================>] 150.00M  5.2MB/s    in 29s\n... '/home/aminata/miniconda.sh' saved"},{"k":"p","t":"Check: `ls -lh ~/miniconda.sh` must show a size of about 150 MB."},{"k":"note","n":"fail","t":"404 Not Found, name resolution failure, certificate error, interrupted download: see Problem P5.3."}]},{"h":"Step 4 - Install Miniconda","i":[{"k":"p","t":"**Recommended method** (automatic, no questions):"},{"k":"cmd","w":"ub","c":"bash ~/miniconda.sh -b -p ~/miniconda3\n~/miniconda3/bin/conda init bash"},{"k":"p","t":"The `-b` option accepts the license and installs without questions; `-p ~/miniconda3` sets the installation folder. `conda init bash` adds conda to your `~/.bashrc`."},{"k":"out","t":"PREFIX=/home/aminata/miniconda3\n...\ninstallation finished.\n...\nmodified      /home/aminata/.bashrc\n==> For changes to take effect, close and re-open your current shell. <=="},{"k":"p","t":"**Interactive method (alternative)**: `bash ~/miniconda.sh`, then answer as follows:"},{"k":"table","h":["Question displayed","Answer"],"r":[["\"Please, press ENTER to continue\"","Enter"],["License text (\"--More--\")","Space bar several times, or q to jump to the end"],["\"Do you accept the license terms? [yes|no]\"","type **yes** in full, then Enter"],["\"Miniconda3 will now be installed into this location: /home/.../miniconda3\"","Enter (keep the proposed folder)"],["\"Do you wish to update your shell profile to automatically initialize conda?\"","type **yes**, then Enter"]]},{"k":"note","n":"warn","t":"At the license question, `y` is not enough: you must type `yes`. If you answered no to the initialization, type `~/miniconda3/bin/conda init bash`."}]},{"h":"Step 5 - Activate conda and check","i":[{"k":"p","t":"Close and reopen Ubuntu, or type:"},{"k":"cmd","w":"ub","c":"source ~/.bashrc\nconda --version"},{"k":"note","n":"ok","t":"The prompt now starts with `(base)` and `conda --version` displays a number, for example conda 25.x.x or more recent."},{"k":"note","n":"fail","t":"\"conda: command not found\": see Problem P5.1."},{"k":"p","t":"Delete the installer to free up space: `rm ~/miniconda.sh`."}]},{"h":"Step 6 - Configure the channels (conda-forge only)","i":[{"k":"cmd","w":"ub","c":"conda config --add channels conda-forge\nconda config --set channel_priority strict\nconda config --remove channels defaults\nconda config --show channels"},{"k":"out","t":"channels:\n  - conda-forge"},{"k":"p","t":"These settings make conda-forge the **only** source of packages: this avoids conflicts between channels, the main cause of endless installations. A warning on the third command (\"defaults\" not present) can be ignored."},{"k":"note","n":"fail","t":"Message mentioning \"Terms of Service\" or \"CondaToSNonInteractiveError\" at this step or the following ones: see Problem P5.4."}]},{"h":"Step 7 - Create the geoenv environment","i":[{"k":"p","t":"Three methods lead to the same result. **Choose only one.**"},{"k":"p","t":"**Method A (recommended): a single command.** Installing the whole core at once lets conda find a compatible combination in one go. Type this command on a single line:"},{"k":"cmd","w":"ub","c":"conda create -n geoenv -c conda-forge python=3.11 numpy pandas scipy xarray netcdf4 h5netcdf cftime bottleneck dask shapely pyproj geopandas fiona rasterio rioxarray regionmask cartopy matplotlib seaborn plotly jupyter jupyterlab ipykernel ipywidgets cdo nco openpyxl tqdm pip -y"},{"k":"p","t":"Duration: 5 to 20 minutes. The stages \"Channels\", \"Solving environment\" (up to a few minutes), \"Downloading and Extracting Packages\", then \"Preparing transaction\", \"Verifying transaction\" and \"Executing transaction\" follow one another. **Do not close the window.**"},{"k":"out","t":"Preparing transaction: done\nVerifying transaction: done\nExecuting transaction: done\n#\n# To activate this environment, use\n#\n#     $ conda activate geoenv"},{"k":"p","t":"**Method B: step by step** (the method from the previous version of the course):"},{"k":"cmd","w":"ub","c":"conda create -n geoenv -c conda-forge python=3.11 -y\nconda activate geoenv\nconda install -c conda-forge numpy pandas xarray netcdf4 cftime scipy -y\nconda install -c conda-forge shapely pyproj geopandas fiona rasterio rioxarray -y\nconda install -c conda-forge regionmask cartopy -y\nconda install -c conda-forge matplotlib seaborn plotly jupyter jupyterlab ipykernel -y\nconda install -c conda-forge cdo nco -y"},{"k":"note","n":"warn","t":"The previous version required `numpy=1.26` and `xarray=2024.6.0`. These pinned versions are no longer necessary and can create conflicts with recent libraries. Pin them only if a course script requires it."},{"k":"p","t":"**Method C: from the provided file** (see also tutorial 09):"},{"k":"cmd","w":"ub","c":"conda env create -f /mnt/c/Users/<WindowsName>/Downloads/outil_05_geoenv.yml"},{"k":"note","n":"fail","t":"\"Solving environment\" lasts more than 30 minutes or a \"conflicts\" / \"Unsatisfiable\" message: Problem P5.5. \"CondaHTTPError\": Problem P5.11. \"No space left on device\": Problem P5.8."}]},{"h":"Step 8 - Activate geoenv","i":[{"k":"cmd","w":"ub","c":"conda activate geoenv"},{"k":"note","n":"ok","t":"The prompt becomes `(geoenv) aminata@PC-NAME:~$`."},{"k":"note","n":"warn","t":"Activation only lasts as long as the terminal. Each time you open Ubuntu again, type `conda activate geoenv` (or the `geo` alias from tutorial 04)."}]},{"h":"Step 9 - Check the installation","i":[{"k":"cmd","w":"geo","c":"which python\npython --version\npython -c \"import xarray, geopandas, rioxarray, regionmask, cartopy; print('OK', xarray.__version__, geopandas.__version__)\"\ncdo -V 2>&1 | head -n 1\nncdump 2>&1 | tail -n 1"},{"k":"out","t":"/home/aminata/miniconda3/envs/geoenv/bin/python\nPython 3.11.x\nOK 2025.x.x 1.x.x\nClimate Data Operators version 2.x.x (https://mpimet.mpg.de/cdo)\nnetcdf library version 4.9.x ..."},{"k":"note","n":"ok","t":"The python path contains `envs/geoenv` and the line starts with \"OK\". The exact version numbers may differ."},{"k":"note","n":"fail","t":"`which python` shows /usr/bin/python or nothing: P5.7. \"ModuleNotFoundError\": P5.7. Error mentioning GDAL, PROJ or \"numpy\": P5.13 and P5.14."}]},{"h":"Step 10 - Manage your environments","i":[{"k":"table","h":["Command","Role"],"r":[["`conda activate geoenv`","activate geoenv"],["`conda deactivate`","leave the active environment (back to base)"],["`conda env list`","list the environments (the active one is marked *)"],["`conda list`","list the packages of the active environment"],["`conda list xarray`","version of a specific package"],["`conda env export --from-history > geoenv_sauvegarde.yml`","save the geoenv recipe"],["`conda create -n geoenv2 --clone geoenv`","copy an environment (to test without risk)"],["`conda remove -n geoenv --all`","completely delete geoenv (to be done from base)"],["`conda clean --all -y`","delete unneeded downloaded files (often frees several GB)"]]}]}],"check":["`conda --version` displays a version number.","`conda config --show channels` shows only conda-forge.","`conda env list` shows geoenv.","After `conda activate geoenv`, the prompt starts with (geoenv).","`which python` shows a path containing miniconda3/envs/geoenv.","The import test in step 9 prints \"OK\".","`cdo -V` displays a CDO version."],"faq":[{"q":"Miniconda, Anaconda or Miniforge?","a":"Anaconda installs hundreds of unneeded packages (several GB). Miniconda and Miniforge are minimal; Miniforge is already set to conda-forge. The path works with both, provided you use only conda-forge."},{"q":"Why Python 3.11?","a":"It is a recent and stable version, compatible with all the course libraries, including the most specialized ones (xESMF, ESMF, some machine learning libraries)."},{"q":"I already have Anaconda on Windows. Is it used in Ubuntu?","a":"No. The Windows conda and the Ubuntu conda are completely separate. In Ubuntu, only the Miniconda installed in `~/miniconda3` counts."},{"q":"Can I create other environments?","a":"Yes, one per project if needed: `conda create -n projet_dengue -c conda-forge python=3.11 pandas scikit-learn -y`. They do not interfere with each other."},{"q":"Do I have to type \"-c conda-forge\" every time?","a":"After step 6, it is no longer required, but keeping it does no harm and makes the commands explicit."},{"q":"How do I install the same environment on another PC?","a":"Export the recipe (`conda env export --from-history > geoenv.yml`), copy the file, then run `conda env create -f geoenv.yml` on the other PC."}],"ver":"Version 2.0 - September 2026","part":"python"},{"num":"06","title":"Install the Python packages for climate and data","sub":"The course libraries sorted by level, their role, their installation in geoenv, the automatic check and the use of Jupyter.","obj":"Complete geoenv with the libraries needed for the course, check everything and launch Jupyter.","dur":"20 to 60 minutes depending on the levels installed.","pre":"Tutorial 05 completed (geoenv created and checked).","ou":"Ubuntu, with (geoenv) active: always start with conda activate geoenv (or geo).","fin":"The check script prints \"OK\" for level 1 and level 2, and a test map test_geoenv.png.","blocks":[{"h":"1. Packages organized in three levels","i":[{"k":"table","h":["Level","Content","Should I install it?"],"r":[["1. Mandatory core","read, compute and map climate data","Yes (already installed in tutorial 05)"],["2. Recommended","statistics, machine learning, regridding, interactive maps, dashboards, Excel","Yes, to follow the whole course"],["3. Specialized","OpenStreetMap, kriging, databases, language processing, Earth Engine","Only if your project needs it"]]},{"k":"note","n":"warn","t":"Before any installation: the prompt must start with `(geoenv)`. Otherwise, type `conda activate geoenv`. Installing in `(base)` is a frequent mistake (Problem P6.3)."}]},{"h":"2. Level 1: mandatory core (already installed)","i":[{"k":"pkgs","lvl":1}]},{"h":"Step 1 - Install level 2 (recommended)","i":[{"k":"cmd","w":"geo","c":"conda install -c conda-forge seaborn statsmodels scikit-learn bottleneck dask zarr h5netcdf fsspec xesmf rasterstats fiona pyshp contextily plotly folium branca dash streamlit streamlit-folium openpyxl xlrd tabulate tqdm jupyterlab ipywidgets nbformat pillow imageio -y"},{"k":"p","t":"Command on a single line. Duration: 5 to 20 minutes. Packages already installed in tutorial 05 are simply kept."},{"k":"note","n":"fail","t":"\"PackagesNotFoundError\": P6.1. Endless solving or conflict: P6.2 (then install in small groups)."},{"k":"pkgs","lvl":2}]},{"h":"4. Level 3: specialized (according to your needs)","i":[{"k":"p","t":"Install each group **separately**, only if necessary. This way, a problematic package does not block the others."},{"k":"pkgs","lvl":3},{"k":"p","t":"**Obsolete packages from the old list**"},{"k":"table","h":["Old package","Status","Use instead"],"r":[["pandas-profiling","renamed","ydata-profiling"],["xlwt, xlutils","abandoned (old .xls format)","openpyxl and the .xlsx format"],["psycopg2-binary","pip-specific name","psycopg2 with conda"]]}]},{"h":"Step 2 - Run the check script","i":[{"k":"p","t":"Go to the course folder (created in tutorial 03), then run the provided script:"},{"k":"cmd","w":"geo","c":"cd \"$WIN/Documents/cours_climat\"\npython /mnt/c/Users/<WindowsName>/Downloads/outil_06_verifier_geoenv.py"},{"k":"out","t":"Python : 3.11.x (/home/aminata/miniconda3/envs/geoenv/bin/python)\n=== Niveau 1 - Socle obligatoire ===\n  OK         numpy 2.x.x\n  OK         xarray 2025.x.x\n  ...\n=== Niveau 3 - Spécialisé (facultatif) ===\n  MANQUANT   pykrige (No module named 'pykrige')\n...\n=== Test pratique : NetCDF + carte ===\n  OK  fichier test_geoenv.nc écrit et relu ((21, 27))\n  OK  figure test_geoenv.png créée dans : /mnt/c/Users/Aminata/Documents/cours_climat\n=== Bilan ===\nNiveau 3 - Spécialisé (facultatif) : 16 manquant(s)\n  conda install -c conda-forge pykrige osmnx ... -y"},{"k":"note","n":"ok","t":"Everything is \"OK\" for levels 1 and 2, and the figure is created. The lines marked \"MANQUANT\" (missing) for level 3 are normal if you have not installed it. The \"Bilan\" (summary) section gives the exact command to install what is missing."},{"k":"p","t":"Open the test map:"},{"k":"cmd","w":"geo","c":"explorer.exe test_geoenv.png"},{"k":"note","n":"tip","t":"On the first plot, cartopy downloads the coastlines and borders (Natural Earth): this requires Internet and a few extra seconds. After that, they are kept on disk."}]},{"h":"Step 3 - Register geoenv as a Jupyter kernel","i":[{"k":"cmd","w":"geo","c":"python -m ipykernel install --user --name geoenv --display-name \"Python (geoenv)\""},{"k":"p","t":"This way, the \"Python (geoenv)\" kernel is always offered in Jupyter, even when Jupyter is launched from another environment."}]},{"h":"Step 4 - Launch Jupyter Lab or Jupyter Notebook","i":[{"k":"cmd","w":"geo","c":"cd \"$WIN/Documents/cours_climat\"\njupyter lab --no-browser"},{"k":"p","t":"(or the aliases `jl` and `j`). The terminal displays an address:"},{"k":"out","t":"    To access the server, open this file in a browser:\n        ...\n    Or copy and paste one of these URLs:\n        http://localhost:8888/lab?token=3f2a9c...e71\n        http://127.0.0.1:8888/lab?token=3f2a9c...e71"},{"k":"ul","i":["Hold **Ctrl** and click the address `http://localhost:8888/...`, or copy it (select, then Ctrl + Shift + C) into your Windows browser (Chrome, Edge, Firefox).","In Jupyter, choose the **Python (geoenv)** kernel.","Leave the terminal open while you work: closing it stops Jupyter.","To stop: in the terminal, **Ctrl + C**, then **y** and Enter."]},{"k":"note","n":"fail","t":"Browser does not open, port already in use, password or token requested: P6.4. Module not found in Jupyter but present in the terminal: P6.3."}]},{"h":"(Optional) Work with Visual Studio Code","i":[{"k":"ul","i":["Install Visual Studio Code on Windows (official Microsoft website), then the **WSL** extension (publisher Microsoft) and the **Python** extension.","In Ubuntu, go to your project folder and type `code .`: VS Code opens connected to Ubuntu (the first time, it installs a small server, please wait).","At the bottom right of VS Code (or Ctrl + Shift + P > \"Python: Select Interpreter\"), choose the geoenv interpreter (`~/miniconda3/envs/geoenv/bin/python`)."]}]},{"h":"Rules for installing a new package later","i":[{"k":"ol","i":["`conda activate geoenv`.","Check whether it exists on conda-forge: `conda search -c conda-forge <name>`.","If it exists: `conda install -c conda-forge <name> -y`.","Only otherwise: `python -m pip install <name>` (always `python -m pip`, never `sudo pip`).","If the environment becomes unstable: recreate it (tutorial 05, P5.5). It is quick and carries no risk for your scripts and data."]}]}],"check":["The check script prints \"OK\" for all of level 1.","Level 2 is installed and checked (or I know exactly what is missing and why).","The figure test_geoenv.png opens in Windows.","Jupyter Lab opens in my browser with the \"Python (geoenv)\" kernel.","I know how to stop Jupyter (Ctrl + C then y)."],"faq":[{"q":"Do I have to install all three levels?","a":"No. Levels 1 and 2 to follow the course; level 3 only for a specific need."},{"q":"How much space does geoenv take?","a":"About 3 to 5 GB with levels 1 and 2; more than 7 GB with pytorch and transformers. `conda clean --all -y` frees the installation files."},{"q":"Can I use Spyder?","a":"Yes: `conda install -c conda-forge spyder -y` then `spyder &` (requires graphical display, see P2.8). Visual Studio Code is a lighter alternative."},{"q":"Why \"python\" here and \"python3\" elsewhere?","a":"In geoenv, `python` and `python3` refer to the same Python of the environment. Outside an environment, only `python3` (Ubuntu's) exists. The `p` alias (python3) therefore works in both cases."}],"ver":"Version 2.0 - September 2026","part":"python"},{"num":"07","title":"Command cheat sheet: WSL, Ubuntu, Conda and CDO","sub":"All the useful commands of the path, grouped by use, to keep at hand.","obj":"Find the right command, and where to type it, in a few seconds.","dur":"Reference.","pre":"None.","ou":"<...> is to be replaced by your value; PS = to be typed in PowerShell; all other commands are typed in Ubuntu.","fin":"A sheet to keep at hand.","blocks":[{"h":"All the commands are in the Commands tab","i":[{"k":"p","t":"The **Commands** tab contains the complete cheat sheet, with a search box and filters by use (WSL, files, Windows, apt, editors, conda, CDO/NCO, keyboard, aliases). Each command has a **Copy** button."},{"k":"goto","view":"commandes","label":"Open the complete cheat sheet"}]},{"h":"CDO operators can be chained","i":[{"k":"p","t":"Example: annual rainfall total, then spatial mean over a box around Senegal, in a single command (read from right to left: subset, then sum by year, then average over space):"},{"k":"cmd","w":"geo","c":"cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc pluie_annuelle_senegal.nc"}]},{"h":"Daily work routine","i":[{"k":"cmd","w":"ub","c":"# 1. Open Ubuntu (Start menu), then:\ngeo                                   # activate geoenv\ncd \"$WIN/Documents/cours_climat\"      # go to the project\njl                                    # launch Jupyter Lab, or:\np scripts/mon_analyse.py              # run a script\nex                                    # view the results in Windows"}]}],"check":[],"faq":[],"ver":"Version 2.0 - September 2026","part":"ref"},{"num":"08","title":"General troubleshooting and frequently asked questions","sub":"Troubleshooting method, index of all the errors of the path, backup and reinstallation, performance, and answers to students' questions.","obj":"Know how to diagnose an error on your own and find its solution.","dur":"Reference.","pre":"None.","ou":"PowerShell or Ubuntu depending on the case (indicated for each command).","fin":"The index of all errors and their solutions.","blocks":[{"h":"1. Troubleshooting method in 7 steps","i":[{"k":"table","h":["No.","Action","Detail"],"r":[["1","Read the message","The last lines contain the cause: \"Error\", \"not found\", \"denied\", a 0x8... code"],["2","Locate the problem","In PowerShell or Ubuntu? Is geoenv active (prompt `(geoenv)`)? In which folder (`pwd`)?"],["3","Search the index","**Troubleshooting** tab: find the code (P1.2, P5.4...) and apply the solution."],["4","Restart WSL","Close Ubuntu, run `wsl --shutdown` in PowerShell, reopen Ubuntu. If needed, restart the PC."],["5","Run the same command again","Many failures come from a temporary network outage; conda and `wget -c` resume where they stopped."],["6","Search for the exact message","Copy the error line, in quotes, into a search engine, without your personal folder names."],["7","Ask for help","With the 5 items from tutorial 00, section 7, and the diagnostic below."]]},{"k":"goto","view":"depannage","label":"Open the error index"}]},{"h":"2. Diagnostic: information to include in a request for help","i":[{"k":"cmd","w":"ps","c":"winver\nwsl --version\nwsl -l -v"},{"k":"cmd","w":"ub","c":"lsb_release -a              # Ubuntu version\ndf -h ~                     # free disk space\nfree -h                     # available memory\necho \"$WIN\"                 # Windows folder used by the aliases\nconda info                  # conda configuration\nconda env list              # environments\nconda activate geoenv && which python && python --version"}]},{"h":"3. Back up","i":[{"k":"ul","i":["**Your work** (scripts, data, figures): if it is in your Windows Documents, it is backed up like your other Windows files. If it is in `~`, copy it regularly to Windows: `cp -r ~/projets \"$WIN/Documents/\"`.","**The geoenv recipe**: `conda env export --from-history > \"$WIN/Documents/geoenv_sauvegarde.yml\"`.","**All of Ubuntu** (before a risky operation), in PowerShell:"]},{"k":"cmd","w":"ps","c":"mkdir D:\\Sauvegardes\nwsl --shutdown\nwsl --export Ubuntu D:\\Sauvegardes\\ubuntu_sauvegarde.tar"},{"k":"p","t":"The file can be 5 to 15 GB. Replace D: with a drive or USB stick that has enough space."},{"k":"p","t":"**Restore a full backup**:"},{"k":"cmd","w":"ps","c":"wsl --import UbuntuRestaure C:\\WSL\\UbuntuRestaure D:\\Sauvegardes\\ubuntu_sauvegarde.tar\nwsl -d UbuntuRestaure"},{"k":"p","t":"An imported distribution opens as root: set your default user as in Problem P2.12."}]},{"h":"4. Repair without reinstalling everything","i":[{"k":"table","h":["Broken element","Repair","See"],"r":[["Aliases or ~/.bashrc","restore the copy `~/.bashrc.sauvegarde...` or run `outil_04_installer_alias.sh` again","P4.4, P4.9"],["geoenv environment","delete it and recreate it (10 to 20 minutes); your scripts are not affected","P5.5"],["Whole Miniconda","delete `~/miniconda3`, clean up `~/.bashrc`, reinstall","P5.12, tutorial 05"],["WSL itself","`wsl --update`, then `wsl --shutdown`","P1.5, P1.10"]]},{"k":"p","t":"**Reinstall Ubuntu from scratch (last resort)**"},{"k":"note","n":"danger","t":"`wsl --unregister` permanently erases Ubuntu, your home folder `~`, Miniconda and geoenv. Back up first. Your files located in Windows folders are not affected."},{"k":"cmd","w":"psa","c":"wsl --unregister Ubuntu\nwsl --install -d Ubuntu"},{"k":"p","t":"Then redo tutorials 02 to 06."}]},{"h":"5. Performance and disk space","i":[{"k":"ul","i":["Limit or increase the memory of WSL: file `C:\\Users\\<YourName>\\.wslconfig` (tutorial 06, P6.8), then `wsl --shutdown`.","Free up space: `conda clean --all -y`, `sudo apt autoremove -y && sudo apt clean`, delete the `~/miniconda.sh` installers.","Speed up projects with many files: work in `~` rather than in `/mnt/c` (P3.4).","Shut down WSL when you have finished to give the memory back to Windows: `wsl --shutdown`.","Space freed in Ubuntu is not always returned immediately to Windows. This is normal; the space remains available to Ubuntu."]}]},{"h":"6. I am on a Mac","i":[{"k":"p","t":"Skip tutorials 01 and 02: macOS already has a terminal (Applications > Utilities > Terminal). In tutorial 05, download the macOS installer instead of the Linux one:"},{"k":"cmd","w":"mac","c":"# Apple Silicon Mac (M1, M2, M3...):\ncurl -L -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh\n# Intel Mac:\ncurl -L -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh\nbash ~/miniconda.sh -b -p ~/miniconda3\n~/miniconda3/bin/conda init zsh"},{"k":"p","t":"The Mac terminal uses **zsh**: replace `~/.bashrc` with `~/.zshrc` in tutorial 04 and set WIN to your folder (for example `export WIN=\"$HOME\"`). Tutorials 05 and 06 then apply as they are, without `explorer.exe` (use `open .`)."}]}],"check":[],"faq":[{"q":"I am already on Linux (Ubuntu installed on the PC).","a":"Start at tutorial 02 (step 4), then 03 (the parts about /mnt/c do not concern you), 04 (with `export WIN=\"$HOME\"`), 05 and 06."},{"q":"Can I use Anaconda or Python on Windows instead of WSL?","a":"For simple Python, yes. But CDO, xESMF/ESMF and several course tools do not work on Windows, and the course commands are Linux commands. The path is therefore based on WSL."},{"q":"How much Internet data should I plan for?","a":"About 3 to 5 GB in total: Ubuntu and its updates (1 to 1.5 GB), Miniconda (150 MB), geoenv levels 1 and 2 (1.5 to 3 GB). Do the installation from a well-connected place; `wget -c` and conda resume after an interruption."},{"q":"My PC has only 4 GB of RAM. Is it possible?","a":"Yes, but it is slow. Close the browser and other software during installations, work on subsets of data (region, period) and use dask (P6.8)."},{"q":"Do I have to redo the installation at each session?","a":"No. Once the path is completed, simply follow the daily routine in tutorial 07."},{"q":"Can I damage Windows with Ubuntu?","a":"Not by following the path. The only real risk is deleting Windows files with `rm` under `/mnt/c`: always check with `pwd` and `ls` before deleting."},{"q":"My antivirus reports or blocks something.","a":"WSL, Ubuntu and Miniconda are legitimate software. If a third-party antivirus blocks the installation, disable it temporarily during the installation (P1.10), or add an exception."},{"q":"What is the difference between PowerShell and the Ubuntu terminal?","a":"PowerShell is the Windows terminal; it is only used to manage WSL (`wsl ...`). All the work (files, conda, Python) is done in the Ubuntu terminal."},{"q":"What is sudo?","a":"\"Superuser, do\": runs a command with Linux administrator rights. It is used for `apt` and system files. Never with conda or pip."},{"q":"Why does nothing appear when I type my password?","a":"This is a normal protection. Type it, then press Enter."},{"q":"How do I use Windows Terminal with several tabs?","a":"Install \"Windows Terminal\" from the Microsoft Store (already present on Windows 11). The ˅ button opens an Ubuntu or PowerShell tab. You can choose Ubuntu as the default profile in its Settings."},{"q":"How do I completely uninstall WSL and Ubuntu?","a":"Back up your work, then in PowerShell: `wsl --unregister Ubuntu`. Then uninstall \"Ubuntu\" and \"Windows Subsystem for Linux\" in Settings > Apps."},{"q":"Why do I have to activate geoenv every time?","a":"Each terminal starts in (base). Activation tells the system which Python and which libraries to use. To automate it: `echo \"conda activate geoenv\" >> ~/.bashrc`."},{"q":"I installed a package with pip by mistake. Is it serious?","a":"Not necessarily. In case of errors (P5.13, P5.14), uninstall it with `pip uninstall <name>` and reinstall it with conda. As a last resort, recreate geoenv."},{"q":"My script works in the terminal but not in Jupyter (or the other way round).","a":"The two do not use the same Python. See P6.3: choose the \"Python (geoenv)\" kernel."},{"q":"How do I share my environment with a colleague?","a":"Send the exported .yml file (tutorial 05, step 10); they recreate it with `conda env create -f fichier.yml`."},{"q":"The versions of my packages differ from those in the tutorial. Is that a problem?","a":"No. Version numbers change over time; the tutorials show examples. Only the \"OK\" of the checks matters."},{"q":"Where can I find help on a Python function?","a":"In Python or Jupyter: `help(xr.open_dataset)`, or `xr.open_dataset?` in Jupyter. The official documentation of each library contains many examples."}],"ver":"Version 2.0 - September 2026","part":"ref"},{"num":"09","title":"How to use the three course tools","sub":"How to run the files outil_04 (.sh), outil_05 (.yml) and outil_06 (.py), explained step by step with a concrete example.","obj":"Know how to run the three tool files, in the right order, without opening them or copying their content.","dur":"About 30 minutes in total (including 10 to 20 minutes of automatic installation for tool 05).","pre":"Tutorials 00 to 03 completed: Ubuntu installed and up to date.","ou":"Ubuntu (WSL terminal) only. Never in PowerShell, never by double-clicking in Windows.","fin":"The shortcuts installed, the geoenv environment created and checked, the test map displayed.","blocks":[{"h":"All the instructions are in the Tools guide tab","i":[{"k":"p","t":"A **tool file** is a list of commands written in advance. You do not open it and you do not copy its content: you ask Ubuntu to run it by typing a word in front of its name. It is like a recipe given to a cook: you do not read the recipe aloud line by line, you hand it over and the cook carries it out."},{"k":"goto","view":"outils","label":"Open the tools guide"}]}],"check":["`m` then `pwd` shows my Windows folder.","`conda env list` shows geoenv.","Tool 06 prints \"OK\" for all of level 1.","The map test_geoenv.png opens in Windows."],"faq":[],"ver":"Version 2.0 - September 2026","part":"python"}],"problems":[{"code":"P1A.1","tuto":"01A","title":"The BIOS asks for a password","see":["An \"Enter Password\" or \"Supervisor Password\" box appears when you enter the BIOS."],"why":"The owner of the PC (often the university, the company or the seller) has protected the BIOS.","fix":[{"k":"p","t":"Do not try to guess the password (the PC may lock itself). Ask the owner or the IT department for it. Otherwise, use another PC."}]},{"code":"P1A.2","tuto":"01A","title":"Cannot enter the BIOS with the key","see":["Windows starts normally even though you press F2, F1, F10..."],"why":"Windows fast startup is too quick to leave you time to press the key, or the F key requires the Fn key.","fix":[{"k":"ul","i":["Use **method A** (from Windows): it does not depend on any key.","Try **Fn + F2** (or Fn + the indicated key): on many laptops, the F keys control volume or brightness first.","Do a real **restart** (Start > Power > Restart, not \"Shut down\") and start pressing as soon as the screen goes black.","Lenovo IdeaPad: use the **Novo button**."]}]},{"code":"P1A.3","tuto":"01A","title":"Virtualization option missing or greyed out","see":["No \"Virtualization\", \"VT-x\" or \"SVM\" option in the menus, or it cannot be changed."],"why":"The option is in another menu, the BIOS is too old, it is locked by an administrator password, or the processor does not support it (very rare on PCs less than 10 years old).","fix":[{"k":"ul","i":["Go through **all** the tabs: Advanced, Configuration, Security, System Configuration, CPU Configuration, Chipset.","Asus: switch to advanced mode with **F7**.","Update the BIOS with the manufacturer's tool, from Windows: Lenovo Vantage, HP Support Assistant, Dell SupportAssist or MyASUS. **Never cut the power during a BIOS update.**","If the option is greyed out, see P1A.1 (BIOS administrator password)."]}]},{"code":"P1A.4","tuto":"01A","title":"Still \"Disabled\" after the change","see":["The \"Virtualization\" line still shows \"Disabled\" after the restart."],"why":"The change was not saved (exit without F10), or the wrong option was changed.","fix":[{"k":"p","t":"Go back into the BIOS, check that the option is set to **Enabled**, then always exit with **F10 > Yes** (or Save Changes and Exit). Shut the PC down completely and turn it back on if needed."}]},{"code":"P1A.5","tuto":"01A","title":"Windows asks for a BitLocker recovery key","see":["Blue screen \"BitLocker recovery: Enter the recovery key for this drive\"."],"why":"The disk is encrypted by BitLocker, which is suspicious of BIOS changes.","fix":[{"k":"p","t":"The key is a 48-digit code. It is stored in your Microsoft account: from a phone, open **aka.ms/myrecoverykey**, sign in with the PC's Microsoft account and copy the key that matches the ID shown on the screen."},{"k":"p","t":"**Prevention** (before entering the BIOS): in File Explorer, right-click C:; if \"Manage BitLocker\" shows that BitLocker is on, write down the key with **Back up your recovery key**, or choose **Suspend protection** until the next restart."}]},{"code":"P1A.6","tuto":"01A","title":"Windows no longer starts after going into the BIOS","see":["Black screen, \"No bootable device\" message, or restart loop."],"why":"An option other than virtualization was changed by mistake (boot mode, disk).","fix":[{"k":"p","t":"Go back into the BIOS, set the changed options back to their original values, save with F10. Do not use \"Load Defaults\" without help: it may change other settings. Ask the teacher or the IT department for help."}]},{"code":"P1A.7","tuto":"01A","title":"The keyboard types the wrong letters in the BIOS","see":["When you type y for \"Yes\", another character appears."],"why":"The BIOS uses an English (QWERTY) keyboard layout: on a French (AZERTY) keyboard, some letters are swapped (A/Q, Z/W).","fix":[{"k":"p","t":"Use the **arrow keys** and **Enter** to choose \"Yes\" instead of typing letters."}]},{"code":"P1.1","tuto":"01","title":"Windows too old or \"wsl\" not recognized","see":["\"wsl : The term 'wsl' is not recognized as the name of a cmdlet...\"","or `wsl --install` only shows the list of options, without installing."],"why":"Your Windows 10 is older than version 2004: the `wsl --install` command does not exist yet.","fix":[{"k":"ol","i":["Open Settings > Windows Update > Check for updates and install everything, including \"feature updates\". Restart as many times as requested.","Check again with `winver`, then go back to step 4.","If the update is not possible, use the manual method (step 4b); on a very old Windows 10 (1909 or earlier), WSL 2 will not be available: updating Windows is mandatory."]}]},{"code":"P1.2","tuto":"01","title":"Virtualization disabled (error 0x80370102)","see":["\"WslRegisterDistribution failed with error: 0x80370102\"","\"The virtual machine could not be started because a required feature is not installed.\"","\"Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.\""],"why":"Processor virtualization is disabled in the BIOS/UEFI, or the \"Virtual Machine Platform\" component is not enabled.","fix":[{"k":"p","t":"**A. Enable the Windows component** (PowerShell as Administrator), then restart:"},{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"},{"k":"p","t":"**B. Enable virtualization in the BIOS/UEFI** if Task Manager still shows \"Virtualization: Disabled\": follow **tutorial 01A**, which details the method for each brand."},{"k":"p","t":"**C. If virtualization is enabled but the error persists** (an old program has disabled the hypervisor):"},{"k":"cmd","w":"psa","c":"bcdedit /set hypervisorlaunchtype auto"},{"k":"p","t":"Restart, then go back to step 4."},{"k":"note","n":"warn","t":"In the BIOS, do not change any other option. If in doubt, choose \"Exit without saving\" and ask for help."}]},{"code":"P1.3","tuto":"01","title":"No administrator rights","see":["\"Access is denied\", \"The requested operation requires elevation\", or Windows asks for an unknown administrator password."],"why":"You are not an administrator of this PC (university, company or someone else's computer).","fix":[{"k":"p","t":"There is no workaround: ask the IT department to install WSL and Ubuntu (give them this tutorial), or use a personal computer. Tutorials 02 to 06 then no longer need Windows administrator rights."}]},{"code":"P1.4","tuto":"01","title":"Subsystem not enabled (error 0x8007019e)","see":["\"WslRegisterDistribution failed with error: 0x8007019e\"","\"The Windows Subsystem for Linux optional component is not enabled.\""],"why":"The \"Windows Subsystem for Linux\" component is not enabled.","fix":[{"k":"cmd","w":"psa","c":"dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart"},{"k":"p","t":"Restart the computer, then start Ubuntu again from the Start menu."}]},{"code":"P1.5","tuto":"01","title":"Kernel update required (error 0x800701bc)","see":["\"WslRegisterDistribution failed with error: 0x800701bc\"","\"WSL 2 requires an update to its kernel component.\""],"why":"The Linux kernel used by WSL 2 is missing or too old.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown"},{"k":"p","t":"Start Ubuntu again. If `wsl --update` fails because there is no connection, download the kernel update package from **https://aka.ms/wsl2kernel**, install it by double-clicking, then restart."}]},{"code":"P1.6","tuto":"01","title":"Download blocked, very slow or impossible","see":["Errors 0x80072ee7, 0x80072efd, 0x80072f8f, 0x80190001, or stuck at \"Downloading: Ubuntu 0.0%\".","\"Unable to connect to the Microsoft Store\"."],"why":"Unstable connection, university network with a proxy, Microsoft Store blocked, VPN active, or wrong PC date and time (the case of error 0x80072f8f).","fix":[{"k":"ul","i":["Check the date and time: Settings > Time & language > Date & time, turn on \"Set time automatically\", then click \"Sync now\".","Temporarily turn off the VPN.","Bypass the Microsoft Store by downloading directly from the web:"]},{"k":"cmd","w":"psa","c":"wsl --install -d Ubuntu --web-download"},{"k":"ul","i":["Change network if possible (another Wi-Fi, or your phone's hotspot; expect 0.5 to 1 GB of data).","Try again at a less busy time (early morning or evening)."]}]},{"code":"P1.7","tuto":"01","title":"Ubuntu is installed as VERSION 1","see":["`wsl -l -v` shows `Ubuntu  Stopped  1`."],"why":"Ubuntu was installed before WSL 2 was enabled, or the default version stayed at 1.","fix":[{"k":"cmd","w":"psa","c":"wsl --set-default-version 2\nwsl --set-version Ubuntu 2"},{"k":"p","t":"The conversion takes a few minutes. Replace `Ubuntu` with the exact name shown by `wsl -l -v` (for example `Ubuntu-24.04`). If a virtualization error appears, see Problem P1.2."}]},{"code":"P1.8","tuto":"01","title":"No distribution installed","see":["\"Windows Subsystem for Linux has no installed distributions.\"","\"Windows Subsystem for Linux has no installed distributions. Distributions can be installed by visiting the Microsoft Store.\""],"why":"WSL is installed, but Ubuntu is not (interrupted download, for example).","fix":[{"k":"cmd","w":"psa","c":"wsl --list --online\nwsl --install -d Ubuntu"},{"k":"p","t":"The first command lists the available distributions; use exactly the name from the NAME column (for example `Ubuntu` or `Ubuntu-24.04`)."}]},{"code":"P1.9","tuto":"01","title":"\"wsl --version\" does not work","see":["\"Invalid command line option: --version\", or the help text is displayed."],"why":"You are using the old version of WSL built into Windows, not the up-to-date version distributed by Microsoft.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown\nwsl --version"}]},{"code":"P1.10","tuto":"01","title":"The Ubuntu window closes immediately or shows an error code","see":["The window opens and then disappears immediately.","\"The process exited with code 4294967295\" or \"[process exited with code 1]\"."],"why":"WSL is in an inconsistent state, is not up to date, virtualization is disabled, or a third-party antivirus blocks startup.","fix":[{"k":"p","t":"Try the following in order, testing Ubuntu after each point:"},{"k":"cmd","w":"psa","c":"wsl --shutdown\nwsl --update"},{"k":"ul","i":["Restart the PC.","Check virtualization (step 2 and Problem P1.2).","Temporarily disable the third-party antivirus (not Microsoft Defender) and try again.","As a last resort, **only if Ubuntu has just been installed and contains no files**, remove and reinstall Ubuntu:"]},{"k":"cmd","w":"psa","c":"wsl --unregister Ubuntu\nwsl --install -d Ubuntu"},{"k":"note","n":"danger","t":"`wsl --unregister` permanently erases Ubuntu and all the files it contains (home folder, conda environments). Never use it on an installation that contains work that has not been backed up (see tutorial 08)."}]},{"code":"P1.11","tuto":"01","title":"Ubuntu installed on a disk other than C: (error 0x80070003)","see":["\"WslRegisterDistribution failed with error: 0x80070003\" or \"The system cannot find the path specified\"."],"why":"WSL only works if the distribution is installed on the system disk (C:). Windows is set to install new apps on another disk (D:, E:...).","fix":[{"k":"ul","i":["Open Settings > System > Storage > Advanced storage settings > Where new content is saved.","Set \"New apps will save to\" to **C:**.","Uninstall the Ubuntu app (Settings > Apps), then go back to step 4."]}]},{"code":"P1.12","tuto":"01","title":"Not enough disk space","see":["\"There is not enough space on the disk\", error 0x80070070, or installation fails without a clear message."],"why":"Less than 15 GB free on C:.","fix":[{"k":"ul","i":["Free up space: empty the Recycle Bin and the Downloads folder, uninstall programs you do not need.","Use the Disk Cleanup tool (Start menu > \"Disk Cleanup\" > \"Clean up system files\").","Aim for at least 15 GB free (30 GB recommended), then go back to step 4."]}]},{"code":"P2.1","tuto":"02","title":"Username rejected","see":["\"adduser: Please enter a username matching the regular expression configured via the NAME_REGEX configuration variable.\""],"why":"The name contains a capital letter, a space or an accent, or starts with a digit.","fix":[{"k":"p","t":"Ubuntu asks the question again: type a name in lowercase, without spaces or accents, for example `aminata`."}]},{"code":"P2.2","tuto":"02","title":"Password: typing error or forgotten password","see":["\"Sorry, passwords do not match\", \"Sorry, try again\" or \"sudo: 3 incorrect password attempts\"."],"why":"The two entries are different, or the password has been forgotten. Watch the keyboard: check the Caps Lock key.","fix":[{"k":"p","t":"**Reset a forgotten password**: close Ubuntu, then in PowerShell:"},{"k":"cmd","w":"ps","c":"wsl -u root"},{"k":"p","t":"You are now \"root\" (prompt ending with `#`). Type the following, replacing with your Linux name:"},{"k":"cmd","w":"root","c":"passwd <your_linux_name>\nexit"},{"k":"p","t":"Forgot your Linux name? In the root session, `ls /home` shows it."}]},{"code":"P2.3","tuto":"02","title":"Domain name (DNS) problem: Ubuntu cannot reach the Internet","see":["\"Temporary failure resolving 'archive.ubuntu.com'\"","\"Could not resolve host\", \"Failed to fetch ...\""],"why":"Ubuntu cannot translate web addresses into IP addresses. This is common with a VPN, some university Wi-Fi networks or after the PC goes to sleep.","fix":[{"k":"p","t":"**Test**: `ping -c 3 8.8.8.8`. If replies appear, the network works and only DNS is the problem. If you see \"Network is unreachable\", first check the Windows connection."},{"k":"p","t":"**Solution A** (often enough): turn off the VPN, type `wsl --shutdown` in PowerShell, reopen Ubuntu and try again."},{"k":"p","t":"**Solution B** (fixed DNS): in Ubuntu, type:"},{"k":"cmd","w":"ub","c":"printf '[network]\\ngenerateResolvConf = false\\n' | sudo tee -a /etc/wsl.conf"},{"k":"p","t":"In PowerShell: `wsl --shutdown`. Reopen Ubuntu, then:"},{"k":"cmd","w":"ub","c":"sudo rm -f /etc/resolv.conf\nprintf 'nameserver 8.8.8.8\\nnameserver 1.1.1.1\\n' | sudo tee /etc/resolv.conf\nsudo apt update"},{"k":"p","t":"**Solution C** (Windows 11, networks with a VPN): in Windows, use Notepad to create the file `C:\\Users\\<YourName>\\.wslconfig` containing the three lines below, save it (Save as type: \\\"All files\\\", without a .txt extension), then run `wsl --shutdown`:"},{"k":"cmd","w":"wslconfig","c":"[wsl2]\nnetworkingMode=mirrored\ndnsTunneling=true"}]},{"code":"P2.4","tuto":"02","title":"apt is locked by another process","see":["\"E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1234 (unattended-upgr)\""],"why":"Another installation (often Ubuntu's automatic update) is running.","fix":[{"k":"ul","i":["Wait 2 to 5 minutes, then try again.","If the message persists: close Ubuntu, type `wsl --shutdown` in PowerShell, reopen Ubuntu and run the command again.","Do not delete the \"lock\" files yourself."]}]},{"code":"P2.5","tuto":"02","title":"Installation interrupted (dpkg)","see":["\"E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.\""],"why":"A previous installation was interrupted (window closed, power cut or network outage).","fix":[{"k":"cmd","w":"ub","c":"sudo dpkg --configure -a\nsudo apt install -f\nsudo apt update && sudo apt upgrade -y"}]},{"code":"P2.6","tuto":"02","title":"Clock out of sync","see":["\"Release file for http://... is not valid yet (invalid for another 5h 12min). Updates for this repository will not be applied.\""],"why":"Ubuntu's clock is out of sync, often after the PC has been asleep.","fix":[{"k":"cmd","w":"ub","c":"sudo hwclock -s\nsudo apt update"},{"k":"p","t":"If the hwclock command does not fix it: `wsl --shutdown` in PowerShell, then check that the Windows time is set automatically."}]},{"code":"P2.7","tuto":"02","title":"University or company network with a proxy","see":["The command stays stuck on \"0% [Connecting to archive.ubuntu.com]\" or fails with \"Connection timed out\"."],"why":"The network requires a proxy server to access the Internet.","fix":[{"k":"p","t":"Ask the IT department for the proxy address and port (for example `http://proxy.univ-labe.edu.gn:3128`, a made-up value), then:"},{"k":"cmd","w":"ub","c":"echo 'Acquire::http::Proxy \"http://<proxy_address>:<port>\";' | sudo tee /etc/apt/apt.conf.d/95proxy\necho 'Acquire::https::Proxy \"http://<proxy_address>:<port>\";' | sudo tee -a /etc/apt/apt.conf.d/95proxy"},{"k":"p","t":"For wget and conda, also add in the session: `export http_proxy=http://<proxy_address>:<port>` and `export https_proxy=http://<proxy_address>:<port>`. Simpler: do the installation from another network (home, phone hotspot)."}]},{"code":"P2.8","tuto":"02","title":"Graphical applications do not open","see":["\"Gtk-WARNING **: cannot open display: :0\" or \"Error: Can't open display\".","The command runs but no window appears."],"why":"The WSL graphical display (WSLg) is not available: old Windows 10 or WSL not up to date.","fix":[{"k":"cmd","w":"psa","c":"wsl --update\nwsl --shutdown"},{"k":"p","t":"Reopen Ubuntu and try `gedit &` again. If it still does not work, use the alternatives below, which are enough for the whole course:"},{"k":"table","h":["Need","Solution without a Linux display"],"r":[["Edit a file","`nano fichier.py` (Ctrl + O then Enter to save, Ctrl + X to quit)"],["Edit with a Windows editor","`notepad.exe fichier.py`, or Visual Studio Code: `code .` (tutorial 06)"],["View an image","`explorer.exe figure.png` (opens the Windows Photos app)"],["Open the current folder","`explorer.exe .`"]]}]},{"code":"P2.9","tuto":"02","title":"pip refuses to install: \"externally-managed-environment\"","see":["\"error: externally-managed-environment × This environment is externally managed\""],"why":"Ubuntu protects its own Python. This is normal behaviour, not a fault.","fix":[{"k":"p","t":"Do not use the `--break-system-packages` option. Install libraries in the geoenv environment (tutorials 05 and 06), after `conda activate geoenv`."}]},{"code":"P2.10","tuto":"02","title":"Package not found","see":["\"E: Unable to locate package kate\" or \"E: Package '...' has no installation candidate\"."],"why":"The package list has not been updated, there is a typo in the name, or the \"universe\" repository is disabled.","fix":[{"k":"cmd","w":"ub","c":"sudo apt update\nsudo add-apt-repository universe -y\nsudo apt update\nsudo apt install -y kate"}]},{"code":"P2.11","tuto":"02","title":"\"is not in the sudoers file\"","see":["\"aminata is not in the sudoers file. This incident will be reported.\""],"why":"Your Linux account does not have administrator rights (rare: account created by hand).","fix":[{"k":"cmd","w":"ps","c":"wsl -u root"},{"k":"cmd","w":"root","c":"usermod -aG sudo <your_linux_name>\nexit"},{"k":"p","t":"Then `wsl --shutdown` in PowerShell and reopen Ubuntu."}]},{"code":"P2.12","tuto":"02","title":"Ubuntu opens as \"root\" instead of your account","see":["The prompt is `root@PC-NAME:~#` (with #)."],"why":"The default user is not set (first launch interrupted, or restore).","fix":[{"k":"p","t":"If your account does not exist yet, create it: `adduser <your_linux_name>` then `usermod -aG sudo <your_linux_name>`. Then set it as the default:"},{"k":"cmd","w":"root","c":"printf '[user]\\ndefault=<your_linux_name>\\n' >> /etc/wsl.conf\nexit"},{"k":"p","t":"Then `wsl --shutdown` in PowerShell and reopen Ubuntu."}]},{"code":"P2.13","tuto":"02","title":"A \"[Y/n]\" question or a configuration screen blocks the installation","see":["\"Do you want to continue? [Y/n]\" or a coloured screen with choices (\"Configuring ...\")."],"why":"Ubuntu is asking for confirmation.","fix":[{"k":"p","t":"Type **Y** then Enter for a [Y/n] question. On a coloured screen, use **Tab** to move to \"<Ok>\" and press Enter. To avoid the question, add `-y` to the `apt install` command."}]},{"code":"P3.1","tuto":"03","title":"File or folder not found","see":["\"bash: cd: Documents: No such file or directory\"."],"why":"Typo, uppercase/lowercase, unprotected space, or you are not in the folder you think you are in.","fix":[{"k":"ul","i":["Type `pwd` to find out where you are, then `ls` to see what really exists.","Use **Tab** to complete names instead of typing them in full.","If the name contains a space, put the path in quotes."]}]},{"code":"P3.2","tuto":"03","title":"Permission denied","see":["\"Permission denied\" when opening, editing or running a file."],"why":"Protected Windows system folder, file open in a Windows application, or script without execute permission.","fix":[{"k":"ul","i":["Work in your own folders (`/mnt/c/Users/<WindowsName>/...` or `~`), not in `/mnt/c/Windows` or `/mnt/c/Program Files`.","Close the file if it is open in Excel, Word or another Windows application.","For a script: run it with `bash script.sh` or `python3 script.py`, or make it executable with `chmod +x script.sh`.","Do not use `sudo` to get around an error on Windows files."]}]},{"code":"P3.3","tuto":"03","title":"Desktop or Documents empty or not found (OneDrive)","see":["`ls /mnt/c/Users/<WindowsName>/Desktop` shows nothing, even though the Desktop contains files."],"why":"OneDrive \"backs up\" your Desktop and Documents: they are moved into the OneDrive folder.","fix":[{"k":"cmd","w":"ub","c":"ls /mnt/c/Users/<WindowsName>/OneDrive/"},{"k":"p","t":"There you will find Desktop (or Bureau on a French Windows) and Documents. Example: `cd \"/mnt/c/Users/<WindowsName>/OneDrive/Documents\"`."},{"k":"note","n":"warn","t":"OneDrive files that are \"available online only\" (cloud icon) are not really on the disk and cause read errors. In File Explorer: right-click the folder > **Always keep on this device**."}]},{"code":"P3.4","tuto":"03","title":"Everything is very slow in Windows folders","see":["`ls`, `git` or opening many files takes several seconds in `/mnt/c`."],"why":"Accessing Windows files from WSL 2 is slower than accessing Linux files.","fix":[{"k":"p","t":"For large projects (many small files, git repositories), work in `~`:"},{"k":"cmd","w":"ub","c":"mkdir -p ~/projets && cp -r /mnt/c/Users/<WindowsName>/Documents/cours_climat ~/projets/"},{"k":"p","t":"Large single NetCDF files can still be used from `/mnt/c`."}]},{"code":"P3.5","tuto":"03","title":"\"explorer.exe .\" opens the wrong folder or does nothing","see":["File Explorer opens on \"Documents\" instead of the current folder, or nothing happens."],"why":"A temporary communication problem between WSL and Windows.","fix":[{"k":"p","t":"Type `wsl --shutdown` in PowerShell, reopen Ubuntu and try again. Otherwise, type the address `\\\\wsl.localhost\\Ubuntu\\home\\<your_linux_name>` in the File Explorer address bar."}]},{"code":"P3.6","tuto":"03","title":"\"explorer.exe\" or \"cmd.exe\" not found","see":["\"explorer.exe: command not found\"."],"why":"Interoperability with Windows has been disabled in `/etc/wsl.conf`.","fix":[{"k":"cmd","w":"ub","c":"cat /etc/wsl.conf"},{"k":"p","t":"If you see `enabled = false` or `appendWindowsPath = false` under `[interop]`, delete these lines with `sudo nano /etc/wsl.conf`, save, then run `wsl --shutdown` in PowerShell."}]},{"code":"P3.7","tuto":"03","title":"File deleted by mistake","see":["A file or folder has disappeared after `rm` or `rm -r`."],"why":"The terminal does not use the Recycle Bin.","fix":[{"k":"p","t":"Recovery is usually impossible. If the file was under `/mnt/c` and synced by OneDrive or Google Drive, check that service's online recycle bin. **Prevention**: `rm -i`, check with `pwd` and `ls` before deleting, and back up regularly (USB stick, cloud)."}]},{"code":"P3.8","tuto":"03","title":"The terminal shows \"Stopped\" after Ctrl + Z","see":["\"[1]+  Stopped   python3 analyse.py\""],"why":"Ctrl + Z does not mean \"undo\": it suspends the program.","fix":[{"k":"p","t":"Type `fg` to resume the program, then **Ctrl + C** if you want to stop it."}]},{"code":"P3.9","tuto":"03","title":"The terminal shows \">\" and no longer runs anything","see":["Each Enter only shows `>`."],"why":"A double quote or a single quote was not closed: the terminal is waiting for the rest.","fix":[{"k":"p","t":"Press **Ctrl + C** to cancel, then type the command again, checking the quotes. Watch out for typographic apostrophes ‘ ’ copied from a PDF or Word: replace them with the straight apostrophe '."}]},{"code":"P3.10","tuto":"03","title":"Script written in Windows does not run","see":["\"/bin/bash^M: bad interpreter\" or \"$'\\r': command not found\"."],"why":"The file has Windows line endings (CRLF) instead of Linux ones (LF).","fix":[{"k":"cmd","w":"ub","c":"dos2unix mon_script.sh"}]},{"code":"P4.1","tuto":"04","title":"Alias unknown right after adding it","see":["\"m: command not found\"."],"why":"`~/.bashrc` has not been reloaded, or the alias was not written to the file.","fix":[{"k":"cmd","w":"ub","c":"source ~/.bashrc\ngrep -n \"alias m=\" ~/.bashrc"},{"k":"p","t":"If grep shows nothing, the alias is not in the file: redo step 2 (preferably method A)."}]},{"code":"P4.2","tuto":"04","title":"The alias disappears with every new terminal","see":["The alias works, then \"command not found\" after reopening Ubuntu."],"why":"The alias was typed directly in the terminal instead of being saved in `~/.bashrc`, or it was written in another .bashrc file (for example in a Windows folder).","fix":[{"k":"p","t":"Always use the path `~/.bashrc` (with `~/`) and redo step 2. Check with `grep -n \"ALIAS DU COURS\" ~/.bashrc`."}]},{"code":"P4.3","tuto":"04","title":"The terminal shows \">\" after pasting the block","see":["Each Enter shows `>` and nothing finishes."],"why":"The final word `EOF` is missing, contains a space, or was not pasted.","fix":[{"k":"p","t":"Simply type `EOF` then Enter (alone on the line). If nothing changes, press Ctrl + C. Then check the file with `tail -n 40 ~/.bashrc`. If in doubt, restore the backup (P4.4) and use method A."}]},{"code":"P4.4","tuto":"04","title":"Alias block added twice (duplicates)","see":["`grep -c \"ALIAS DU COURS\" ~/.bashrc` shows 4 instead of 2."],"why":"The block was pasted or added several times. This is not serious (the last one wins), but the file becomes confusing.","fix":[{"k":"p","t":"Simple solution: run method A again (the script cleans up the course blocks). Or restore the backup, then start again only once:"},{"k":"cmd","w":"ub","c":"ls -a ~ | grep bashrc\ncp ~/.bashrc.sauvegarde ~/.bashrc\nsource ~/.bashrc"}]},{"code":"P4.5","tuto":"04","title":"\"m\": folder not found","see":["\"bash: cd: /mnt/c/Users/User: No such file or directory\" or \"cd: : No such file or directory\"."],"why":"The WIN variable is empty or contains the wrong Windows name (often `User`, left over from the old version of the course).","fix":[{"k":"cmd","w":"ub","c":"echo \"$WIN\"\nls /mnt/c/Users/\ngrep -n \"WIN=\" ~/.bashrc\ngrep -n \"/mnt/c/Users/User\" ~/.bashrc"},{"k":"p","t":"Open `nano ~/.bashrc`, correct the `export WIN=\"...\"` line with your real name, and delete any remaining old `alias m='cd /mnt/c/Users/User'` lines. Save, then run `source ~/.bashrc`."}]},{"code":"P4.6","tuto":"04","title":"Errors when the terminal opens","see":["\"bash: /home/aminata/.bashrc: line 132: syntax error near unexpected token...\"","\"unexpected EOF while looking for matching `''\"","\"bash: alias: = : not found\" or \"bash: alias: 'python3': not found\"."],"why":"A line in `~/.bashrc` is badly written: spaces around `=`, an unclosed quote, or typographic apostrophes ‘ ’ copied from a PDF.","fix":[{"k":"p","t":"Open the file at the indicated line (here 132):"},{"k":"cmd","w":"ub","c":"nano +132 ~/.bashrc"},{"k":"table","h":["Incorrect","Correct"],"r":[["`alias p = 'python3'`","`alias p='python3'`"],["`alias p=‘python3’` (curly apostrophes)","`alias p='python3'` (straight apostrophes)"],["`alias p='python3`","`alias p='python3'`"]]},{"k":"p","t":"Or restore the backup (P4.4) and use method A."}]},{"code":"P4.7","tuto":"04","title":"The k, g or d aliases do nothing","see":["\"kate: command not found\", \"display: command not found\", or no window."],"why":"The application is not installed, or the graphical display does not work.","fix":[{"k":"cmd","w":"ub","c":"sudo apt install -y gedit eog imagemagick kate"},{"k":"p","t":"If no window appears: tutorial 02, Problem P2.8 (use `n` for nano and `voir image.png` to open the image in Windows)."}]},{"code":"P4.8","tuto":"04","title":"The geo or j aliases do not work","see":["\"conda: command not found\", \"EnvironmentNameNotFound\" or \"jupyter: command not found\"."],"why":"Miniconda, the geoenv environment or Jupyter are not installed yet.","fix":[{"k":"p","t":"This is normal before tutorials 05 (Miniconda, geoenv) and 06 (Jupyter). For `j`, first activate the environment with `geo`."}]},{"code":"P4.9","tuto":"04","title":"Ubuntu no longer starts properly after editing ~/.bashrc","see":["The terminal shows errors in a loop or closes."],"why":"A command placed in `~/.bashrc` fails or blocks startup.","fix":[{"k":"p","t":"Open a terminal without reading `~/.bashrc`, from PowerShell:"},{"k":"cmd","w":"ps","c":"wsl ~ -e bash --norc"},{"k":"p","t":"Then restore the backup: `cp ~/.bashrc.sauvegarde ~/.bashrc` (or the dated file created by the script, visible with `ls -a ~`). Close and reopen Ubuntu."}]},{"code":"P5.1","tuto":"05","title":"conda not found","see":["\"conda: command not found\" or \"Command 'conda' not found\"."],"why":"conda is not initialized in `~/.bashrc`, the terminal has not been reopened, or the installation failed.","fix":[{"k":"cmd","w":"ub","c":"ls ~/miniconda3/bin/conda"},{"k":"p","t":"If the file exists: initialize, then reload."},{"k":"cmd","w":"ub","c":"~/miniconda3/bin/conda init bash\nsource ~/.bashrc"},{"k":"p","t":"If you see \"No such file or directory\": the installation did not take place or failed. Redo steps 3 and 4. If you installed Miniforge (P5.4), the path is `~/miniforge3`."}]},{"code":"P5.2","tuto":"05","title":"\"Run 'conda init' before 'conda activate'\"","see":["\"CondaError: Run 'conda init' before 'conda activate'\"."],"why":"conda is found, but the terminal initialization was not done or not reloaded.","fix":[{"k":"cmd","w":"ub","c":"conda init bash\nsource ~/.bashrc\nconda activate geoenv"}]},{"code":"P5.3","tuto":"05","title":"Download with wget fails","see":["\"ERROR 404: Not Found.\"","\"Resolving repo.anaconda.com... failed: Temporary failure in name resolution.\"","\"ERROR: cannot verify repo.anaconda.com's certificate\"","Download interrupted before 100%."],"why":"404: address copied incorrectly (often a line split in two). Resolving: DNS problem. Certificate: wrong PC date or proxy. Interruption: unstable connection.","fix":[{"k":"ul","i":["**404**: type the address again on a single line, with no space inside, respecting uppercase letters (Miniconda3, Linux).","**Resolving**: tutorial 02, Problem P2.3.","**Certificate**: check the Windows date and time (P1.6), then `sudo hwclock -s`; on a network with a proxy, see P2.7 or change network.","**Interruption**: resume the download where it stopped by adding `-c`:"]},{"k":"cmd","w":"ub","c":"wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh"}]},{"code":"P5.4","tuto":"05","title":"Terms of Service not accepted","see":["\"CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding: https://repo.anaconda.com/pkgs/main, https://repo.anaconda.com/pkgs/r\""],"why":"Recent versions of Miniconda ask you to accept Anaconda's Terms of Service for its default channels (defaults). The course only uses conda-forge.","fix":[{"k":"p","t":"**Solution 1: remove the default channels** (recommended, step 6), then check that they no longer appear anywhere:"},{"k":"cmd","w":"ub","c":"conda config --remove channels defaults\nconda config --show-sources"},{"k":"p","t":"If `defaults` still appears in a listed file (for example `~/miniconda3/.condarc`), open that file with nano and delete the `- defaults` line."},{"k":"p","t":"**Solution 2: accept the terms** (after reading them):"},{"k":"cmd","w":"ub","c":"conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main\nconda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r"},{"k":"p","t":"**Solution 3: use Miniforge** instead of Miniconda. Miniforge is a conda installer configured for conda-forge from the start, without these terms. All the commands of the course stay the same; only the folder changes (`~/miniforge3`):"},{"k":"cmd","w":"ub","c":"wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O ~/miniforge.sh\nbash ~/miniforge.sh -b -p ~/miniforge3\n~/miniforge3/bin/conda init bash\nsource ~/.bashrc"},{"k":"note","n":"tip","t":"For an ARM PC, replace `x86_64` with `aarch64` in the Miniforge file name."}]},{"code":"P5.5","tuto":"05","title":"Endless solving or conflicts","see":["\"Solving environment\" for more than 30 minutes.","\"LibMambaUnsatisfiableError\", \"UnsatisfiableError\" or \"The following packages are incompatible\"."],"why":"Mixed channels (defaults and conda-forge), incompatible pinned versions (for example numpy=1.26 with a recent package), or an environment changed by many successive installations.","fix":[{"k":"ul","i":["Check the channels: `conda config --show channels` must show only conda-forge (step 6).","Check the solver: `conda config --show solver` must show `libmamba`. Otherwise: `conda install -n base conda-libmamba-solver -y` then `conda config --set solver libmamba`.","Remove the pinned versions (`=1.26`, `=2024.6.0`) from your command.","Start again from scratch with method A (a single command):"]},{"k":"cmd","w":"ub","c":"conda deactivate\nconda remove -n geoenv --all -y\nconda clean --all -y"},{"k":"p","t":"then run the method A command again (step 7)."}]},{"code":"P5.6","tuto":"05","title":"Environment not found","see":["\"EnvironmentNameNotFound: Could not find conda environment: geoenv\".","\"Not a conda environment\"."],"why":"Creating geoenv failed or was interrupted, or there is a typo in the name.","fix":[{"k":"p","t":"Check with `conda env list`. If geoenv does not appear, redo step 7 and carefully read the last message displayed if it fails."}]},{"code":"P5.7","tuto":"05","title":"Module not found or wrong Python","see":["\"ModuleNotFoundError: No module named 'xarray'\".","`which python` shows /usr/bin/python or nothing; \"python: command not found\"."],"why":"geoenv is not activated (the prompt shows (base) or nothing), or the package was installed in another environment.","fix":[{"k":"cmd","w":"ub","c":"conda activate geoenv\nwhich python\nconda list xarray"},{"k":"p","t":"If `conda list xarray` returns nothing, install it in geoenv: `conda install -c conda-forge xarray -y`. In Jupyter, see tutorial 06, Problem P6.3."}]},{"code":"P5.8","tuto":"05","title":"No disk space left","see":["\"No space left on device\" or \"OSError: [Errno 28]\"."],"why":"The C: disk is full (Ubuntu stores its files on C:).","fix":[{"k":"cmd","w":"ub","c":"conda clean --all -y\nrm -f ~/miniconda.sh ~/miniforge.sh\nsudo apt clean\ndf -h ~"},{"k":"p","t":"Also free up space on the Windows side (P1.12), then run the step that failed again."}]},{"code":"P5.9","tuto":"05","title":"Permission denied in conda","see":["\"PermissionError: [Errno 13] Permission denied: '/home/aminata/miniconda3/...'\" or \"EnvironmentNotWritableError\"."],"why":"A conda or pip command was run with sudo, and some files now belong to root.","fix":[{"k":"cmd","w":"ub","c":"sudo chown -R $USER:$USER ~/miniconda3 ~/.conda"},{"k":"p","t":"Then run the command again **without** sudo."}]},{"code":"P5.10","tuto":"05","title":"Miniconda installed in a Windows folder","see":["`which conda` shows a path starting with /mnt/c/... ; very slow installation; symbolic link errors."],"why":"The installation was started from a Windows folder, or a Windows path was chosen.","fix":[{"k":"p","t":"Delete this folder from Windows File Explorer, remove the conda block from `~/.bashrc` (P5.12), then reinstall in `~` (steps 3 and 4 with `-p ~/miniconda3`)."}]},{"code":"P5.11","tuto":"05","title":"Connection error while installing packages","see":["\"CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/...>\".","\"Read timed out\" or \"ConnectionResetError\"."],"why":"Unstable connection, DNS, proxy or firewall.","fix":[{"k":"cmd","w":"ub","c":"conda config --set remote_read_timeout_secs 120\nconda config --set remote_max_retries 5"},{"k":"p","t":"Run the same command again: conda reuses the packages already downloaded. See also P2.3 (DNS) and P2.7 (proxy: `conda config --set proxy_servers.http http://<proxy_address>:<port>` and the same with `proxy_servers.https`)."}]},{"code":"P5.12","tuto":"05","title":"Errors when Ubuntu starts after removing conda","see":["\"bash: /home/aminata/miniconda3/bin/conda: No such file or directory\" every time the terminal opens."],"why":"The conda initialization block remained in `~/.bashrc` even though Miniconda was removed.","fix":[{"k":"p","t":"Open `nano ~/.bashrc` and delete the whole block between `# >>> conda initialize >>>` and `# <<< conda initialize <<<` (including these two lines). Save, then reopen Ubuntu. If you reinstall Miniconda right afterwards, `conda init bash` will create a correct block again."}]},{"code":"P5.13","tuto":"05","title":"GDAL, PROJ or shared library errors","see":["\"ImportError: libgdal.so.xx: cannot open shared object file\".","\"pyproj.exceptions.DataDirError\" or \"PROJ: proj_create: ...\"."],"why":"Geospatial libraries installed with a mix of pip and conda.","fix":[{"k":"cmd","w":"geo","c":"pip uninstall -y rasterio fiona geopandas pyproj shapely\nconda install -c conda-forge --force-reinstall rasterio fiona geopandas pyproj shapely gdal -y"},{"k":"p","t":"If the error persists, recreate geoenv (P5.5). **Rule**: never install these libraries with pip."}]},{"code":"P5.14","tuto":"05","title":"NumPy 1 / NumPy 2 incompatibility","see":["\"A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x...\"","\"numpy.dtype size changed, may indicate binary incompatibility\"."],"why":"An old package, often installed with pip, was compiled for NumPy 1 while geoenv contains NumPy 2.","fix":[{"k":"p","t":"Reinstall the faulty package from conda-forge: `conda install -c conda-forge <package> -y`. If no compatible version exists, limit NumPy: `conda install -c conda-forge \"numpy<2\" -y`."}]},{"code":"P5.15","tuto":"05","title":"\"(base)\" is always displayed","see":["Every terminal starts with (base)."],"why":"Normal conda behaviour.","fix":[{"k":"p","t":"Nothing to fix. If it bothers you: `conda config --set auto_activate_base false` (you will then have to type `conda activate geoenv` to work, which remains good practice)."}]},{"code":"P6.1","tuto":"06","title":"Package not found","see":["\"PackagesNotFoundError: The following packages are not available from current channels: - pandas-profiling\"."],"why":"Typo, pip-specific name (different from the conda name), package renamed or abandoned, or `-c conda-forge` forgotten.","fix":[{"k":"p","t":"Check the name with the table below, then search:"},{"k":"cmd","w":"geo","c":"conda search -c conda-forge <name>"},{"k":"table","h":["Name with pip / at import","Name with conda"],"r":[["sklearn (import)","scikit-learn"],["PIL (import)","pillow"],["psycopg2-binary","psycopg2"],["pandas-profiling","ydata-profiling"],["shapefile (import)","pyshp"],["ee (import)","earthengine-api"]]}]},{"code":"P6.2","tuto":"06","title":"Very long installation or conflict","see":["Endless \"Solving environment\", \"LibMambaUnsatisfiableError\", or \"The following packages are incompatible\"."],"why":"Too many packages at once with incompatible constraints, or mixed channels.","fix":[{"k":"p","t":"Install in small groups to find the package causing the problem:"},{"k":"cmd","w":"geo","c":"conda install -c conda-forge seaborn statsmodels scikit-learn -y\nconda install -c conda-forge xesmf rasterstats -y\nconda install -c conda-forge folium streamlit streamlit-folium -y"},{"k":"p","t":"See also tutorial 05, Problem P5.5 (channels, solver, recreating the environment)."}]},{"code":"P6.3","tuto":"06","title":"Module not found (especially in Jupyter)","see":["\"ModuleNotFoundError: No module named 'geopandas'\" in Jupyter, even though the check script says OK."],"why":"Jupyter uses a kernel other than geoenv, or the package was installed in (base).","fix":[{"k":"ul","i":["In Jupyter: menu **Kernel > Change Kernel > Python (geoenv)** (step 3 if this kernel does not appear).","Stop Jupyter, type `conda activate geoenv`, then start it again.","Check in a cell: `import sys; print(sys.executable)` must contain `envs/geoenv`.","If the package was installed in (base), install it in geoenv."]}]},{"code":"P6.4","tuto":"06","title":"Jupyter: browser, port or token","see":["\"No web browser found\" or \"Could not open browser\".","\"The port 8888 is already in use, trying another port.\"","Jupyter asks for a \"token\" or a password."],"why":"Ubuntu has no browser (normal), another Jupyter session is open, or the copied address does not contain the token.","fix":[{"k":"ul","i":["**Browser**: this is normal, copy the `http://localhost:...` address into your Windows browser (the `--no-browser` option removes the message).","**Port**: Jupyter then uses 8889, 8890... Use the address actually displayed. Stop old sessions (close the terminals or press Ctrl + C).","**Token**: in another Ubuntu terminal with geoenv active, `jupyter server list` shows the full addresses with their token.","If `localhost` does not respond, try `http://127.0.0.1:8888/...`."]}]},{"code":"P6.5","tuto":"06","title":"Cartopy: coastline download fails","see":["\"URLError: <urlopen error [Errno -3] Temporary failure in name resolution>\" or a \"DownloadWarning\" when drawing a map."],"why":"On first use, cartopy downloads the Natural Earth data: an Internet connection is required.","fix":[{"k":"p","t":"Connect to the Internet and run it again. If there is a DNS problem: tutorial 02, P2.3. After a first successful download, maps work offline."}]},{"code":"P6.6","tuto":"06","title":"plt.show() does not display any window","see":["The script ends without displaying the plot, or \"UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\"."],"why":"No graphical display available (P2.8), or script run outside a notebook.","fix":[{"k":"p","t":"Save the figure, then open it in Windows (the most reliable method):"},{"k":"cmd","w":"py","c":"plt.savefig(\"figures/carte_pluie.png\", dpi=150, bbox_inches=\"tight\")"},{"k":"cmd","w":"geo","c":"explorer.exe figures/carte_pluie.png"}]},{"code":"P6.7","tuto":"06","title":"xesmf cannot be imported","see":["\"ImportError: ... esmpy ...\" or \"ModuleNotFoundError: No module named 'ESMF'\"."],"why":"xesmf depends on the compiled ESMF library, available only through conda-forge (not through pip).","fix":[{"k":"cmd","w":"geo","c":"pip uninstall -y xesmf\nconda install -c conda-forge esmpy xesmf -y"}]},{"code":"P6.8","tuto":"06","title":"Not enough memory with large files","see":["The program stops with \"Killed\", or \"MemoryError\", \"Unable to allocate ... GiB\"."],"why":"The loaded file is larger than the memory allocated to WSL (by default, about half of the PC's RAM).","fix":[{"k":"p","t":"**1. Load only what you need** (region and period), and work in chunks with dask:"},{"k":"cmd","w":"py","c":"ds = xr.open_dataset(\"era5_t2m.nc\", chunks={\"time\": 365})\nsn = ds.sel(latitude=slice(17, 12), longitude=slice(-18, -11), time=slice(\"1991\", \"2020\"))"},{"k":"p","t":"**2. Increase WSL memory**: create or edit `C:\\Users\\<YourName>\\.wslconfig` (Notepad):"},{"k":"cmd","w":"wslconfig","c":"[wsl2]\nmemory=6GB\nswap=4GB"},{"k":"p","t":"Adjust `memory` to your PC (at most about 75% of the RAM), then run `wsl --shutdown` in PowerShell."}]},{"code":"P6.9","tuto":"06","title":"Cannot read Excel files","see":["\"XLRDError: Excel xlsx file; not supported\" or \"Missing optional dependency 'openpyxl'\"."],"why":"xlrd now only reads old .xls files; .xlsx files require openpyxl.","fix":[{"k":"cmd","w":"geo","c":"conda install -c conda-forge openpyxl -y"},{"k":"p","t":"Then in Python: `pd.read_excel(\"fichier.xlsx\", engine=\"openpyxl\")`."}]},{"code":"P6.10","tuto":"06","title":"spaCy model not found","see":["\"OSError: [E050] Can't find model 'fr_core_news_sm'\"."],"why":"Language models are downloaded separately.","fix":[{"k":"cmd","w":"geo","c":"python -m spacy download fr_core_news_sm"}]},{"code":"P6.11","tuto":"06","title":"Error reading a NetCDF file","see":["\"OSError: [Errno -101] NetCDF: HDF error\", \"[Errno -51] NetCDF: Unknown file format\" or \"Permission denied\"."],"why":"Incomplete file (interrupted download), OneDrive file \"online only\", file open in a Windows program (Panoply, QGIS), or wrong format (.grib, .zip).","fix":[{"k":"ul","i":["Check the size and content: `ls -lh fichier.nc` then `ncdump -h fichier.nc`.","OneDrive: right-click > \"Always keep on this device\" (P3.3), or copy the file into `~`.","Close the file in Windows programs.","Download the file again if it is incomplete; extract it if it is an archive (`unzip`, `gunzip`).","GRIB file: `conda install -c conda-forge cfgrib -y`, then `xr.open_dataset(\"f.grib\", engine=\"cfgrib\")`."]}]},{"code":"P6.12","tuto":"06","title":"Earth Engine: authentication or project","see":["\"ee.ee_exception.EEException: Please authorize access to your Earth Engine account\" or \"no project found\"."],"why":"Earth Engine requires a registered account, authentication and a Google Cloud project.","fix":[{"k":"cmd","w":"py","c":"import ee\nee.Authenticate(auth_mode=\"notebook\")\nee.Initialize(project=\"<your-project-id>\")"},{"k":"p","t":"Follow the link displayed, sign in with the Google account registered on Earth Engine, then paste the code you get."}]},{"code":"P9.1","tuto":"09","title":"Tool file not found","see":["\"bash: outil_04_installer_alias.sh: No such file or directory\" (or the same error with .yml or .py)."],"why":"You are not in the Downloads folder, the file was not saved there, or its name has been changed.","fix":[{"k":"p","t":"Type `pwd`: you must be in `/mnt/c/Users/<WindowsName>/Downloads`. Otherwise, type `cd /mnt/c/Users/<WindowsName>/Downloads`. Then `ls` to see the exact names."},{"k":"p","t":"If the browser or WhatsApp renamed the file, for example `outil_04_installer_alias(1).sh`, use that exact name in quotes:"},{"k":"cmd","w":"ub","c":"bash \"outil_04_installer_alias(1).sh\""}]},{"code":"P9.2","tuto":"09","title":"Windows folder not found","see":["\"cd: /mnt/c/Users/Aminata/Downloads: No such file or directory\"."],"why":"The Windows folder name is misspelled (uppercase letters, space) or is not the right one.","fix":[{"k":"p","t":"Type `ls /mnt/c/Users/` and copy the exact name. Use the **Tab** key to complete it automatically. If the name contains a space, put the path in quotes: `cd \"/mnt/c/Users/Aminata Diallo/Downloads\"`."}]},{"code":"P9.3","tuto":"09","title":"The .sh file was opened with Notepad","see":["\"$'\\r': command not found\" or \"syntax error near unexpected token\" when running tool 04."],"why":"The file was saved in Windows format.","fix":[{"k":"cmd","w":"ub","c":"dos2unix outil_04_installer_alias.sh\nbash outil_04_installer_alias.sh"},{"k":"p","t":"Or download the original file again."}]},{"code":"P9.4","tuto":"09","title":"Permission denied on the tool","see":["\"Permission denied\" when typing `./outil_04_installer_alias.sh`."],"why":"The file was run without the word bash in front of it.","fix":[{"k":"p","t":"Always type `bash` in front of the name: `bash outil_04_installer_alias.sh`."}]},{"code":"P9.5","tuto":"09","title":"conda not found (tool 05)","see":["\"conda: command not found\"."],"why":"Miniconda is not installed or not initialized yet.","fix":[{"k":"p","t":"Complete steps 1 to 6 of tutorial 05, then see Problem P5.1."}]},{"code":"P9.6","tuto":"09","title":"geoenv already exists (tool 05)","see":["\"CondaValueError: prefix already exists: /home/aminata/miniconda3/envs/geoenv\"."],"why":"The environment has already been created (for example with another method from tutorial 05).","fix":[{"k":"p","t":"To complete it with the file:"},{"k":"cmd","w":"ub","c":"conda env update -n geoenv -f outil_05_geoenv.yml"},{"k":"p","t":"To start again from scratch: `conda remove -n geoenv --all -y`, then run tool 05 again."}]},{"code":"P9.7","tuto":"09","title":"Wrong Python (tool 06)","see":["\"ATTENTION : ce Python n'est pas celui de geoenv\" (WARNING: this Python is not the geoenv one) or many \"MANQUANT\" (MISSING) lines."],"why":"geoenv is not activated: the command line does not start with (geoenv).","fix":[{"k":"p","t":"Type `geo` (or `conda activate geoenv`), then run `python outil_06_verifier_geoenv.py` again."}]}],"wincodes":[["0x80370102","P1.2","virtualization (see also tutorial 01A)"],["0x8007019e","P1.4","subsystem not enabled"],["0x800701bc","P1.5","kernel needs updating"],["0x80072ee7, 0x80072efd, 0x80072f8f, 0x80190001","P1.6","download, network, date"],["0x80070003","P1.11","disk other than C:"],["0x80070070","P1.12","disk full"],["4294967295","P1.10","Ubuntu closes immediately"]],"pkgs":[[1,"numpy","numerical computing, multidimensional arrays","means, anomalies, percentiles",""],[1,"pandas","data tables and time series","station data, CSV files",""],[1,"scipy","advanced computing: interpolation, statistics, optimization","trend tests, distribution fitting",""],[1,"xarray","labeled multidimensional data (time, lat, lon)","open and analyze CHIRPS, ERA5, CMIP6",""],[1,"netCDF4, h5netcdf","reading and writing NetCDF files","engines used by xarray",""],[1,"cftime","non-standard model calendars (360 days, no leap year)","CMIP and CORDEX outputs",""],[1,"matplotlib","simple plots and maps","time series, rainfall maps",""],[1,"shapely","geometries: points, lines, polygons","region outlines, buffer zones",""],[1,"pyproj","coordinate systems and projections","WGS84 / UTM conversion",""],[1,"geopandas","vector data (shapefile, GeoJSON, GeoPackage)","GADM administrative boundaries",""],[1,"rasterio","reading and writing rasters (GeoTIFF)","elevation (SRTM), land cover",""],[1,"rioxarray","geographic extension of xarray","clip a NetCDF with a shapefile",""],[1,"regionmask","region masks","mean rainfall by region or by country",""],[1,"cartopy","maps with projections, coastlines, borders","publication-quality maps",""],[1,"CDO, NCO","command-line tools for NetCDF","annual means, quick subsetting",""],[2,"seaborn","statistical plots","box plots, correlation heatmaps",""],[2,"statsmodels","statistical models: regression, ARIMA, SARIMA, GLM","climate - malaria relationship",""],[2,"scikit-learn","machine learning","random forests, classification, cross-validation",""],[2,"bottleneck","speeds up computations on large arrays","used automatically by xarray",""],[2,"dask","parallel and \"lazy\" computing on data larger than memory","40 years of ERA5",""],[2,"zarr, fsspec","formats and access to data in the cloud","online CMIP6 data",""],[2,"xesmf","regridding (change of grid)","put a model on the CHIRPS grid",""],[2,"rasterstats","raster / vector zonal statistics","mean rainfall by department",""],[2,"fiona, pyshp","reading and writing geographic files and shapefiles","vector formats",""],[2,"contextily","tiled basemaps (OpenStreetMap)","map background",""],[2,"plotly","interactive plots","zoomable time series",""],[2,"folium, branca","Leaflet interactive maps and their legends","web map of stations",""],[2,"dash, streamlit, streamlit-folium","web applications and dashboards","early warning dashboard",""],[2,"openpyxl","read and write Excel .xlsx files","pd.read_excel(\"cas.xlsx\")",""],[2,"xlrd","read old Excel .xls files (.xls only)","pd.read_excel(\"vieux.xls\")",""],[2,"tabulate","readable tables in the terminal","summaries",""],[2,"tqdm","progress bar","loops over many files",""],[2,"jupyterlab, ipywidgets, nbformat","notebooks, interactive widgets, handling .ipynb files","practical sessions",""],[2,"pillow, imageio","images and animations","animated GIF of monthly maps",""],[3,"pykrige","Interpolation: kriging (interpolate stations onto a grid)","","conda install -c conda-forge pykrige -y"],[3,"osmnx, pyrosm","OpenStreetMap: road networks and buildings; fast reading of OSM files","","conda install -c conda-forge osmnx pyrosm -y"],[3,"geoplot","Thematic statistical maps (little maintained, optional)","","conda install -c conda-forge geoplot -y"],[3,"sympy","Mathematics: symbolic computation","","conda install -c conda-forge sympy -y"],[3,"ydata-profiling","Data exploration: automatic report (former name: pandas-profiling)","","conda install -c conda-forge ydata-profiling -y"],[3,"sqlalchemy, psycopg2","Databases: PostgreSQL / PostGIS","","conda install -c conda-forge sqlalchemy psycopg2 -y"],[3,"click, typer, fire","Command-line scripts: create your own commands","","conda install -c conda-forge click typer fire -y"],[3,"nltk, spacy","Language processing (+ French model)","","conda install -c conda-forge nltk spacy -y\npython -m spacy download fr_core_news_sm"],[3,"transformers, pytorch","Language models (large: 1 to 2 GB)","","conda install -c conda-forge pytorch transformers -y"],[3,"geemap, earthengine-api","Google Earth Engine (Earth Engine account and Google Cloud project required)","","conda install -c conda-forge geemap earthengine-api -y"]],"cmdcats":[["wsl","Managing WSL"],["fichiers","Files and folders"],["windows","Windows bridges"],["apt","Ubuntu software (apt)"],["editeurs","Editors and images"],["conda","Conda and Python"],["cdo","NetCDF: CDO and NCO"],["clavier","Keyboard shortcuts"],["alias","Course aliases"]],"commands":[["wsl","ps","wsl","open Ubuntu from PowerShell",""],["wsl","ps","wsl -l -v","list the distributions and their version (1 or 2)","must show VERSION 2"],["wsl","ps","wsl --shutdown","stop WSL completely","first remedy when something goes wrong"],["wsl","psa","wsl --update","update WSL","PowerShell as administrator"],["wsl","ps","wsl --version","versions of WSL, the kernel, WSLg and Windows","include it in a request for help"],["wsl","ps","wsl --status","WSL status",""],["wsl","ps","wsl --list --online","available distributions",""],["wsl","psa","wsl --install -d Ubuntu","install Ubuntu","tutorial 01"],["wsl","psa","wsl --install -d Ubuntu --web-download","install without going through the Microsoft Store","P1.6"],["wsl","psa","wsl --set-version Ubuntu 2","convert Ubuntu to WSL 2","P1.7"],["wsl","ps","wsl -u root","open Ubuntu as administrator (root)","forgotten password (P2.2)"],["wsl","ps","wsl --export Ubuntu D:\\sauv\\ubuntu.tar","back up all of Ubuntu into one file","tutorial 08"],["wsl","psa","wsl --unregister Ubuntu","delete Ubuntu and all its files","irreversible"],["fichiers","ub","pwd","current folder",""],["fichiers","ub","ls -lh","detailed list, readable sizes","ls -lrt: by date; ls -a: including hidden files"],["fichiers","ub","cd <folder>","enter a folder","cd .. goes up; cd goes back home; cd - previous folder"],["fichiers","ub","cd /mnt/c/Users/<WindowsName>","go to the Windows folder","or the alias m"],["fichiers","ub","mkdir -p <path>","create folders (including intermediate ones)","mkdir -p projet/figures"],["fichiers","ub","touch <file>","create an empty file",""],["fichiers","ub","cp <source> <destination>","copy a file (cp -r: a folder)","cp a.nc ~/donnees/"],["fichiers","ub","mv <old> <new>","move or rename","mv t.py pluie.py"],["fichiers","ub","rm -i <file>","delete with confirmation (permanent)","rm -r: a folder and its contents"],["fichiers","ub","rmdir <folder>","delete an empty folder (safe)",""],["fichiers","ub","cat <file>","display a short file","less, head -n 5, tail -n 5"],["fichiers","ub","wc -l <file>","count the lines",""],["fichiers","ub","find . -name \"*.nc\"","search for files by name","-iname ignores upper/lower case"],["fichiers","ub","grep -n \"<word>\" <file>","search for a word (with line number)","grep -n xarray *.py"],["fichiers","ub","du -sh <folder>","size of a folder","df -h ~: free space"],["fichiers","ub","tree -L 2","folder tree on 2 levels",""],["fichiers","ub","chmod +x <script.sh>","make a script executable",""],["fichiers","ub","dos2unix <file>","fix Windows line endings","P3.10"],["fichiers","ub","unzip <f.zip>","extract a .zip","tar -xzf <f.tar.gz>; gunzip <f.gz>"],["fichiers","ub","wget -c <url>","download (with resume)",""],["fichiers","ub","history | grep conda","find a command you typed before",""],["windows","ub","explorer.exe .","open the current folder in File Explorer","alias ex"],["windows","ub","explorer.exe <file>","open a file with its Windows application","explorer.exe carte.png"],["windows","ub","notepad.exe <file>","edit with Notepad",""],["windows","ub","code .","open the folder in VS Code","tutorial 06"],["windows","win","\\\\wsl.localhost\\Ubuntu\\home\\<name>","address of the Linux files in File Explorer","File Explorer address bar"],["apt","ub","sudo apt update && sudo apt upgrade -y","update Ubuntu","alias maj"],["apt","ub","sudo apt install -y <package>","install a program","sudo apt install -y gedit"],["apt","ub","sudo apt remove <package>","uninstall",""],["apt","ub","apt search <word>","search for a program","without sudo"],["apt","ub","sudo apt autoremove -y && sudo apt clean","clean up",""],["editeurs","ub","nano <file>","editor inside the terminal","Ctrl + O save, Ctrl + X quit, Alt + / end of file; alias n"],["editeurs","ub","gedit <file> &","simple graphical editor","alias g"],["editeurs","ub","kate <file> &","advanced graphical editor","alias k"],["editeurs","ub","eog <image> &","image viewer",""],["editeurs","ub","display <image> &","display an image (ImageMagick)","alias d"],["conda","ub","conda activate geoenv","activate the course environment","alias geo; in every new terminal"],["conda","ub","conda deactivate","leave the environment",""],["conda","ub","conda env list","list the environments",""],["conda","geo","conda list <package>","installed packages","conda list xarray"],["conda","geo","conda install -c conda-forge <package> -y","install into the active environment","never sudo"],["conda","geo","conda search -c conda-forge <package>","check that a package exists",""],["conda","geo","conda update -c conda-forge <package> -y","update a package",""],["conda","geo","conda remove <package> -y","remove a package",""],["conda","geo","conda env export --from-history > geoenv.yml","save the environment recipe",""],["conda","ub","conda env create -f geoenv.yml","recreate an environment from a recipe",""],["conda","ub","conda remove -n geoenv --all -y","delete an environment","from (base)"],["conda","ub","conda clean --all -y","free up disk space",""],["conda","ub","conda info","full information for a request for help",""],["conda","geo","python <script.py>","run a script","alias p"],["conda","geo","python -m pip install <package>","last resort if not available on conda-forge","inside geoenv"],["conda","geo","jupyter lab --no-browser","start Jupyter Lab (Ctrl + C then y to stop)","alias jl"],["conda","geo","jupyter notebook --no-browser","start Jupyter Notebook","alias j"],["conda","geo","jupyter server list","find the address and the token again",""],["cdo","geo","ncdump -h <f.nc>","display the header: variables, dimensions, units",""],["cdo","geo","cdo -V","check that CDO is installed",""],["cdo","geo","cdo sinfon <f.nc>","file summary (grid, dates, variables)",""],["cdo","geo","cdo showname <f.nc>","variable names","cdo showyear: available years"],["cdo","geo","cdo selname,<var> <in.nc> <out.nc>","extract a variable","for example precip"],["cdo","geo","cdo selyear,1991/2020 <in.nc> <out.nc>","extract a period",""],["cdo","geo","cdo sellonlatbox,-18,-11,12,17 <in.nc> <out.nc>","cut out an area","here, a box around Senegal (lon1,lon2,lat1,lat2)"],["cdo","geo","cdo yearsum <in.nc> <out.nc>","annual total","yearmean, monmean: annual and monthly means"],["cdo","geo","cdo ymonmean <in.nc> <out.nc>","monthly climatology (12 months)",""],["cdo","geo","cdo fldmean <in.nc> <out.nc>","spatial mean (time series of the area)",""],["cdo","geo","cdo timmean <in.nc> <out.nc>","mean over the whole period",""],["cdo","geo","cdo mergetime <f1.nc> <f2.nc> <out.nc>","merge files that follow each other in time",""],["cdo","geo","ncks -v <var> <in.nc> <out.nc>","extract a variable with NCO",""],["cdo","geo","cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc pluie_annuelle_senegal.nc","chain CDO operators","run from right to left"],["clavier","key","Tab","complete a name (twice: list of choices)",""],["clavier","key","Up / Down arrow","command history","Ctrl + R: search the history"],["clavier","key","Ctrl + C","interrupt the running command","does not copy"],["clavier","key","Ctrl + Shift + C / Ctrl + Shift + V","copy / paste","or right-click to paste"],["clavier","key","Ctrl + L","clear the screen",""],["clavier","key","Ctrl + D","close the terminal",""],["clavier","key","Ctrl + Z then fg","pause then resume a program","P3.8"],["clavier","key","Alt Gr + 6 ; Alt Gr + 2","type | (pipe); type ~ (then Space)","French AZERTY keyboard"],["alias","ub","m","go to the Windows folder","also M, myhome"],["alias","ub","docs / dl","go to Documents / Downloads",""],["alias","ub","ll / la / lt","ls -lh / ls -lha / ls -lrt",""],["alias","ub","p","python3","also P"],["alias","ub","geo","conda activate geoenv","after tutorial 05"],["alias","ub","j / jl","Jupyter Notebook / Jupyter Lab","after tutorial 06; also J"],["alias","ub","k / g / n","kate / gedit / nano",""],["alias","ub","d","display (show an image)",""],["alias","ub","ex / voir","explorer.exe . / explorer.exe",""],["alias","ub","maj","update Ubuntu",""],["alias","ub","source ~/.bashrc","reload the aliases",""]],"qcm":[["00","You see `PS C:\\Users\\Aminata>` at the start of the line. Where are you?",["In PowerShell (Windows)","In the Ubuntu terminal","In Ubuntu with geoenv active","In the BIOS"],0,"A line starting with `PS ...>` belongs to PowerShell. In Ubuntu, the prompt ends with `$` (for example `aminata@PC:~$`)."],["00","What is the minimum Windows configuration needed to follow the course?",["Windows 10 version 2004 (build 19041) or Windows 11, 64-bit","Windows 7 or later","Windows 10 Pro only","Any Windows, 32-bit or 64-bit"],0,"WSL 2 with `wsl --install` requires Windows 10 version 2004 (build 19041) or later, or Windows 11, 64-bit. The Home edition is enough."],["00","While you type your Linux password, nothing appears on screen. What should you do?",["Keep typing, then press Enter: this is normal","Close Ubuntu: the keyboard is frozen","Type `wsl --shutdown` in Ubuntu","Reinstall Ubuntu"],0,"Ubuntu shows neither letters nor asterisks while you type a password. This is a normal security measure."],["00","Which of these golden rules is correct?",["Never put `sudo` in front of `conda` or `pip`","Always put `sudo` in front of `conda` to avoid errors","Install Python libraries with `sudo pip`","Move on to the next step even if the current step failed"],0,"`sudo` is only for `apt` commands. In front of conda or pip, it makes files owned by root (Problem P5.9)."],["01A","Virtualization shows \"Disabled\". Which method lets you enter the BIOS without relying on a startup key?",["Settings > Recovery > Advanced startup > Troubleshoot > Advanced options > UEFI Firmware Settings","Type `wsl --bios` in PowerShell","Open Task Manager and click \"Enable\"","Press Ctrl + Alt + Delete in Windows"],0,"Method A goes through Windows Advanced startup and restarts directly into the BIOS (UEFI). It does not depend on any key."],["01A","On an AMD processor, what is the virtualization option in the BIOS usually called?",["SVM Mode (or AMD-V)","Intel VT-x","Secure Boot","Fast Boot"],0,"On AMD, the option is called SVM Mode, AMD-V or AMD SVM Technology. Intel VT-x is for Intel processors. Secure Boot and Fast Boot are other options that must not be changed."],["01A","How do you save the change and leave the BIOS?",["F10 (Save and Exit), then Yes","Esc then Discard Changes","Cut the power","Load Defaults"],0,"F10 saves and exits. \"Discard Changes\" or \"Exit Without Saving\" throw away the changes. \"Load Defaults\" can change other settings (P1A.6)."],["01A","After the BIOS change, Windows asks for a BitLocker recovery key. Where can you find it?",["In the PC's Microsoft account, at aka.ms/myrecoverykey","In Task Manager","In the ~/.bashrc file","By typing `systeminfo`"],0,"The BitLocker key (48 digits) is stored in the PC's Microsoft account. Prevention: write it down or suspend the protection before entering the BIOS (P1A.5)."],["01","Which command installs WSL and Ubuntu (recommended method)?",["`wsl --install -d Ubuntu` in PowerShell (Administrator)","`sudo apt install wsl` in Ubuntu","`wsl --install -d Ubuntu` in the Ubuntu terminal","`conda install wsl`"],0,"The installation is done in PowerShell opened as administrator. Ubuntu does not exist yet at this stage."],["01","WSL installation fails with error `0x80370102`. What is the most likely cause?",["Virtualization is disabled in the BIOS","The C: drive is full","The Linux password is wrong","geoenv is not activated"],0,"0x80370102 means virtualization is disabled or the Virtual Machine Platform is not enabled (P1.2, tutorial 01A). A full disk gives 0x80070070."],["01","`wsl -l -v` shows `Ubuntu  Stopped  1`. What should you do?",["Convert to WSL 2: `wsl --set-version Ubuntu 2`","Nothing: \"Stopped\" is a serious error","Reinstall Windows","Type `sudo apt upgrade`"],0,"The VERSION column must be 2. \"Stopped\" is a normal state. The conversion is done with `wsl --set-default-version 2` then `wsl --set-version Ubuntu 2` (P1.7)."],["01","After `wsl --install`, why must you choose \"Restart\" and not \"Shut down\"?",["With Fast Startup, \"Shut down\" then switching on again does not always complete the installation","\"Shut down\" deletes Ubuntu","\"Restart\" activates geoenv automatically","There is no difference"],0,"Windows Fast Startup turns \"Shut down\" into a kind of hibernation: the components are not always finalized."],["02","Which of these Linux user names will be accepted?",["aminata2","Aminata","2aminata","aminata diallo"],0,"The name must contain only lowercase letters and digits, with no spaces or accents, and must start with a letter (P2.1)."],["02","What does `sudo apt update` do?",["It downloads the list of available software","It installs all the updates","It updates conda","It updates Windows"],0,"`apt update` refreshes the package list. It is `apt upgrade` that installs the updates."],["02","In Ubuntu (before tutorial 05), `python` answers \"command not found\". What does this message mean?",["It is normal: outside a conda environment the command is called `python3`","Python is not installed: you need `sudo pip install python`","WSL is version 1","DNS is not working"],0,"Ubuntu provides `python3`. The `python` command only exists once geoenv is activated."],["02","Ubuntu shows \"Temporary failure resolving 'archive.ubuntu.com'\". What is the cause?",["Ubuntu cannot translate web addresses (DNS)","The password is wrong","The disk is full","The alias m is badly defined"],0,"This is a name resolution (DNS) problem, common with a VPN or after sleep mode. See P2.3."],["02","You have forgotten your Linux password. Which command, typed in PowerShell, opens Ubuntu as administrator so you can reset it?",["`wsl -u root`","`sudo passwd`","`wsl --reset-password`","`wsl --shutdown`"],0,"`wsl -u root` opens a root session without a password; you then type `passwd <your_linux_name>` (P2.2)."],["03","What is the Ubuntu path of `C:\\Users\\Aminata\\Documents`?",["/mnt/c/Users/Aminata/Documents","/mnt/C/Users/Aminata/Documents","C:/Users/Aminata/Documents","/home/Aminata/Documents"],0,"`C:` becomes `/mnt/c` (lowercase) and the backslashes `\\` become `/`."],["03","How do you find out the exact name of your Windows folder (<WindowsName>)?",["`ls /mnt/c/Users/` then keep the name that is not All Users, Default, Default User, Public or desktop.ini","The name shown on the Windows sign-in screen","`whoami` in Ubuntu","The Linux user name"],0,"Only the output of `ls /mnt/c/Users/` can be trusted. With a Microsoft account, the folder name may be shortened (for example `amina`)."],["03","The folder is called `Mes donnees`. Which command is correct?",["`cd \"Mes donnees\"`","`cd Mes donnees`","`cd Mes_donnees`","`cd Mes-donnees`"],0,"A name containing a space must be put in quotes, otherwise Ubuntu sees two names."],["03","How do you open, in Windows File Explorer, the folder you are in on Ubuntu?",["`explorer.exe .`","`explorer.exe ~`","`open .`","`cd /mnt/c`"],0,"The dot `.` means the current folder. `open .` is the Mac equivalent."],["03","Your Desktop looks empty in `/mnt/c/Users/<WindowsName>/Desktop` although it contains files. Where should you look?",["In `/mnt/c/Users/<WindowsName>/OneDrive/`","In `/home/<name>/Desktop`","In `/mnt/d/Desktop`","In `/etc/wsl.conf`"],0,"OneDrive often moves the Desktop and Documents into its own folder (P3.3)."],["03A","What does `echo \"texte\" > notes.txt` do if notes.txt already contains lines?",["It replaces the whole content with \"texte\"","It adds \"texte\" at the end","It refuses because the file exists","It creates a copy notes(1).txt"],0,"A single `>` replaces the whole content, without confirmation. To add at the end, you need `>>`."],["03A","How do you quit `less`?",["The q key","Ctrl + X","Ctrl + O","Esc"],0,"In less, q (\"quit\") quits. Ctrl + X is used to quit nano."],["03A","In nano, how do you save the file?",["Ctrl + O then Enter","Ctrl + S","Ctrl + X then N","Ctrl + C"],0,"Ctrl + O (\"Output\") then Enter to confirm the name. Ctrl + X quits; at the question \"Save modified buffer?\", N discards the changes."],["03A","`cp donnees sauvegarde` shows \"cp: -r not specified; omitting directory\". Why?",["`donnees` is a folder: you need `cp -r`","The folder `sauvegarde` already exists","You need `sudo`","The name contains an uppercase letter"],0,"To copy a folder and all its contents, the `-r` (recursive) option is required."],["03A","Before deleting anything, what is the rule of the three checks?",["`pwd`, then `ls`, then `rm -i`","`rm -rf *`, then `ls`, then `pwd`","`sudo`, then `rm`, then `exit`","`cd ~`, then `rm -r`, then `tree`"],0,"You check where you are (`pwd`), what you are going to delete (`ls`), then confirm file by file (`rm -i`). There is no recycle bin."],["03A","The terminal shows `[1]+ Stopped python3 analyse.py`. What happened?",["You pressed Ctrl + Z: the program is paused","The script finished successfully","The script was deleted","The disk is full"],0,"Ctrl + Z suspends the program. `fg` resumes it; Ctrl + C then stops it if needed."],["03A","What does `ls donnees | wc -l` do?",["It counts the items listed in `donnees`","It deletes the folder `donnees`","It writes the list to a file named wc","It shows hidden files"],0,"The \"pipe\" `|` sends the output of `ls` to `wc -l`, which counts the lines, and therefore the listed items."],["03A","Which command finds all .csv files in the current folder and its subfolders?",["`find . -name \"*.csv\"`","`grep \"*.csv\"`","`ls -r *.csv`","`cd *.csv`"],0,"`find` searches by name in a folder and all its subfolders. `grep` searches for a word inside files."],["04","Why do the course aliases use `$WIN` instead of `/mnt/c/Users/User`?",["So that they work on every PC, whatever the name of the Windows folder","Because `/mnt/c` does not exist in WSL 2","To make Ubuntu faster","Because aliases cannot contain /"],0,"`User` is the name of the Windows folder on the author's PC. The WIN variable holds each student's real folder (P4.5)."],["04","Which of these lines is a correct alias definition?",["`alias p='python3'`","`alias p = 'python3'`","`alias p=‘python3’`","`alias p='python3`"],0,"No spaces around `=`, straight apostrophes, and the closing apostrophe present (P4.6)."],["04","You have just installed the aliases. `m` answers \"command not found\". What do you type first?",["`source ~/.bashrc`","`sudo apt install m`","`conda activate geoenv`","`wsl --unregister Ubuntu`"],0,"`source ~/.bashrc` reloads the file in the open terminal. New terminals read it automatically (P4.1)."],["04","After pasting the alias block, every Enter shows `>`. What is the cause?",["The final word EOF is missing or not alone on its line","The disk is full","geoenv is not activated","The Windows folder name contains a space"],0,"The terminal is waiting for the end of the block. Type `EOF` alone on the line, or Ctrl + C (P4.3)."],["05","Where should Miniconda be installed?",["In the Linux folder `~` (for example `~/miniconda3`)","In `/mnt/c/Users/<WindowsName>/Documents`","In `C:\\Program Files`","In `/usr/bin` with sudo"],0,"Miniconda is installed in Linux, never in a Windows folder (slowness, link errors: P5.10), and never with sudo."],["05","`uname -m` shows `x86_64`. Which installer should you choose?",["Miniconda3-latest-Linux-x86_64.sh","Miniconda3-latest-Linux-aarch64.sh","Miniconda3-latest-MacOSX-arm64.sh","The Windows .exe installer"],0,"x86_64 corresponds to Intel and AMD processors. aarch64 corresponds to ARM processors."],["05","Why run `conda config --remove channels defaults`?",["To use only conda-forge and avoid channel conflicts and the terms of service error","To delete Python","To deactivate geoenv","To make Windows faster"],0,"The course uses only conda-forge. Removing `defaults` avoids mixing channels (P5.5) and the CondaToSNonInteractiveError error (P5.4)."],["05","After `conda activate geoenv`, `which python` must show:",["a path containing `miniconda3/envs/geoenv`","`/usr/bin/python3`","`C:\\Python311\\python.exe`","nothing"],0,"If the path does not contain `envs/geoenv`, geoenv is not active or the installation failed (P5.7)."],["05","\"PermissionError: [Errno 13] Permission denied: '/home/aminata/miniconda3/...'\". Most likely cause?",["A conda or pip command was run with sudo","The BIOS is locked","WSL is version 1","The alias geo is misspelled"],0,"sudo made files owned by root. Fix: `sudo chown -R $USER:$USER ~/miniconda3 ~/.conda`, then run again without sudo (P5.9)."],["05","Which command saves the geoenv recipe so you can recreate it on another PC?",["`conda env export --from-history > geoenv.yml`","`cp -r ~/miniconda3 /mnt/c/`","`conda clean --all -y`","`pip freeze > geoenv.yml`"],0,"`conda env export --from-history` writes the list of requested packages. You then recreate it with `conda env create -f geoenv.yml`."],["06","Before installing a level 2 package, what must the prompt show?",["`(geoenv)`","`(base)`","`PS C:\\>`","`root@...#`"],0,"Installing into (base) is a common mistake: the package will not be found in geoenv or in Jupyter (P6.3)."],["06","A package does not exist on conda-forge. Which command should you use, as a last resort?",["`python -m pip install <name>` inside geoenv","`sudo pip install <name>`","`sudo apt install <name>`","`pip install --break-system-packages <name>`"],0,"Always `python -m pip` with geoenv activated, never `sudo pip`, and only after the conda installations."],["06","In Jupyter, `import geopandas` fails although the check script shows OK. What should you do?",["Choose the \"Python (geoenv)\" kernel (Kernel > Change Kernel)","Reinstall Windows","Delete geoenv","Type `sudo jupyter lab`"],0,"Jupyter is using a kernel other than geoenv. Step 3 of tutorial 06 registers the \"Python (geoenv)\" kernel (P6.3)."],["06","Which package is used for regridding (putting a model onto the CHIRPS grid)?",["xesmf","tqdm","openpyxl","folium"],0,"xesmf does the regridding. It depends on ESMF, which is available only through conda-forge (P6.7)."],["06","How do you stop Jupyter when it was started in the terminal?",["Ctrl + C, then y and Enter","Closing the browser tab is enough","Ctrl + Z","`wsl --unregister Ubuntu`"],0,"Ctrl + C then y stops the server. Closing the tab does not stop it; Ctrl + Z only pauses it."],["06","The program stops with \"Killed\" on a large ERA5 file. What is the first thing to do?",["Load only the region and period you need, with `chunks` (dask)","Run it again with sudo","Install xlrd","Change browser"],0,"The file exceeds the memory available to WSL. Select only what is needed with `.sel(...)` and `chunks`, then you can increase `memory` in `.wslconfig` (P6.8)."],["07","What does `cdo -fldmean -yearsum -sellonlatbox,-18,-11,12,17 chirps.nc out.nc` do?",["Cuts out the area, sums by year, then computes the spatial mean","Computes the spatial mean, then cuts out the area, then sums","Merges two files","Displays the file header"],0,"Chained CDO operators run from right to left: sellonlatbox first, then yearsum, then fldmean."],["07","Which command displays the variables, dimensions and units of a NetCDF file without loading it?",["`ncdump -h fichier.nc`","`cat fichier.nc`","`cdo mergetime fichier.nc`","`head fichier.nc`"],0,"`ncdump -h` displays the header. `cat` or `head` on a binary file fill the screen with unreadable characters."],["08","What is the universal remedy when WSL behaves strangely?",["Close Ubuntu, run `wsl --shutdown` in PowerShell, reopen Ubuntu","`rm -rf ~`","`wsl --unregister Ubuntu`","Reinstall Windows"],0,"`wsl --shutdown` stops WSL completely without deleting anything. `wsl --unregister` permanently deletes Ubuntu."],["08","What does `wsl --unregister Ubuntu` delete?",["Ubuntu, the home folder ~, Miniconda and geoenv, permanently","Only the aliases","Only the files in your Windows Documents","Nothing, it pauses Ubuntu"],0,"It is irreversible for everything inside Ubuntu. Files located in Windows folders are not affected."],["09","How do you run the tool `outil_04_installer_alias.sh`?",["`bash outil_04_installer_alias.sh` in Ubuntu, from Downloads","Double-click it in Windows File Explorer","Open it in Notepad and copy its content","`python outil_04_installer_alias.sh`"],0,"A .sh file is run with `bash`. Do not open it in Notepad: it could be saved in Windows format (P9.3)."],["09","In what order should the three tools be used?",["tool 04 after tutorial 03; tool 05 after Miniconda (tutorial 05, steps 1 to 6); tool 06 after tutorial 06, step 1","tool 06, then 05, then 04","All three before tutorial 01","tool 05 before installing Miniconda"],0,"Tool 05 does not work without Miniconda, and tool 06 does not work without geoenv."],["09","`conda env create -f outil_05_geoenv.yml` answers \"prefix already exists\". What should you do to complete the environment?",["`conda env update -n geoenv -f outil_05_geoenv.yml`","`sudo conda env create -f outil_05_geoenv.yml`","`bash outil_05_geoenv.yml`","Delete Miniconda"],0,"geoenv already exists: you update it with the file. To start from scratch: `conda remove -n geoenv --all -y` (P9.6)."]],"outils":[{"id":"04","file":"outil_04_installer_alias.sh","type":"bash script (.sh)","mot":"bash","quand":"Right after tutorial 03.","fait":"Detects your Windows folder (or asks you for it), backs up ~/.bashrc, removes any old block of course aliases and adds the new one. Can be run again without creating duplicates.","steps":[["Open Ubuntu","Start menu, type \"Ubuntu\", then Enter.",null,null],["Go to Downloads","Replace <WindowsName> with the name of your Windows folder.","cd /mnt/c/Users/<WindowsName>/Downloads",null],["Check that the file is there","","ls","outil_04_installer_alias.sh appears in the list (with the two other tools)."],["Run the file","If it asks for the name of your Windows folder, type it exactly, then Enter.","bash outil_04_installer_alias.sh",null],["Activate the result","","source ~/.bashrc",null],["Test","","m\npwd","The screen shows /mnt/c/Users/<WindowsName>. The shortcuts m, dl, ll, geo, ex, maj are installed. From now on, dl takes you straight to Downloads."]],"pb":["P9.1","P9.2","P9.3","P9.4"]},{"id":"05","file":"outil_05_geoenv.yml","type":"conda recipe (.yml)","mot":"conda env create -f","quand":"After steps 1 to 6 of tutorial 05 (Miniconda installed and channels configured).","fait":"Creates the geoenv environment with Python 3.11 and the core scientific packages, in a single resolution. Equivalent to method C of step 7 of tutorial 05.","steps":[["Check that conda responds","If not, finish tutorial 05 (steps 1 to 6) before continuing.","conda --version","A version number is displayed, for example conda 25.x.x."],["Go to Downloads","Using the alias from tool 04.","dl",null],["Run the file","The installation takes 10 to 20 minutes and runs by itself. Do not close the window and do not type anything during this time.","conda env create -f outil_05_geoenv.yml",null],["Activate geoenv","Then move on to tutorial 06, step 1 (installing the level 2 packages).","conda activate geoenv","The command line now starts with (geoenv)."]],"pb":["P9.5","P9.6","P5.4","P5.5","P5.11"]},{"id":"06","file":"outil_06_verifier_geoenv.py","type":"Python program (.py)","mot":"python","quand":"At the end, after step 1 of tutorial 06 (level 2 installed).","fait":"Checks every package of levels 1, 2 and 3, writes and reads back a test NetCDF file, produces the map test_geoenv.png and, in the \"Bilan\" (summary) section, gives the exact command to install whatever is missing.","steps":[["Activate geoenv and go to Downloads","","geo\ndl",null],["Run the file","","python outil_06_verifier_geoenv.py","\"OK\" for all of level 1 (and level 2)."],["View the test map","","explorer.exe test_geoenv.png","The map opens in Windows. Your computer is ready."],["If lines marked \"MANQUANT\" (missing) appear","Read the \"Bilan\" (summary) at the bottom of the screen: it gives the exact command to copy to install what is missing. Then run the script again.","python outil_06_verifier_geoenv.py",null]],"pb":["P9.7","P6.3","P6.5"]}],"order":[["1","Install WSL and Ubuntu, update, learn the basic commands","00 to 03"],["2","Put the three tool files in Downloads, without renaming them","09"],["3","Tool 04: install the shortcuts","09"],["4","Install Miniconda and configure conda (steps 1 to 6)","05"],["5","Tool 05: create the geoenv environment","09"],["6","Install the level 2 packages (step 1)","06"],["7","Tool 06: check the whole installation","09"]]}};
</script>
<script>
(function(){
"use strict";
const $ = (s, r) => (r || document).querySelector(s);
const main = $("#view");

/* ---------- storage ---------- */
const KEY = "wsl-parcours-v2";
let store = {checks:{}, win:"", linux:"", hist:[], theme:"", lang:""};
try { const s = JSON.parse(localStorage.getItem(KEY) || "{}"); store = Object.assign(store, s); } catch(e) {}
function save(){ try { localStorage.setItem(KEY, JSON.stringify(store)); } catch(e) {} }

/* ---------- language ---------- */
let LANG = "fr";
const wn = /(?:^|;)lang=(fr|en)/.exec(window.name || "");
if (wn) LANG = wn[1]; else if (store.lang === "en" || store.lang === "fr") LANG = store.lang;
const EN = LANG === "en";
const L = (fr, en) => EN ? en : fr;
const D = DATA[LANG];
document.documentElement.lang = LANG;
function setLang(l){ if (l === LANG) return; store.lang = l; save(); try { window.name = "lang=" + l; } catch(e) {} location.reload(); }
const NUM = x => EN ? String(x) : String(x).replace(".", ",");
const PH_WIN = /<NomWindows>|<VotreNom>|<WindowsName>|<YourName>/g, PH_LIN = /<votre_nom_linux>|<your_linux_name>/g;
const PHW = L("<NomWindows>","<WindowsName>"), PHL = L("<votre_nom_linux>","<your_linux_name>");

/* ---------- theme ---------- */
function applyTheme(){ if (store.theme) document.documentElement.setAttribute("data-theme", store.theme); else document.documentElement.removeAttribute("data-theme"); }
applyTheme();
$("#themeBtn").addEventListener("click", () => {
  const dark = store.theme ? store.theme === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;
  store.theme = dark ? "light" : "dark"; save(); applyTheme();
});

/* ---------- helpers ---------- */
const esc = s => String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");
const norm = s => String(s).toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");
const TUTONUMS = D.tutos.map(t => t.num);
const PBMAP = {}; D.problems.forEach(p => PBMAP[p.code] = p);
function fmt(s){
  let x = esc(s); const codes = [];
  x = x.replace(/`([^`]+)`/g, (m,c) => { codes.push(c); return "\u0000" + (codes.length-1) + "\u0000"; });
  x = x.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
  x = x.replace(/\bP(\d{1,2}A?)\.(\d{1,2})\b/g, (m) => PBMAP[m] ? '<button type="button" class="pbref" data-pb="'+m+'" title="'+L('Voir le problème ','Open problem ')+m+'">'+m+'</button>' : m);
  x = x.replace(/\b(tutoriel|tutorial) (\d{2}A?)\b/g, (m,w,n) => TUTONUMS.includes(n) ? '<button type="button" class="linkbtn" data-tuto="'+n+'">'+w+' '+n+'</button>' : m);
  x = x.replace(/\u0000(\d+)\u0000/g, (m,i) => "<code>" + codes[+i] + "</code>");
  return x;
}
const WHERE = EN ? {ps:"PowerShell", psa:"PowerShell (Administrator)", ub:"Ubuntu (WSL terminal)", geo:"Ubuntu, with (geoenv) active", root:"Ubuntu (root session)", nano:"nano (inside the file)", file:"File ~/.bashrc (at the end)", wslconfig:"File .wslconfig (Windows Notepad)", py:"In the Python script", mac:"macOS Terminal", msg:"Message to send", win:"File Explorer (address bar)", key:"Keyboard"}
  : {ps:"PowerShell", psa:"PowerShell (Administrateur)", ub:"Ubuntu (terminal WSL)", geo:"Ubuntu, avec (geoenv) actif", root:"Ubuntu (session root)", nano:"nano (dans le fichier)", file:"Fichier ~/.bashrc (à la fin)", wslconfig:"Fichier .wslconfig (Bloc-notes Windows)", py:"Dans le script Python", mac:"Terminal macOS", msg:"Message à envoyer", win:"Explorateur Windows (barre d'adresse)", key:"Clavier"};
const PLAIN = new Set(["nano","file","wslconfig","msg","py"]);
function whereBadge(w){ return '<span class="where w-'+w+'">'+esc(WHERE[w]||w)+'</span>'; }
function subst(code){
  let c = code;
  if (store.win) c = c.replace(PH_WIN, store.win);
  if (store.linux) c = c.replace(PH_LIN, store.linux);
  return c;
}
function hlLine(line){
  // highlight placeholders <...> and substituted names
  let h = esc(line);
  h = h.replace(/&lt;([A-Za-z_][\w\-.]*)&gt;/g, '<span class="ph">&lt;$1&gt;</span>');
  return h;
}
let CMDS = []; // registry of copyable texts
function cmdBlock(w, code){
  const id = CMDS.push(code) - 1;
  const heredoc = /<< 'EOF'/.test(code);
  const plain = PLAIN.has(w) || heredoc || w === "key" || w === "win";
  const marks = [];
  let c = code;
  if (store.win) c = c.replace(PH_WIN, () => { marks.push(store.win); return "\u0001"+(marks.length-1)+"\u0001"; });
  if (store.linux) c = c.replace(PH_LIN, () => { marks.push(store.linux); return "\u0001"+(marks.length-1)+"\u0001"; });
  const lines = c.split("\n").map(l => {
    let h = hlLine(l).replace(/\u0001(\d+)\u0001/g, (m,i) => '<span class="ph set">'+esc(marks[+i])+'</span>');
    const t = l.trim();
    const cls = t === "" ? "cl blank" : (t.startsWith("#") && !heredoc ? "cl com" : "cl");
    return '<div class="'+cls+'">'+h+'</div>';
  }).join("");
  const needs = /<NomWindows>|<VotreNom>|<WindowsName>|<YourName>/.test(c) ? '<p class="cmd-note">'+L('Remplacez <b>&lt;NomWindows&gt;</b> par votre nom de dossier Windows, ou renseignez-le une fois dans l\'onglet <button type="button" class="linkbtn" data-go="chemins">Chemins</button> : toutes les commandes seront personnalisées.','Replace <b>&lt;WindowsName&gt;</b> with your Windows folder name, or enter it once in the <button type="button" class="linkbtn" data-go="chemins">Paths</button> tab: every command will then be personalised.')+'</p>' : "";
  return '<div class="cmd'+(plain?' plain':'')+'"><div class="cmd-head">'+whereBadge(w)+(w==="key"?"":'<button type="button" class="cmd-copy" data-cmd="'+id+'">'+L("Copier","Copy")+'</button>')+'</div><div class="cmd-body">'+lines+'</div>'+needs+'</div>';
}
function outBlock(t){ return '<div class="out"><span class="lbl">'+L("Ce que vous voyez (exemple)","What you see (example)")+'</span><pre>'+esc(t)+'</pre></div>'; }
const NOTELBL = EN ? {ok:"Expected result", warn:"Warning", tip:"Tip", danger:"Danger", fail:"If it does not work"} : {ok:"Résultat attendu", warn:"Attention", tip:"Astuce", danger:"Danger", fail:"Si ça ne marche pas"};
function noteBlock(n, t, lab){ return '<div class="note n-'+n+'"><span class="ni">'+(lab||NOTELBL[n])+'</span><div>'+fmt(t)+'</div></div>'; }
function table(h, rows){
  return '<div class="tw"><table class="resp"><thead><tr>'+h.map(x=>'<th>'+esc(x)+'</th>').join("")+'</tr></thead><tbody>'+
    rows.map(r => '<tr>'+r.map((c,i)=>'<td data-h="'+esc(h[i]||"")+'">'+fmt(c)+'</td>').join("")+'</tr>').join("")+'</tbody></table></div>';
}
function pkgTable(lvl){
  const rows = D.pkgs.filter(p => p[0] === lvl);
  if (lvl < 3) return table(L(["Package","À quoi il sert","Exemple d'usage en climat"],["Package","What it is for","Example of use in climate work"]), rows.map(p => ["**"+p[1]+"**", p[2], p[3]]));
  return '<div class="stack">' + rows.map(p => '<div class="stack" style="gap:6px"><p><strong>'+esc(p[1])+'</strong>'+L(" : ",": ")+fmt(p[2])+'</p>'+cmdBlock("geo", p[4])+'</div>').join("") + '</div>';
}
function item(it){
  switch(it.k){
    case "p": return '<p>'+fmt(it.t)+'</p>';
    case "ul": return '<ul class="l">'+it.i.map(x=>'<li>'+fmt(x)+'</li>').join("")+'</ul>';
    case "ol": return '<ol class="l">'+it.i.map(x=>'<li>'+fmt(x)+'</li>').join("")+'</ol>';
    case "table": return table(it.h, it.r);
    case "cmd": return cmdBlock(it.w, it.c);
    case "out": return outBlock(it.t);
    case "note": return noteBlock(it.n, it.t);
    case "pkgs": return pkgTable(it.lvl);
    case "goto": return '<div class="row"><button type="button" class="btn" data-go="'+it.view+'">'+esc(it.label)+'</button></div>';
    case "solution": return '<details class="solution"><summary><span class="ptitle">'+L("Voir la solution (seulement en cas de blocage)","Show the solution (only if you are stuck)")+'</span></summary><div class="dbody">'+cmdBlock("ub", it.c)+'</div></details>';
  }
  return "";
}
function toast(msg){ const t = $("#toast"); t.textContent = msg; t.hidden = false; clearTimeout(toast._t); toast._t = setTimeout(()=>{ t.hidden = true; }, 1800); }
function copyText(txt){
  const done = () => toast(L("Copié dans le presse-papiers","Copied to the clipboard"));
  const fallback = () => { const ta = document.createElement("textarea"); ta.value = txt; ta.setAttribute("readonly",""); ta.style.position="fixed"; ta.style.opacity="0"; document.body.appendChild(ta); ta.select(); let ok=false; try { ok = document.execCommand("copy"); } catch(e) {} ta.remove(); ok ? done() : toast(L("Sélectionnez le texte puis Ctrl + C","Select the text, then press Ctrl + C")); };
  try { navigator.clipboard.writeText(txt).then(done, fallback); } catch(e) { fallback(); }
}

/* ---------- progress ---------- */
function tutoProg(t){ const n = t.check.length; if (!n) return {n:0, d:0, st:"ref"}; const a = store.checks[t.num] || []; const d = a.filter(Boolean).length; return {n, d, st: d === 0 ? "none" : d === n ? "done" : "part"}; }
function globalProg(){ let n=0,d=0; D.tutos.forEach(t => { const p = tutoProg(t); n += p.n; d += p.d; }); return {n, d, pct: n ? Math.round(100*d/n) : 0}; }
function stateDot(t){ const p = tutoProg(t); return '<span class="state '+(p.st==="done"?"done":p.st==="part"?"part":"")+'" aria-hidden="true"></span>'; }
const ORDERED = ["00","01A","01","02","03","03A","04","05","06","09"];
function nextTuto(){ for (const n of ORDERED){ const t = D.tutos.find(x=>x.num===n); if (tutoProg(t).st !== "done") return t; } return null; }

/* ---------- header ---------- */
function renderStats(){
  const g = globalProg(), nx = nextTuto();
  $("#status").innerHTML = '<span class="eyebrow">'+L("Statut du parcours","Course status")+'</span><div class="st"><i></i>'+L("Version 2.0, ","Version 2.0, ")+D.tutos.length+L(" tutoriels"," tutorials")+'</div>'+
    '<div class="grid"><div><small>'+L("Dépannage","Troubleshooting")+'</small><b>'+D.problems.length+'</b><code>'+L("problèmes résolus","problems solved")+'</code></div><div><small>'+L("Aide-mémoire","Cheat sheet")+'</small><b>'+D.commands.length+'</b><code>'+L("commandes","commands")+'</code></div><div><small>'+L("Évaluation","Assessment")+'</small><b>'+D.qcm.length+'</b><code>'+L("questions de QCM","quiz questions")+'</code></div></div>'+
    '<div class="hbar"><i style="width:'+g.pct+'%"></i></div><p>'+L("Ma progression : ","My progress: ")+g.d+' / '+g.n+L(" points de contrôle ("," checkpoints (")+g.pct+L(" %). ","%). ")+(nx ? L("Prochaine étape : tutoriel ","Next step: tutorial ")+nx.num+'.' : L("Parcours terminé.","Course completed."))+'</p>';
}
const VIEWS = EN ? [["accueil","Home"],["parcours","Tutorials"],["documents","PDFs and tools"],["commandes","Commands"],["depannage","Troubleshooting"],["outils","Tools guide"],["chemins","Paths"],["qcm","Quiz"],["progression","My progress"]]
  : [["accueil","Accueil"],["parcours","Tutoriels"],["documents","PDF et outils"],["commandes","Commandes"],["depannage","Dépannage"],["outils","Mode d'emploi des outils"],["chemins","Chemins"],["qcm","QCM"],["progression","Ma progression"]];
function renderNav(view){ $("#nav").innerHTML = VIEWS.map(v=>'<button type="button" data-go="'+v[0]+'"'+' aria-pressed="'+(v[0]===view)+'"'+'>'+v[1]+'</button>').join(""); }

/* ---------- views ---------- */
const PHASES = [
  [L("1. Préparer Windows","1. Prepare Windows"), ["00","01A","01"]],
  [L("2. Prendre en main Ubuntu","2. Get started with Ubuntu"), ["02","03","03A","04"]],
  [L("3. Installer Python pour le climat","3. Install Python for climate data"), ["05","06","09"]],
  [L("4. Références à garder ouvertes","4. References to keep open"), ["07","08"]]];
function tnode(n){ const t = D.tutos.find(x=>x.num===n); return '<button type="button" class="tnode" data-tuto="'+n+'"><span class="tnum">'+n+'</span><span class="tt">'+esc(t.title)+'</span>'+stateDot(t)+'</button>'; }

function vAccueil(){
  const g = globalProg(), nx = nextTuto();
  const rules = EN ? [
    "**Read the error message**, especially the last lines: it almost always gives the cause.",
    "**Do not go to the next step if the current step failed**: errors add up.",
    "**Never put `sudo` in front of `conda` or `pip`.** `sudo` is only for `apt` commands.",
    "**Always activate geoenv** (`conda activate geoenv` or `geo`) before installing or running Python.",
    "**Strange behaviour?** Close Ubuntu, type `wsl --shutdown` in PowerShell, reopen Ubuntu.",
    "**There is no recycle bin in Linux**: `rm` deletes for good, including in Windows folders. Check with `pwd` and `ls` first."
  ] : [
    "**Lisez le message d'erreur**, surtout les dernières lignes : il indique presque toujours la cause.",
    "**Ne passez pas à l'étape suivante si l'étape en cours a échoué** : les erreurs s'additionnent.",
    "**Jamais `sudo` devant `conda` ou `pip`.** `sudo` sert uniquement aux commandes `apt`.",
    "**Toujours activer geoenv** (`conda activate geoenv` ou `geo`) avant d'installer ou d'exécuter du Python.",
    "**Comportement bizarre ?** Fermer Ubuntu, `wsl --shutdown` dans PowerShell, rouvrir Ubuntu.",
    "**Pas de corbeille sous Linux** : `rm` supprime définitivement, y compris dans les dossiers Windows. Vérifiez avec `pwd` et `ls` avant."];
  const notes = EN ? {ok:"What you should see if everything went well.",warn:"A point where students often make mistakes.",tip:"A shortcut or a good practice.",danger:"A command that can erase data. Read it twice before running it.",fail:"Link to the matching problem, for example P1.2 (P1 = tutorial 01, problem no. 2). Click the code to open it."}
    : {ok:"Ce que vous devez voir si tout s'est bien passé.",warn:"Un point où les étudiants se trompent souvent.",tip:"Un raccourci ou une bonne pratique.",danger:"Une commande qui peut effacer des données. Lisez deux fois avant de l'exécuter.",fail:"Renvoi vers le problème correspondant, par exemple P1.2 (P1 = tutoriel 01, problème n° 2). Cliquez sur le code pour l'ouvrir."};
  return `
  <section class="card stack">
    <div class="sectitle"><h2><span class="num">01</span>${L("Par où commencer ?","Where to start?")}</h2><span class="lbl">${L("Suivez les tutoriels dans l'ordre","Follow the tutorials in order")}</span></div>
    <p>${fmt(L("Chaque tutoriel suppose que le précédent est terminé et que sa liste **Point de contrôle** est entièrement cochée. Le tutoriel 01A n'est utile que si la virtualisation est « Désactivé ». Les tutoriels 07 et 08 sont des références à garder ouvertes.","Each tutorial assumes that the previous one is finished and that its **Checkpoint** list is fully ticked. Tutorial 01A is only needed if virtualization shows \"Disabled\". Tutorials 07 and 08 are references to keep open."))}</p>
    ${EN ? noteBlock("tip","The downloadable PDFs are in French. All their content is available here in English, in the Tutorials tab.") : ""}
    <div class="phases">${PHASES.map(ph=>'<div class="phase"><h3>'+esc(ph[0])+'</h3>'+ph[1].map(tnode).join("")+'</div>').join("")}</div>
    <div class="grid2" style="align-items:center">
      <div class="stack" style="gap:6px"><p class="lbl">${L("Ma progression : ","My progress: ")}${g.d} / ${g.n} ${L("points de contrôle","checkpoints")} (${g.pct} %)</p><div class="bar"><i style="width:${g.pct}%"></i></div></div>
      <div class="row" style="justify-content:flex-end">${nx ? '<button type="button" class="btn" data-tuto="'+nx.num+'">'+L("Continuer : tutoriel ","Continue: tutorial ")+nx.num+'</button>' : noteBlock("ok", L("Parcours terminé","Course completed"))}<button type="button" class="btn ghost" data-go="progression">${L("Voir le détail","See details")}</button></div>
    </div>
  </section>
  <section class="card stack">
    <h2><span class="num">02</span>${L("Chercher une commande, une erreur, un mot","Search for a command, an error, a word")}</h2>
    <input type="search" id="gsearch" placeholder="${L("Exemple : 0x80370102, conda init, Permission denied, alias m, ncdump...","Example: 0x80370102, conda init, Permission denied, alias m, ncdump...")}" aria-label="${L("Rechercher dans tout le parcours","Search the whole course")}" autocomplete="off">
    <div id="gres" class="stack"></div>
  </section>
  <div class="grid2">
    <section class="card stack">
      <h2><span class="num">03</span>${L("Où taper les commandes ?","Where to type the commands?")}</h2>
      <p>${fmt(L("Chaque commande indique l'endroit exact où la taper. **Les confondre est l'erreur la plus fréquente.**","Each command shows exactly where to type it. **Mixing them up is the most common mistake.**"))}</p>
      ${table(L(["Endroit","Début de ligne"],["Place","Start of the line"]),[[WHERE.psa,"`PS C:\\Windows\\system32>`"],["PowerShell",L("`PS C:\\Users\\VotreNom>`","`PS C:\\Users\\YourName>`")],[WHERE.ub,"`aminata@NOM-DU-PC:~$`".replace("NOM-DU-PC", L("NOM-DU-PC","PC-NAME"))],[WHERE.geo,"`(geoenv) aminata@NOM-DU-PC:~$`".replace("NOM-DU-PC", L("NOM-DU-PC","PC-NAME"))]])}
      <div class="row">${["psa","ps","ub","geo","root","nano","py"].map(whereBadge).join("")}</div>
      <p class="small muted">${L("Ne tapez jamais le début de ligne : il est affiché par l'ordinateur. Remplacez ce qui est entre chevrons, chevrons compris.","Never type the start of the line: the computer displays it. Replace what is between angle brackets, brackets included.")}</p>
    </section>
    <section class="card stack">
      <h2><span class="num">04</span>${L("Les règles d'or","The golden rules")}</h2>
      <ul class="l">${rules.map(r=>'<li>'+fmt(r)+'</li>').join("")}</ul>
    </section>
  </div>
  <section class="card stack">
    <h2><span class="num">05</span>${L("Lire les encadrés","Reading the boxes")}</h2>
    <div class="grid2">
      <div class="stack">${cmdBlock("ub","sudo apt update")}${outBlock("Reading package lists... Done")}</div>
      <div class="stack">${["ok","warn","tip","danger","fail"].map(n=>noteBlock(n, notes[n])).join("")}</div>
    </div>
  </section>`;
}

let TUTO = "00";
function vParcours(){
  const t = D.tutos.find(x=>x.num===TUTO) || D.tutos[0];
  const i = D.tutos.indexOf(t), prev = D.tutos[i-1], next = D.tutos[i+1];
  const pbs = D.problems.filter(p=>p.tuto===t.num);
  const p = tutoProg(t);
  return `
  <section class="card" style="gap:8px"><p class="lbl">${L("Choisir un tutoriel","Choose a tutorial")}</p><div class="toc tlist">${D.tutos.map(x=>'<button type="button" data-tuto="'+x.num+'" aria-pressed="'+(x.num===t.num)+'"><span class="n">'+x.num+'</span>'+esc(x.title.split(/ ?: /)[0].replace(/ \(.*\)$/,""))+' '+stateDot(x)+'</button>').join("")}</div></section>
  <section class="card thead">
    <p class="lbl">${L("Tutoriel ","Tutorial ")}${t.num} · ${esc(t.ver)}</p>
    <h2>${esc(t.title)}</h2>
    <p class="sub">${fmt(t.sub)}</p>
    <div class="row">${pdfBtn(t.num, L("Télécharger le PDF du tutoriel ","Download the PDF of tutorial ")+t.num+L(""," (French)"))}</div>
    <div class="meta">
      <div><b>${L("Objectif","Objective")}</b>${fmt(t.obj)}</div><div><b>${L("Durée estimée","Estimated time")}</b>${fmt(t.dur)}</div><div><b>${L("Prérequis","Prerequisites")}</b>${fmt(t.pre)}</div><div><b>${L("Où taper les commandes","Where to type the commands")}</b>${fmt(t.ou)}</div><div><b>${L("À la fin, vous aurez","At the end, you will have")}</b>${fmt(t.fin)}</div>
    </div>
  </section>
  ${t.blocks.length > 2 ? '<section class="card stack" style="gap:8px"><p class="lbl">'+L("Aller à","Go to")+'</p><div class="toc">'+t.blocks.map((b,k)=>'<button type="button" data-jump="b'+k+'"><span class="n">'+(k+1)+'</span>'+esc(b.h)+'</button>').join("")+(t.check.length?'<button type="button" data-jump="bcheck"><span class="n">✓</span>'+L("Point de contrôle","Checkpoint")+'</button>':'')+(pbs.length?'<button type="button" data-jump="bpb"><span class="n">'+pbs.length+'</span>'+L("Problèmes fréquents","Common problems")+'</button>':'')+'</div></section>' : ''}
  ${t.blocks.map((b,k)=>'<section class="card stack block"><h3 id="b'+k+'">'+esc(b.h)+'</h3>'+b.i.map(item).join("")+'</section>').join("")}
  ${t.check.length ? `<section class="card stack"><div class="sectitle"><h3 id="bcheck" style="font-size:1.1rem">${L("Point de contrôle","Checkpoint")}</h3><span class="lbl">${p.d} / ${p.n} ${L("coché(s)","ticked")}</span></div>
    <p class="small muted">${L("Cochez chaque point vérifié. Passez au tutoriel suivant seulement quand tout est coché.","Tick each point you have checked. Move on to the next tutorial only when everything is ticked.")}</p>
    ${checkList(t)}</section>` : ''}
  ${pbs.length ? '<section class="card stack"><h3 id="bpb" style="font-size:1.1rem">'+L("Problèmes fréquents et solutions","Common problems and solutions")+'</h3>'+pbs.map(pbDetails).join("")+'</section>' : ''}
  ${t.faq.length ? '<section class="card stack"><h3 style="font-size:1.1rem">'+L("Questions fréquentes","Frequently asked questions")+'</h3>'+t.faq.map(f=>'<details><summary><span class="pcode qtag">Q.</span><span class="ptitle">'+fmt(f.q)+'</span></summary><div class="dbody"><p>'+fmt(f.a)+'</p></div></details>').join("")+'</section>' : ''}
  <div class="pager">${prev?'<button type="button" class="btn ghost" data-tuto="'+prev.num+'">← '+prev.num+' · '+esc(prev.title)+'</button>':'<span></span>'}${next?'<button type="button" class="btn" data-tuto="'+next.num+'">'+next.num+' · '+esc(next.title)+' →</button>':''}</div>`;
}
function checkList(t){ const a = store.checks[t.num] || []; return '<ul class="check">'+t.check.map((c,k)=>'<li><label class="'+(a[k]?"on":"")+'"><input type="checkbox" id="chk-'+t.num+'-'+k+'" data-chk="'+t.num+'" data-k="'+k+'"'+(a[k]?" checked":"")+'><span>'+fmt(c)+'</span></label></li>').join("")+'</ul>'; }
function pbDetails(p, open){
  return '<details id="pb-'+p.code.replace(".","-")+'"'+(open?" open":"")+'><summary><span class="pcode">'+p.code+'</span><span class="ptitle">'+fmt(p.title)+'<small>'+esc(p.see[0].replace(/`/g,""))+'</small></span></summary><div class="dbody">'+
    '<p class="lbl">'+L("Ce que vous voyez","What you see")+'</p><div class="see">'+p.see.map(s=>'<div>'+fmt(s)+'</div>').join("")+'</div>'+
    '<p class="lbl">'+L("Pourquoi","Why")+'</p><p>'+fmt(p.why)+'</p><p class="lbl">'+L("Solution","Solution")+'</p>'+p.fix.map(item).join("")+
    '<p class="small muted">'+L("Tutoriel ","Tutorial ")+p.tuto+' · <button type="button" class="linkbtn" data-tuto="'+p.tuto+'">'+L("ouvrir le tutoriel ","open tutorial ")+p.tuto+'</button></p></div></details>';
}

let CCAT = "all", CQ = "";
function vCommandes(){
  return `<section class="card stack">
    <div class="sectitle"><h2><span class="num">07</span>${L("Aide-mémoire des commandes","Command cheat sheet")}</h2><span class="lbl">${L("Tutoriel 07","Tutorial 07")}</span></div>
    <p class="small muted">${fmt(L("`<...>` est à remplacer par votre valeur. Le badge de couleur indique où taper la commande : PowerShell (bleu), Ubuntu (orange), Ubuntu avec geoenv (vert).","Replace `<...>` with your own value. The coloured badge shows where to type the command: PowerShell (blue), Ubuntu (orange), Ubuntu with geoenv (green)."))}</p>
    <input type="search" id="csearch" placeholder="${L("Chercher : copier, NetCDF, mise à jour, jupyter...","Search: copy, NetCDF, update, jupyter...")}" value="${esc(CQ)}" aria-label="${L("Chercher une commande","Search for a command")}" autocomplete="off">
    <div class="row">${[["all",L("Toutes","All")]].concat(D.cmdcats).map(c=>'<button type="button" class="chip" data-ccat="'+c[0]+'" aria-pressed="'+(CCAT===c[0])+'">'+esc(c[1])+'</button>').join("")}</div>
    <div id="clist"></div></section>`;
}
function renderCmdList(){
  const q = norm(CQ).split(/\s+/).filter(Boolean);
  const rows = D.commands.filter(c => (CCAT==="all"||c[0]===CCAT) && q.every(w => norm(c.join(" ")).includes(w)));
  const box = $("#clist"); if (!box) return;
  if (!rows.length){ box.innerHTML = '<p class="muted">'+L("Aucune commande ne correspond. Essayez un autre mot ou la catégorie « Toutes ».","No command matches. Try another word or the \"All\" category.")+'</p>'; return; }
  let html = "", last = "";
  rows.forEach(c => {
    if (c[0] !== last && CCAT==="all"){ html += '<p class="lbl" style="margin-top:14px">'+esc(D.cmdcats.find(x=>x[0]===c[0])[1])+'</p>'; last = c[0]; }
    const id = CMDS.push(subst(c[2])) - 1;
    html += '<div class="cmdrow"><div class="stack" style="gap:6px"><div class="row" style="justify-content:space-between">'+whereBadge(c[1])+(c[1]==="key"?"":'<button type="button" class="mini" data-cmd="'+id+'">'+L("Copier","Copy")+'</button>')+'</div><div class="code">'+hlLine(subst(c[2]))+'</div></div><div class="meta2"><span>'+fmt(c[3])+'</span>'+(c[4]?'<span class="muted small">'+fmt(c[4])+'</span>':'')+'</div></div>';
  });
  box.innerHTML = '<p class="small muted">'+rows.length+L(" commande(s)"," command(s)")+'</p>' + html;
}

let PT = "all", PQ = "", POPEN = "";
function vDepannage(){
  const tus = ["all"].concat([...new Set(D.problems.map(p=>p.tuto))]);
  return `<section class="card stack">
    <div class="sectitle"><h2><span class="num">08</span>${L("Dépannage : index de toutes les erreurs","Troubleshooting: index of all errors")}</h2><span class="lbl">${L("Tutoriel 08","Tutorial 08")}</span></div>
    <p>${fmt(L("Copiez un mot du message d'erreur (par exemple `Permission denied` ou `0x80370102`) dans la recherche. Chaque fiche donne ce que vous voyez, pourquoi, et la solution.","Copy a word from the error message (for example `Permission denied` or `0x80370102`) into the search box. Each card gives what you see, why, and the solution."))}</p>
    <input type="search" id="psearch" placeholder="${L("Coller ici un mot du message d'erreur","Paste a word from the error message here")}" value="${esc(PQ)}" aria-label="${L("Chercher une erreur","Search for an error")}" autocomplete="off">
    <div class="row">${tus.map(t=>'<button type="button" class="chip" data-pt="'+t+'" aria-pressed="'+(PT===t)+'">'+(t==="all"?L("Tous les tutoriels","All tutorials"):L("Tutoriel ","Tutorial ")+t)+'</button>').join("")}</div>
    <details><summary><span class="pcode">0x…</span><span class="ptitle">${L("Recherche rapide par code d'erreur Windows","Quick lookup by Windows error code")}</span></summary><div class="dbody">${table(L(["Code","Problème","Cause"],["Code","Problem","Cause"]), D.wincodes.map(w=>["`"+w[0]+"`", w[1], w[2]]))}</div></details>
    <div id="plist" class="stack"></div></section>
    <section class="card stack"><h2>${L("Méthode de dépannage en 7 étapes","7-step troubleshooting method")}</h2>${D.tutos.find(t=>t.num==="08").blocks[0].i.slice(0,1).map(item).join("")}</section>`;
}
function renderPbList(){
  const q = norm(PQ).split(/\s+/).filter(Boolean);
  const rows = D.problems.filter(p => (PT==="all"||p.tuto===PT) && q.every(w => norm([p.code,p.title,p.see.join(" "),p.why,JSON.stringify(p.fix)].join(" ")).includes(w)));
  const box = $("#plist"); if (!box) return;
  box.innerHTML = rows.length ? '<p class="small muted">'+rows.length+L(" problème(s)"," problem(s)")+'</p>' + rows.map(p=>pbDetails(p, p.code===POPEN)).join("") : '<p class="muted">'+L("Aucun problème ne correspond. Essayez un mot plus court du message, ou « Tous les tutoriels ».","No problem matches. Try a shorter word from the message, or \"All tutorials\".")+'</p>';
}

function fsize(n){ return n > 1e6 ? NUM((n/1e6).toFixed(1))+L(" Mo"," MB") : Math.round(n/1e3)+L(" ko"," kB"); }
function pdfBtn(num, label){ const f = D.files.pdf[num]; if (!f) return ""; return '<a class="btn ghost" href="'+encodeURI(f.name)+'" target="_blank" rel="noopener" download>'+esc(label)+' · '+fsize(f.size)+'</a>'; }
function toolBtn(name){ const f = D.files.tools[name]; if (!f) return ""; return '<a class="btn" href="'+encodeURI(f.name)+'" target="_blank" rel="noopener" download>'+L("Télécharger ","Download ")+esc(f.name)+' · '+fsize(f.size)+'</a>'; }
function vDocuments(){
  const z = D.files.zip;
  return `<section class="card">
    <div class="sectitle"><h2><span class="num">PDF</span>${L("Les tutoriels et les outils à télécharger","Tutorials and tools to download")}</h2><span class="lbl">Version 2.0</span></div>
    <p class="lead">${L("Téléchargez les tutoriels pour les lire hors ligne ou les imprimer, et les trois fichiers outils pour les lancer dans Ubuntu. Le contenu des PDF est repris intégralement dans l'onglet Tutoriels.","Download the tutorials to read them offline or print them, and the three tool files to run them in Ubuntu. The full content of the PDFs is also in the Tutorials tab.")}</p>
    ${EN ? noteBlock("warn","The PDF tutorials are written in French. The complete English version of every tutorial is in the Tutorials tab. The tool files work the same in both languages; the messages they print are in French.") : ""}
    ${z ? '<div class="row"><a class="btn" href="'+encodeURI(z.name)+'" target="_blank" rel="noopener" download>'+L("Tout télécharger en un fichier ZIP","Download everything as one ZIP file")+' · '+fsize(z.size)+'</a><span class="small muted">'+L("Un dossier « PDF » (12 tutoriels) et un dossier « outils » (3 fichiers).","A \"PDF\" folder (12 tutorials) and an \"outils\" (tools) folder (3 files).")+'</span></div>' : ''}
  </section>
  <section class="card">
    <h2><span class="num">12</span>${L("Tutoriels en PDF","Tutorials as PDF")}</h2>
    <div class="docs">${D.tutos.map(t => { const f = D.files.pdf[t.num]; return '<div class="doc"><div class="dt"><span class="tnum">'+t.num+'</span><b>'+esc(t.title)+'</b></div><small>'+esc(f ? f.name : "")+'</small><div class="row">'+pdfBtn(t.num, L("PDF","PDF (French)"))+'<button type="button" class="btn ghost" data-tuto="'+t.num+'">'+L("Lire ici","Read here")+'</button></div></div>'; }).join("")}</div>
  </section>
  <section class="card">
    <h2><span class="num">03</span>${L("Fichiers outils","Tool files")}</h2>
    ${noteBlock("warn", L("Enregistrez ces fichiers dans votre dossier Téléchargements de Windows, **sans les renommer**, puis lancez-les dans Ubuntu comme indiqué dans l'onglet « Mode d'emploi des outils ». Ne les ouvrez pas avec le Bloc-notes ou Word (P9.3).","Save these files in your Windows Downloads folder **without renaming them**, then run them in Ubuntu as explained in the \"Tools guide\" tab. Do not open them with Notepad or Word (P9.3)."))}
    <div class="docs">${D.outils.map(o => '<div class="doc tool"><div class="dt"><span class="tnum">'+o.id+'</span><b>'+esc(o.file)+'</b></div><small>'+esc(o.type)+L(" · à lancer avec : "," · run with: ")+esc(o.mot)+' '+esc(o.file)+'</small><p class="small">'+fmt(o.quand)+'</p><div class="row">'+toolBtn(o.file)+'</div></div>').join("")}</div>
  </section>`;
}
function vOutils(){
  const sum = EN ? "# Tool 04 (after tutorial 03)\ncd /mnt/c/Users/<WindowsName>/Downloads\nbash outil_04_installer_alias.sh\nsource ~/.bashrc\n# Tool 05 (after Miniconda, tutorial 05 steps 1 to 6)\ndl\nconda env create -f outil_05_geoenv.yml\nconda activate geoenv\n# Tool 06 (at the end, after tutorial 06 step 1)\ngeo\ndl\npython outil_06_verifier_geoenv.py\nexplorer.exe test_geoenv.png"
    : "# Outil 04 (après le tutoriel 03)\ncd /mnt/c/Users/<NomWindows>/Downloads\nbash outil_04_installer_alias.sh\nsource ~/.bashrc\n# Outil 05 (après Miniconda, tutoriel 05 étapes 1 à 6)\ndl\nconda env create -f outil_05_geoenv.yml\nconda activate geoenv\n# Outil 06 (à la fin, après le tutoriel 06 étape 1)\ngeo\ndl\npython outil_06_verifier_geoenv.py\nexplorer.exe test_geoenv.png";
  const t09 = D.tutos.find(t=>t.num==="09");
  return `<section class="card stack">
    <div class="sectitle"><h2><span class="num">09</span>${L("Mode d'emploi des trois outils du cours","How to use the three course tools")}</h2><span class="lbl">${L("Tutoriel 09","Tutorial 09")}</span></div>
    <p>${fmt(L("Un **fichier outil** est une liste de commandes déjà écrites à l'avance. On ne l'ouvre pas et on ne copie pas son contenu : on demande à Ubuntu de l'exécuter en tapant un mot devant son nom.","A **tool file** is a list of commands written in advance. You do not open it and you do not copy its content: you ask Ubuntu to run it by typing a word in front of its name."))}</p>
    ${table(L(["Fichier","Type","Mot à taper devant le nom","Commande complète"],["File","Type","Word to type before the name","Full command"]), D.outils.map(o=>["`"+o.file+"`", o.type, "`"+o.mot+"`", "`"+o.mot+" "+o.file+"`"]))}
    ${noteBlock("warn", L("Ne double-cliquez pas sur ces fichiers dans Windows : Windows ne sait pas les ouvrir, c'est normal. Ne les ouvrez pas non plus avec le Bloc-notes ou Word : un enregistrement par ces logiciels peut les abîmer (P9.3).","Do not double-click these files in Windows: Windows cannot open them, this is normal. Do not open them with Notepad or Word either: saving them with these programs can damage them (P9.3)."))}
    <h3>${L("L'ordre à respecter","The order to follow")}</h3>
    ${table(L(["Ordre","Action","Tutoriel"],["Order","Action","Tutorial"]), D.order.map(o=>[o[0], o[1], o[2]]))}
    ${noteBlock("warn", L("Respectez cet ordre : l'outil 05 ne fonctionne pas sans Miniconda, et l'outil 06 ne fonctionne pas sans geoenv.","Follow this order: tool 05 does not work without Miniconda, and tool 06 does not work without geoenv."))}
    ${noteBlock("tip", L("Préparez les fichiers une seule fois : enregistrez les trois fichiers reçus (WhatsApp, e-mail, clé USB) dans votre dossier Téléchargements de Windows, sans les renommer. Votre <NomWindows> est le nom affiché par `ls /mnt/c/Users/` (sans All Users, Default, Default User, Public).","Prepare the files once: save the three files you received (WhatsApp, e-mail, USB stick) in your Windows Downloads folder without renaming them. Your <WindowsName> is the name shown by `ls /mnt/c/Users/` (ignore All Users, Default, Default User, Public)."))}
  </section>
  ${D.outils.map(o=>`<section class="card stack">
    <div class="sectitle"><h2><span class="num">${o.id}</span>${esc(o.file)}</h2><span class="lbl">${esc(o.type)}</span></div>
    <p><strong>${L("Quand :","When:")}</strong> ${fmt(o.quand)}</p><p><strong>${L("Ce qu'il fait :","What it does:")}</strong> ${fmt(o.fait)}</p>
    <div class="row">${toolBtn(o.file)}</div>
    <ol class="steps">${o.steps.map(s=>'<li><div class="sbody"><h3 style="margin:0">'+esc(s[0])+'</h3>'+(s[1]?'<p>'+fmt(s[1])+'</p>':'')+(s[2]?cmdBlock(o.id==="06"&&s[2]!=="geo\ndl"?"geo":"ub", s[2]):"")+(s[3]?noteBlock("ok", s[3]):"")+'</div></li>').join("")}</ol>
    <p class="lbl">${L("Si ça ne marche pas","If it does not work")}</p><div class="stack">${o.pb.map(c=>pbDetails(PBMAP[c])).join("")}</div>
  </section>`).join("")}
  <section class="card stack"><h2>${L("Résumé : toutes les lignes à taper","Summary: every line to type")}</h2>${cmdBlock("ub", sum)}
  <div class="sectitle"><h3>${L("Point de contrôle final","Final checkpoint")}</h3><span class="lbl">${tutoProg(t09).d} / ${t09.check.length} ${L("coché(s)","ticked")}</span></div>${checkList(t09)}</section>`;
}

/* paths */
const WINFOLD = {"bureau":"Desktop","telechargements":"Downloads","images":"Pictures","musique":"Music","videos":"Videos"};
function win2lin(s){
  s = s.trim().replace(/^"|"$/g,""); if (!s) return null;
  let m, out, warn = [];
  if ((m = s.match(/^\\\\(?:wsl\.localhost|wsl\$)\\[^\\]+\\?(.*)$/i))) out = "/" + m[1].replace(/\\/g,"/");
  else if ((m = s.match(/^([A-Za-z]):[\\/]?(.*)$/))) out = "/mnt/" + m[1].toLowerCase() + (m[2] ? "/" + m[2].replace(/\\/g,"/") : "");
  else return {err: L("Un chemin Windows commence par une lettre de disque (C:\\...) ou par \\\\wsl.localhost\\...","A Windows path starts with a drive letter (C:\\...) or with \\\\wsl.localhost\\...")};
  out = out.replace(/\/+$/,"").replace(/\/{2,}/g,"/") || "/";
  out.split("/").forEach(seg => { const k = norm(seg); if (WINFOLD[k]) warn.push(L("« "+seg+" » est le nom affiché par l'Explorateur. Dans Ubuntu, le dossier s'appelle « "+WINFOLD[k]+" » (tutoriel 03, étape 2).","\""+seg+"\" is the name displayed by a French-language File Explorer. The real folder name, shown by Ubuntu, is \""+WINFOLD[k]+"\" (tutorial 03, step 2).")); });
  if (/^\/mnt\/c\/Users\/[^/]+\/OneDrive/i.test(out)) warn.push(L("Dossier OneDrive : les fichiers « en ligne uniquement » provoquent des erreurs de lecture (P3.3).","OneDrive folder: \"online-only\" files cause read errors (P3.3)."));
  return {out, warn, q: /\s/.test(out)};
}
function lin2win(s, user){
  s = s.trim().replace(/^"|"$/g,""); if (!s) return null;
  let m;
  if ((m = s.match(/^\/mnt\/([a-z])(\/.*)?$/i))) return {out: m[1].toUpperCase() + ":" + ((m[2]||"\\").replace(/\//g,"\\"))};
  if (s === "~" || s.startsWith("~/")) s = "/home/" + (user || PHL) + s.slice(1);
  if (s.startsWith("/")) return {out: "\\\\wsl.localhost\\Ubuntu" + s.replace(/\//g,"\\"), note: L("Adresse à coller dans la barre d'adresse de l'Explorateur. Remplacez Ubuntu par le nom affiché par wsl -l -v s'il diffère (par exemple Ubuntu-24.04).","Paste this address into the File Explorer address bar. Replace Ubuntu with the name shown by wsl -l -v if it is different (for example Ubuntu-24.04).")};
  return {err: L("Un chemin Ubuntu complet commence par / ou ~ (tutoriel 03A, partie 2).","A full Ubuntu path starts with / or ~ (tutorial 03A, part 2).")};
}
function vChemins(){
  const exW = EN ? ["C:\\Users\\Aminata\\Downloads","D:\\Data\\CHIRPS","C:\\Users\\Aminata\\Documents\\My data","C:\\Users\\Aminata\\Bureau"] : ["C:\\Users\\Aminata\\Downloads","D:\\Donnees\\CHIRPS","C:\\Users\\Aminata\\Documents\\Mes donnees","C:\\Users\\Aminata\\Bureau"];
  const exL = ["/mnt/c/Users/Aminata/Documents/cours_climat", EN ? "/mnt/d/Data/CHIRPS" : "/mnt/d/Donnees/CHIRPS","~/entrainement","/home/aminata/miniconda3"];
  return `<section class="card stack">
    <div class="sectitle"><h2>${L("Personnaliser toutes les commandes","Personalise every command")}</h2><span class="lbl">${L("Une seule fois","Only once")}</span></div>
    <p>${fmt(L("Indiquez votre nom de dossier Windows (le nom affiché par `ls /mnt/c/Users/`, majuscules comprises) et, si vous voulez, votre nom d'utilisateur Linux. Toutes les commandes du tableau de bord qui contiennent `<NomWindows>` ou `<votre_nom_linux>` seront écrites avec vos noms, en vert, et copiées ainsi.","Enter your Windows folder name (the name shown by `ls /mnt/c/Users/`, capital letters included) and, if you wish, your Linux user name. Every command of the dashboard that contains `<WindowsName>` or `<your_linux_name>` will then be written with your names, in green, and copied that way."))}</p>
    <div class="grid2">
      <label class="stack" style="gap:4px"><span class="lbl">${L("Mon nom de dossier Windows","My Windows folder name")}</span><input type="text" id="inWin" value="${esc(store.win)}" placeholder="${L("Exemple : Aminata","Example: Aminata")}" autocomplete="off" spellcheck="false"></label>
      <label class="stack" style="gap:4px"><span class="lbl">${L("Mon nom d'utilisateur Linux","My Linux user name")}</span><input type="text" id="inLin" value="${esc(store.linux)}" placeholder="${L("Exemple : aminata","Example: aminata")}" autocomplete="off" spellcheck="false"></label>
    </div>
    <div id="nameMsg" class="stack"></div>
  </section>
  <div class="grid2">
  <section class="card conv">
    <h2>Windows → Ubuntu</h2>
    <p class="small muted">${fmt(L("Collez un chemin de la barre d'adresse de l'Explorateur, par exemple `C:\\Users\\Aminata\\Documents\\cours_climat`.","Paste a path from the File Explorer address bar, for example `C:\\Users\\Aminata\\Documents\\cours_climat`."))}</p>
    <input type="text" id="w2l" placeholder="C:\\Users\\Aminata\\Documents" autocomplete="off" spellcheck="false">
    <div class="row">${exW.map(x=>'<button type="button" class="chip" data-ex-w="'+esc(x)+'">'+esc(x)+'</button>').join("")}</div>
    <div id="w2lout" class="stack"></div>
  </section>
  <section class="card conv">
    <h2>Ubuntu → Windows</h2>
    <p class="small muted">${fmt(L("Collez un chemin affiché par `pwd`, par exemple `/mnt/c/Users/Aminata/Documents` ou `~/miniconda3`.","Paste a path shown by `pwd`, for example `/mnt/c/Users/Aminata/Documents` or `~/miniconda3`."))}</p>
    <input type="text" id="l2w" placeholder="/mnt/c/Users/Aminata/Documents" autocomplete="off" spellcheck="false">
    <div class="row">${exL.map(x=>'<button type="button" class="chip" data-ex-l="'+esc(x)+'">'+esc(x)+'</button>').join("")}</div>
    <div id="l2wout" class="stack"></div>
  </section></div>
  <section class="card stack"><h2>${L("Les trois règles de conversion","The three conversion rules")}</h2>
    ${table(L(["Dans Windows","Dans Ubuntu"],["In Windows","In Ubuntu"]),[["`C:\\Users\\Aminata\\Documents`","`/mnt/c/Users/Aminata/Documents`"],[L("`D:\\Donnees\\CHIRPS`","`D:\\Data\\CHIRPS`"),L("`/mnt/d/Donnees/CHIRPS`","`/mnt/d/Data/CHIRPS`")],["`\\\\wsl.localhost\\Ubuntu\\home\\aminata`",L("`/home/aminata` ou `~`","`/home/aminata` or `~`")]])}
    <ul class="l">${(EN ? ["the Windows backslash `\\` becomes `/`;","`C:` becomes `/mnt/c` (always lower case);","Ubuntu is case-sensitive: `Documents` and `documents` are different. A name containing a space goes between quotes."] : ["la barre `\\` de Windows devient `/` ;","`C:` devient `/mnt/c` (toujours en minuscule) ;","Ubuntu respecte les majuscules : `Documents` et `documents` sont différents. Un nom avec un espace se met entre guillemets."]).map(x=>'<li>'+fmt(x)+'</li>').join("")}</ul>
  </section>`;
}
function convRender(){
  const a = $("#w2l"), b = $("#l2w"); if (!a) return;
  const r1 = win2lin(a.value), o1 = $("#w2lout");
  if (!r1) o1.innerHTML = "";
  else if (r1.err) o1.innerHTML = noteBlock("warn", r1.err);
  else { const cdc = "cd " + (r1.q ? '"'+r1.out+'"' : r1.out); o1.innerHTML = '<p class="lbl">'+L("Chemin Ubuntu","Ubuntu path")+'</p><div class="convout">'+esc(r1.out)+'</div>'+cmdBlock("ub", cdc)+(r1.q?noteBlock("warn", L("Le chemin contient un espace : il est mis entre guillemets dans la commande.","The path contains a space: it is put between quotes in the command.")):"")+r1.warn.map(w=>noteBlock("tip", w)).join(""); }
  const r2 = lin2win(b.value, store.linux), o2 = $("#l2wout");
  if (!r2) o2.innerHTML = "";
  else if (r2.err) o2.innerHTML = noteBlock("warn", r2.err);
  else o2.innerHTML = '<p class="lbl">'+L("Chemin Windows","Windows path")+'</p><div class="convout">'+esc(r2.out)+'</div><div class="row"><button type="button" class="mini" data-copy="'+esc(r2.out)+'">'+L("Copier","Copy")+'</button></div>'+(r2.note?'<p class="small muted">'+esc(r2.note)+'</p>':"");
}
function nameMsg(){
  const m = $("#nameMsg"); if (!m) return; const w = store.win; let h = "";
  if (w && /\s/.test(w)) h += noteBlock("warn", L("Votre nom de dossier Windows contient un espace. Dans les commandes, mettez le chemin complet entre guillemets, par exemple `cd \"/mnt/c/Users/"+w+"/Downloads\"` (P9.2).","Your Windows folder name contains a space. In commands, put the full path between quotes, for example `cd \"/mnt/c/Users/"+w+"/Downloads\"` (P9.2)."));
  if (w && ["User","Default","Public","All Users","Default User"].includes(w)) h += noteBlock("warn", L("« "+w+" » est un dossier système ou le nom du PC de l'auteur. Vérifiez votre vrai nom avec `ls /mnt/c/Users/` (P4.5).","\""+w+"\" is a system folder or the name on the author's PC. Check your real name with `ls /mnt/c/Users/` (P4.5)."));
  if (store.linux && !/^[a-z][a-z0-9_-]*$/.test(store.linux)) h += noteBlock("warn", L("Un nom d'utilisateur Linux ne contient que des minuscules et des chiffres, sans espace ni accent, et commence par une lettre (P2.1).","A Linux user name contains only lower-case letters and digits, with no space or accent, and starts with a letter (P2.1)."));
  if (w && !h) h = noteBlock("ok", L("Les commandes affichent maintenant `/mnt/c/Users/"+w+"/...`. Vérifiez qu'elles correspondent à `ls /mnt/c/Users/` sur votre PC.","Commands now show `/mnt/c/Users/"+w+"/...`. Check that this matches `ls /mnt/c/Users/` on your PC."));
  m.innerHTML = h;
}

/* QCM */
const Q = {mode:"train", n:10, tutos:new Set(), run:null};
function shuffle(a){ for (let i=a.length-1;i>0;i--){ const j=Math.floor(Math.random()*(i+1)); [a[i],a[j]]=[a[j],a[i]]; } return a; }
const qTutos = [...new Set(D.qcm.map(q=>q[0]))];
function vQcm(){
  if (Q.run) return qRunView();
  const pool = D.qcm.filter(q=>!Q.tutos.size||Q.tutos.has(q[0])).length;
  const nq = Math.min(Q.n||pool,pool);
  return `<section class="card stack">
    <div class="sectitle"><h2>${L("QCM et examen blanc","Quiz and mock exam")}</h2><span class="lbl">${D.qcm.length} ${L("questions, toutes tirées des tutoriels","questions, all taken from the tutorials")}</span></div>
    <p>${fmt(L("**Entraînement** : la correction et l'explication s'affichent après chaque réponse. **Examen** : chronomètre, correction à la fin, note sur 20 arrondie au demi-point. L'ordre des questions et des réponses change à chaque essai.","**Practice**: the correct answer and its explanation appear after each answer. **Exam**: timer, correction at the end, mark out of 20 rounded to the nearest half point. The order of questions and answers changes at every attempt."))}</p>
    <div class="stack" style="gap:6px"><p class="lbl">${L("Mode","Mode")}</p><div class="row">${[["train",L("Entraînement","Practice")],["exam",L("Examen","Exam")]].map(m=>'<button type="button" class="chip" data-qmode="'+m[0]+'" aria-pressed="'+(Q.mode===m[0])+'">'+m[1]+'</button>').join("")}</div></div>
    <div class="stack" style="gap:6px"><p class="lbl">${L("Nombre de questions","Number of questions")}</p><div class="row">${[10,20,40,0].map(n=>'<button type="button" class="chip" data-qn="'+n+'" aria-pressed="'+(Q.n===n)+'">'+(n||L("Toutes","All"))+'</button>').join("")}</div></div>
    <div class="stack" style="gap:6px"><p class="lbl">${L("Tutoriels concernés (aucun choisi = tous)","Tutorials covered (none selected = all)")}</p><div class="row">${qTutos.map(t=>'<button type="button" class="chip" data-qt="'+t+'" aria-pressed="'+Q.tutos.has(t)+'">'+L("Tutoriel ","Tutorial ")+t+' ('+D.qcm.filter(q=>q[0]===t).length+')</button>').join("")}</div></div>
    <div class="row"><button type="button" class="btn" data-qstart="1">${L("Commencer","Start")} (${nq} question${nq>1?"s":""})</button><span class="small muted">${pool} ${L("question(s) disponibles avec ce choix","question(s) available with this choice")}</span></div>
  </section>
  ${store.hist.length ? '<section class="card stack"><h2>'+L("Historique","History")+'</h2>'+table(L(["Date","Mode","Questions","Note"],["Date","Mode","Questions","Mark"]), store.hist.slice(-10).reverse().map(h=>[h.d, h.m==="exam"?L("Examen","Exam"):L("Entraînement","Practice"), String(h.n), NUM(h.s)+" / 20"]))+'</section>' : ''}`;
}
function qStart(){
  let pool = D.qcm.filter(q=>!Q.tutos.size||Q.tutos.has(q[0]));
  pool = shuffle(pool.slice()); if (Q.n) pool = pool.slice(0, Q.n);
  Q.run = {qs: pool.map(q=>({q, order: shuffle([0,1,2,3]), ans:null})), i:0, done:false, t0: Date.now(), confirm:false};
  if (Q.mode==="exam") qTick();
}
function qTick(){ clearInterval(Q._iv); Q._iv = setInterval(()=>{ const el=$("#qtimer"); if (!Q.run||Q.run.done){ clearInterval(Q._iv); return; } if (el) el.textContent = mmss(Date.now()-Q.run.t0); }, 1000); }
const mmss = ms => { const s=Math.floor(ms/1000); return String(Math.floor(s/60)).padStart(2,"0")+":"+String(s%60).padStart(2,"0"); };
function qRunView(){
  const R = Q.run;
  if (R.done) return qResult();
  const it = R.qs[R.i], q = it.q, show = Q.mode==="train" && it.ans!==null;
  const answered = R.qs.filter(x=>x.ans!==null).length;
  return `<section class="card q">
    <div class="sectitle"><span class="lbl">Question ${R.i+1} / ${R.qs.length} · ${L("Tutoriel ","Tutorial ")}${q[0]}</span><span class="lbl">${Q.mode==="exam"?L("Temps ","Time ")+'<span class="timer" id="qtimer">'+mmss(Date.now()-R.t0)+'</span> · ':''}${answered} ${L("répondue(s)","answered")}</span></div>
    <div class="bar"><i style="width:${Math.round(100*(R.i+1)/R.qs.length)}%"></i></div>
    <h3 style="font-size:1.12rem">${fmt(q[1])}</h3>
    <div class="stack" style="gap:8px">${it.order.map((o,k)=>{ let cls="opt"; if (show){ if(o===0) cls+=" good"; else if(o===it.ans) cls+=" bad"; } else if (it.ans===o) cls+=" sel"; return '<button type="button" class="'+cls+'" data-qa="'+o+'"'+(show?" disabled":"")+'><span class="k">'+"ABCD"[k]+'</span><span>'+fmt(q[2][o])+'</span></button>'; }).join("")}</div>
    ${show ? noteBlock(it.ans===0?"ok":"danger", q[4], it.ans===0?L("Correct","Correct"):L("Incorrect","Incorrect")) : ""}
    ${R.confirm ? '<div class="confirm"><span>'+(R.qs.length-answered)+L(" question(s) sans réponse. Terminer quand même ?"," unanswered question(s). Finish anyway?")+'</span><button type="button" class="btn" data-qend="force">'+L("Oui, terminer","Yes, finish")+'</button><button type="button" class="btn ghost" data-qend="cancel">'+L("Continuer","Continue")+'</button></div>' : ''}
    <div class="pager"><div class="row"><button type="button" class="btn ghost" data-qnav="-1"${R.i===0?" disabled":""}>← ${L("Précédente","Previous")}</button>${R.i<R.qs.length-1?'<button type="button" class="btn" data-qnav="1">'+L("Suivante","Next")+' →</button>':''}</div>
    <div class="row"><button type="button" class="btn${R.i===R.qs.length-1?"":" ghost"}" data-qend="ask">${L("Terminer et voir la note","Finish and see the mark")}</button><button type="button" class="btn ghost" data-qend="quit">${L("Abandonner","Give up")}</button></div></div>
  </section>
  <section class="card stack" style="gap:8px"><p class="lbl">${L("Aller à la question","Go to question")}</p><div class="row">${R.qs.map((x,k)=>'<button type="button" class="chip'+(x.ans!==null&&k!==R.i?' answered':'')+'" data-qgo="'+k+'" aria-pressed="'+(k===R.i)+'" style="min-width:2.6em">'+(k+1)+'</button>').join("")}</div></section>`;
}
function qScore(){ const R=Q.run; const ok=R.qs.filter(x=>x.ans===0).length; return {ok, n:R.qs.length, s: Math.round(ok/R.qs.length*20*2)/2}; }
function qResult(){
  const R = Q.run, sc = qScore();
  const by = {}; R.qs.forEach(x=>{ const t=x.q[0]; by[t]=by[t]||{ok:0,n:0}; by[t].n++; if(x.ans===0) by[t].ok++; });
  const weak = Object.entries(by).filter(([t,v])=>v.ok/v.n<0.6).map(([t])=>t);
  return `<section class="card stack">
    <div class="sectitle"><h2>${L("Résultat","Result")}</h2><span class="lbl">${Q.mode==="exam"?L("Examen · durée ","Exam · time ")+mmss(R.t1-R.t0):L("Entraînement","Practice")}</span></div>
    <div class="row" style="gap:18px"><span class="score">${NUM(sc.s)} / 20</span><span>${sc.ok} ${L("bonne(s) réponse(s) sur","correct answer(s) out of")} ${sc.n}</span></div>
    ${table(L(["Tutoriel","Réussite","Revoir"],["Tutorial","Success","Review"]), Object.entries(by).sort().map(([t,v])=>[L("Tutoriel ","Tutorial ")+t, v.ok+" / "+v.n+" ("+Math.round(100*v.ok/v.n)+" %)", v.ok/v.n<0.6?L("À revoir : tutoriel ","To review: tutorial ")+t:L("Acquis","Mastered")]))}
    ${weak.length ? noteBlock("tip", L("Relisez en priorité : ","Read again first: ")+weak.map(t=>L("tutoriel ","tutorial ")+t).join(", ")+".") : noteBlock("ok", L("Toutes les parties sont réussies à au moins 60 %.","Every part is passed with at least 60%."))}
    <div class="row"><button type="button" class="btn" data-qend="again">${L("Nouvel essai","New attempt")}</button><button type="button" class="btn ghost" data-qend="quit">${L("Changer les réglages","Change settings")}</button></div>
  </section>
  <section class="card stack"><h2>${L("Correction détaillée","Detailed correction")}</h2>${R.qs.map((x,k)=>{ const q=x.q; const okk=x.ans===0; return '<details'+(okk?'':' open')+'><summary><span class="pcode '+(okk?'tag-ok':'tag-bad')+'">'+(k+1)+'</span><span class="ptitle">'+fmt(q[1])+'</span></summary><div class="dbody"><p><strong>'+L("Bonne réponse :","Correct answer:")+'</strong> '+fmt(q[2][0])+'</p>'+(x.ans===null?'<p class="muted">'+L("Sans réponse.","No answer.")+'</p>':okk?'':'<p><strong>'+L("Votre réponse :","Your answer:")+'</strong> '+fmt(q[2][x.ans])+'</p>')+'<p>'+fmt(q[4])+'</p><p class="small"><button type="button" class="linkbtn" data-tuto="'+q[0]+'">'+L("Revoir le tutoriel ","Review tutorial ")+q[0]+'</button></p></div></details>'; }).join("")}</section>`;
}
function qFinish(){
  const R = Q.run; R.done = true; R.t1 = Date.now(); clearInterval(Q._iv);
  const sc = qScore(); const d = new Date(), loc = EN ? "en-GB" : "fr-FR";
  store.hist.push({d: d.toLocaleDateString(loc)+" "+d.toLocaleTimeString(loc,{hour:"2-digit",minute:"2-digit"}), m:Q.mode, n:sc.n, s:sc.s}); store.hist = store.hist.slice(-30); save();
}

/* progression */
let RESETASK = false;
function vProgression(){
  const g = globalProg(), nx = nextTuto();
  return `<section class="card stack">
    <div class="sectitle"><h2>${L("Ma progression","My progress")}</h2><span class="lbl">${g.d} / ${g.n} ${L("points de contrôle","checkpoints")}</span></div>
    <div class="bar"><i style="width:${g.pct}%"></i></div>
    ${nx ? noteBlock("tip", L("Prochaine étape recommandée : **tutoriel "+nx.num+"** ("+nx.title+"). Terminez son point de contrôle avant de passer au suivant.","Recommended next step: **tutorial "+nx.num+"** ("+nx.title+"). Finish its checkpoint before moving on.")) : noteBlock("ok", L("Tous les points de contrôle sont cochés. Gardez les tutoriels 07 (aide-mémoire) et 08 (dépannage) à portée de main.","All checkpoints are ticked. Keep tutorials 07 (cheat sheet) and 08 (troubleshooting) at hand."))}
    ${table(L(["Tutoriel","Titre","Points cochés","État"],["Tutorial","Title","Points ticked","Status"]), D.tutos.map(t=>{ const p=tutoProg(t); return [t.num, t.title, p.n? p.d+" / "+p.n : L("Référence","Reference"), p.st==="ref"?L("À consulter au besoin","Consult when needed"):p.st==="done"?L("Terminé","Done"):p.st==="part"?L("En cours","In progress"):L("Non commencé","Not started")]; }))}
    <div class="row"><button type="button" class="btn ghost" data-reset="ask">${L("Effacer ma progression","Clear my progress")}</button></div>
    ${RESETASK ? '<div class="confirm"><span>'+L("Effacer toutes les cases cochées et l'historique des QCM de ce navigateur ?","Clear every ticked box and the quiz history from this browser?")+'</span><button type="button" class="btn" data-reset="yes">'+L("Oui, effacer","Yes, clear")+'</button><button type="button" class="btn ghost" data-reset="no">'+L("Annuler","Cancel")+'</button></div>' : ''}
    <p class="small muted">${L("La progression est enregistrée dans ce navigateur, sur cet appareil. Elle n'est pas transmise et ne suit pas d'un téléphone à un ordinateur.","Progress is saved in this browser, on this device. It is not sent anywhere and does not follow you from a phone to a computer.")}</p>
  </section>`;
}

/* global search */
let SIDX = null;
function buildIdx(){
  SIDX = [];
  D.tutos.forEach(t => t.blocks.forEach((b,k) => SIDX.push({type:L("Tutoriel ","Tutorial ")+t.num, title:b.h, text:norm(t.title+" "+b.h+" "+JSON.stringify(b.i)), go:{tuto:t.num, jump:"b"+k}})));
  D.problems.forEach(p => SIDX.push({type:L("Problème ","Problem ")+p.code, title:p.title, text:norm([p.code,p.title,p.see.join(" "),p.why,JSON.stringify(p.fix)].join(" ")), go:{pb:p.code}}));
  D.commands.forEach(c => SIDX.push({type:L("Commande","Command"), title:c[2]+" : "+c[3], text:norm(c.join(" ")), go:{cmd:c[2]}}));
}
function gsearch(v){
  const box = $("#gres"); if (!box) return;
  const q = norm(v).split(/\s+/).filter(w=>w.length>1);
  if (!q.length){ box.innerHTML = ""; return; }
  if (!SIDX) buildIdx();
  const res = SIDX.filter(x => q.every(w => x.text.includes(w))).slice(0, 25);
  box.innerHTML = res.length ? '<p class="small muted">'+res.length+(res.length===25?"+":"")+L(" résultat(s)"," result(s)")+'</p>'+res.map(r => {
    const attr = r.go.pb ? 'data-pb="'+r.go.pb+'"' : r.go.cmd ? 'data-gcmd="'+esc(r.go.cmd)+'"' : 'data-tuto="'+r.go.tuto+'" data-jumpafter="'+r.go.jump+'"';
    return '<button type="button" class="tnode" '+attr+'><span class="tnum" style="min-width:auto">'+esc(r.type)+'</span><span class="tt">'+esc(r.title)+'</span><span></span></button>'; }).join("") : '<p class="muted">'+L("Aucun résultat. Essayez un seul mot du message, sans les noms de vos dossiers.","No result. Try a single word from the message, without your folder names.")+'</p>';
}

/* ---------- router ---------- */
let VIEW = "accueil";
function render(view, opts){
  opts = opts || {};
  VIEW = view; CMDS = [];
  renderNav(view); renderStats(); document.body.classList.toggle("sub", view !== "accueil");
  const f = {accueil:vAccueil, documents:vDocuments, parcours:vParcours, commandes:vCommandes, depannage:vDepannage, outils:vOutils, chemins:vChemins, qcm:vQcm, progression:vProgression}[view] || vAccueil;
  main.innerHTML = f();
  if (view==="commandes") renderCmdList();
  if (view==="depannage") renderPbList();
  if (view==="chemins"){ nameMsg(); convRender(); }
  if (view==="qcm" && Q.run && !Q.run.done && Q.mode==="exam") qTick();
  const h = view==="parcours" ? "tuto-"+TUTO : view==="depannage" && POPEN ? "pb-"+POPEN.replace(".","-") : view;
  if (location.hash.slice(1) !== h){ try { history.replaceState(null, "", "#"+h); } catch(e) { location.hash = h; } }
  if (opts.jump){ const el = document.getElementById(opts.jump); if (el){ el.scrollIntoView({block:"start"}); return; } }
  if (!opts.keep){ const navTop = $("#nav").closest("nav").getBoundingClientRect().top + window.scrollY; window.scrollTo(0, FIRST ? 0 : navTop); }
  FIRST = false;
}
let FIRST = true;
function openPb(code){ PT="all"; PQ=""; POPEN=code; render("depannage"); const el = document.getElementById("pb-"+code.replace(".","-")); if (el){ el.open = true; el.scrollIntoView({block:"start"}); } }
function fromHash(){
  const h = location.hash.slice(1);
  if (h.startsWith("tuto-") && TUTONUMS.includes(h.slice(5))){ TUTO = h.slice(5); render("parcours"); return; }
  if (h.startsWith("pb-")){ const c = h.slice(3).replace("-","."); if (PBMAP[c]){ openPb(c); return; } }
  render(VIEWS.some(v=>v[0]===h) ? h : "accueil");
}
window.addEventListener("hashchange", () => { const h = location.hash.slice(1); const cur = VIEW==="parcours" ? "tuto-"+TUTO : VIEW; if (h !== cur && !(h.startsWith("pb-") && VIEW==="depannage")) fromHash(); });


/* ---------- downloads inside the Claude viewer ---------- */
let DL = null;
try { if (window.claude && typeof window.claude.use === "function") window.claude.use("downloads").then(x => { DL = x; }).catch(() => {}); } catch(e) {}
function loadZip(){ return new Promise((ok, ko) => { if (window.JSZip) return ok(window.JSZip); const sc = document.createElement("script"); sc.src = "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"; sc.onload = () => ok(window.JSZip); sc.onerror = ko; document.head.appendChild(sc); }); }
async function fetchBlob(name){ const r = await fetch(encodeURI(name)); if (!r.ok) throw new Error(name); return r.blob(); }
async function viewerSave(href){
  const name = decodeURI(href);
  toast(L("Préparation du fichier…","Preparing the file…"));
  try {
    let filename = name, data;
    if (/\.pdf$/i.test(name)) data = await fetchBlob(name);
    else {
      const Z = await loadZip(); const z = new Z();
      if (/\.zip$/i.test(name)) {
        const top = name.replace(/\.zip$/i, "");
        for (const n of Object.keys(D.files.pdf).sort()) z.file(top + "/PDF/" + D.files.pdf[n].name, await fetchBlob(D.files.pdf[n].name));
        for (const n of Object.keys(D.files.tools).sort()) z.file(top + "/outils/" + n, await fetchBlob(n));
      } else { z.file(name, await fetchBlob(name)); filename = name.replace(/\.[^.]+$/, "") + ".zip"; }
      data = await z.generateAsync({type: "blob"});
    }
    await DL.save({filename, data});
    toast(L("Fichier enregistré","File saved"));
  } catch(e) {
    const c = e && e.code;
    if (c === "declined") toast(L("Téléchargement annulé","Download cancelled"));
    else toast(L("Téléchargement impossible ici : utilisez la version Hugging Face","Download not possible here: use the Hugging Face version"));
  }
}

/* ---------- events ---------- */
document.addEventListener("click", e => {
  const dl = e.target.closest("a[download]");
  if (dl && DL){ e.preventDefault(); viewerSave(dl.getAttribute("href")); return; }
  const b = e.target.closest("button,[data-copy]"); if (!b) return;
  const d = b.dataset;
  if (d.cmd !== undefined){ copyText(CMDS[+d.cmd].replace(PH_WIN, m => store.win || m).replace(PH_LIN, m => store.linux || m)); return; }
  if (d.copy !== undefined){ copyText(d.copy); return; }
  if (d.go){ render(d.go); return; }
  if (d.tuto){ TUTO = d.tuto; render("parcours", {jump: d.jumpafter}); return; }
  if (d.pb){ openPb(d.pb); return; }
  if (d.gcmd){ CCAT="all"; CQ=d.gcmd; render("commandes"); return; }
  if (d.jump){ const el = document.getElementById(d.jump); if (el) el.scrollIntoView({block:"start", behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"}); return; }
  if (d.ccat){ CCAT = d.ccat; document.querySelectorAll("[data-ccat]").forEach(x=>x.setAttribute("aria-pressed", String(x.dataset.ccat===CCAT))); renderCmdList(); return; }
  if (d.pt){ PT = d.pt; POPEN=""; document.querySelectorAll("[data-pt]").forEach(x=>x.setAttribute("aria-pressed", String(x.dataset.pt===PT))); renderPbList(); return; }
  if (d.exW !== undefined){ $("#w2l").value = d.exW; convRender(); return; }
  if (d.exL !== undefined){ $("#l2w").value = d.exL; convRender(); return; }
  if (d.qmode){ Q.mode = d.qmode; render("qcm", {keep:true}); return; }
  if (d.qn !== undefined){ Q.n = +d.qn; render("qcm", {keep:true}); return; }
  if (d.qt){ Q.tutos.has(d.qt) ? Q.tutos.delete(d.qt) : Q.tutos.add(d.qt); render("qcm", {keep:true}); return; }
  if (d.qstart){ qStart(); render("qcm"); return; }
  if (d.qa !== undefined && Q.run){ const it = Q.run.qs[Q.run.i]; if (Q.mode==="train" && it.ans!==null) return; it.ans = +d.qa; Q.run.confirm=false; render("qcm", {keep:true}); return; }
  if (d.qnav && Q.run){ Q.run.i = Math.max(0, Math.min(Q.run.qs.length-1, Q.run.i + (+d.qnav))); Q.run.confirm=false; render("qcm"); return; }
  if (d.qgo && Q.run){ Q.run.i = +d.qgo; Q.run.confirm=false; render("qcm"); return; }
  if (d.qend){
    if (d.qend==="ask"){ const un = Q.run.qs.filter(x=>x.ans===null).length; if (un){ Q.run.confirm = true; render("qcm",{keep:true}); } else { qFinish(); render("qcm"); } }
    else if (d.qend==="force"){ qFinish(); render("qcm"); }
    else if (d.qend==="cancel"){ Q.run.confirm=false; render("qcm",{keep:true}); }
    else if (d.qend==="again"){ qStart(); render("qcm"); }
    else if (d.qend==="quit"){ Q.run=null; clearInterval(Q._iv); render("qcm"); }
    return;
  }
  if (d.reset){ if (d.reset==="ask") RESETASK=true; else if (d.reset==="yes"){ store.checks={}; store.hist=[]; save(); RESETASK=false; toast(L("Progression effacée","Progress cleared")); } else RESETASK=false; render("progression",{keep:true}); return; }
});
document.addEventListener("change", e => {
  const c = e.target; if (!c.dataset || c.dataset.chk === undefined) return;
  const t = c.dataset.chk, k = +c.dataset.k; const t0 = D.tutos.find(x=>x.num===t);
  const a = store.checks[t] || new Array(t0.check.length).fill(false); a[k] = c.checked; store.checks[t] = a; save();
  c.closest("label").classList.toggle("on", c.checked);
  const p = tutoProg(t0); const lab = c.closest("section").querySelector(".sectitle .lbl"); if (lab) lab.textContent = p.d+" / "+p.n+" "+L("coché(s)","ticked");
  renderStats(); document.querySelectorAll('.tlist [data-tuto="'+t+'"] .state').forEach(s => s.className = "state "+(p.st==="done"?"done":p.st==="part"?"part":""));
  if (p.st==="done") toast(L("Point de contrôle complet : passez au tutoriel suivant","Checkpoint complete: go to the next tutorial"));
});
document.addEventListener("input", e => {
  const id = e.target.id;
  if (id==="csearch"){ CQ = e.target.value; renderCmdList(); }
  else if (id==="psearch"){ PQ = e.target.value; POPEN=""; renderPbList(); }
  else if (id==="gsearch"){ gsearch(e.target.value); }
  else if (id==="w2l" || id==="l2w"){ convRender(); }
  else if (id==="inWin"){ store.win = e.target.value.trim(); save(); nameMsg(); }
  else if (id==="inLin"){ store.linux = e.target.value.trim(); save(); nameMsg(); convRender(); }
});
document.addEventListener("keydown", e => {
  if (VIEW!=="qcm" || !Q.run || Q.run.done || /input|textarea/i.test(e.target.tagName)) return;
  const k = e.key.toUpperCase(); const idx = "ABCD".indexOf(k);
  if (idx>=0){ const btn = document.querySelectorAll("[data-qa]")[idx]; if (btn && !btn.disabled) btn.click(); }
});

/* ---------- static chrome ---------- */
function chrome(){
  $("#brandT").textContent = L("Parcours WSL - Python pour les données climatiques","WSL Path - Python for climate data");
  $("#heroEy").textContent = "WSL 2 · Ubuntu · conda · Python · CDO";
  $("#heroH").textContent = L("Installer Linux sous Windows et préparer Python pour les données climatiques","Install Linux on Windows and set up Python for climate data");
  $("#heroP").textContent = L("Douze tutoriels pas à pas, de l'activation de la virtualisation à l'environnement geoenv : chaque commande expliquée, l'endroit exact où la taper, ce qui doit s'afficher, et la solution de chaque erreur rencontrée par les étudiants.","Twelve step-by-step tutorials, from enabling virtualization to the geoenv environment: every command explained, exactly where to type it, what should appear, and the solution to every error students meet.");
  $("#heroAff").textContent = L("Faculté des Sciences et Techniques (FST), Université de Labé, Guinée ; LPAO-SF, ESP, UCAD, Dakar, Sénégal","Faculty of Sciences and Techniques (FST), University of Labé, Guinea; LPAO-SF, ESP, UCAD, Dakar, Senegal");
  $("#heroPills").innerHTML = (EN ? ["Windows 10 (2004+) or 11","Ubuntu on WSL 2","Miniconda · conda-forge","Python 3.11 · geoenv"] : ["Windows 10 (2004+) ou 11","Ubuntu en WSL 2","Miniconda · conda-forge","Python 3.11 · geoenv"]).map(x=>'<span>'+esc(x)+'</span>').join("");
  $("#foot1").textContent = L("Dr Ibrahima Diouf, Faculté des Sciences et Techniques (FST), Université de Labé, Hafia, Labé, Guinée ; Laboratoire de Physique de l'Atmosphère et de l'Océan - Siméon Fongang (LPAO-SF), École Supérieure Polytechnique (ESP), Université Cheikh Anta Diop (UCAD), Dakar, Sénégal.","Dr Ibrahima Diouf, Faculty of Sciences and Techniques (FST), University of Labé, Hafia, Labé, Guinea; Laboratory of Atmospheric and Ocean Physics - Siméon Fongang (LPAO-SF), Higher Polytechnic School (ESP), Cheikh Anta Diop University (UCAD), Dakar, Senegal.");
  $("#foot2").textContent = L("Parcours WSL - Python pour les données climatiques, version 2.0, novembre 2026. La progression et les résultats de QCM restent dans votre navigateur ; aucune donnée n'est transmise.","WSL Path - Python for climate data, version 2.0, November 2026. Progress and quiz results stay in your browser; no data is sent anywhere.");
  $("#footCopy").textContent = L("Copier","Copy");
  $("#themeBtn").setAttribute("aria-label", L("Changer de thème","Change theme"));
  document.title = L("Parcours WSL Python Climat","WSL Path Python Climate");
  document.querySelectorAll("[data-lang]").forEach(b => b.setAttribute("aria-pressed", String(b.dataset.lang === LANG)));
}
document.querySelectorAll("[data-lang]").forEach(b => b.addEventListener("click", () => setLang(b.dataset.lang)));
chrome();
fromHash();
})();

</script>

</body>
</html>