# Error running snakemake

**URL:** <https://nextstrain.discourse.group/t/error-running-snakemake/251>\
**Category:** Help and Getting Started\
**Created:** [December 31, 2020, 9:26am UTC](https://nextstrain.discourse.group/t/error-running-snakemake/251 "2020-12-31T09:26:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbridges](https://avatars.discourse-cdn.com/v4/letter/d/db5fbb/32.png) [@dbridges](https://nextstrain.discourse.group/u/dbridges)\
**Post date:** [December 31, 2020, 9:26am UTC](https://nextstrain.discourse.group/t/error-running-snakemake/251/1 "2020-12-31T09:26:25Z")

</div>

Hi there,

I installed nextstrain following the instructions ([Setup and installation | Tutorial: Using Nextstrain for SARS-CoV-2](https://nextstrain.github.io/ncov/setup)), but for some reason am getting an error when i try to run the following snakemake command:

```
(nextstrain) dan@PATH:~/Work/Computer/GitRepos/ncov$ snakemake --cores 4 --profile
./my_profiles/getting_started/
localrules directive specifies rules that are not present in the Snakefile:
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 4
Rules claiming more threads will be scaled down.
Conda environments: ignored
Job counts:
[Thu Dec 31 11:17:36 2020]
Job 23: 
excluding sequences flagged in the diagnostic step in file results/to-exclude.txt                                                                                                  
augur filter --sequences results/aligned.fasta --metadata data/example_metadata.tsv --exclude results/to-exclude.txt --output results/aligned-filtered.fasta 2>&1 | tee logs/refiltered.txt

[Thu Dec 31 11:17:36 2020]
Job 5: Constructing colors file
python3 scripts/assign-colors.py --ordering defaults/color_ordering.tsv --color- schemes defaults/color_schemes.tsv --output results/global/colors.tsv --metadata data/example_metadata.tsv 2>&1 | tee logs/colors_global.txt

Traceback (most recent call last):
File "scripts/assign-colors.py", line 22, in <module>
for line in f.readlines():
 File "/home/dan/.miniconda3/envs/nextstrain/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 88: ordinal not in range(128)
[Thu Dec 31 11:17:36 2020]
Error in rule colors:
jobid: 5
output: results/global/colors.tsv
log: logs/colors_global.txt (check log file(s) for error message)
shell:

python3 scripts/assign-colors.py --ordering defaults/color_ordering.tsv --color-schemes defaults/color_schemes.tsv --output results/global/colors.tsv --metadata data/example_metadata.tsv 2>&1 | tee logs/colors_global.txt

(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
Logfile logs/colors_global.txt:
Traceback (most recent call last):
  File "scripts/assign-colors.py", line 22, in <module>
for line in f.readlines():
  File "/home/dan/.miniconda3/envs/nextstrain/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 88: ordinal not in range(128)

No meta data for MN908947, excluding from all further analysis.

1 sequences were dropped during filtering
0 of these were dropped because they were in results/to-exclude.txt
418 sequences have been written out to results/aligned-filtered.fasta
[Thu Dec 31 11:17:37 2020]
Finished job 23.
1 of 21 steps (5%) done
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/dan/Work/Computer/GitRepos/ncov/.snakemake/log/2020-12-31T111735.850250.snakemake.log

```

Unsure if this is related to the issue above, but I also get an error when running the following:  
`(nextstrain) dan@PATH:~/Work/Computer/GitRepos/ncov$ nextstrain check-setup --set-default  
nextstrain-cli is up to date!  
Traceback (most recent call last):  
File “/home/dan/.miniconda3/envs/nextstrain/bin/nextstrain”, line 8, in   
sys.exit(main())  
File “/home/dan/.miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/ **main**.py”, line 10, in main  
return cli.run( argv[1:] )  
File “/home/dan/.miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/ **init**.py”, line 35, in run  
return opts. **command**.run(opts)  
File “/home/dan/.miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/command/check\_setup.py”, line 61, in run  
print(“Testing your setup\u2026”)  
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\u2026’ in position 18: ordinal not in range(128)’

---

<div class="post-metadata">

**Author:** ![trs](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/trs/32/5_2.png) [@trs](https://nextstrain.discourse.group/u/trs)\
**Post date:** [January 4, 2021, 9:51pm UTC](https://nextstrain.discourse.group/t/error-running-snakemake/251/2 "2021-01-04T21:51:00Z")

</div>

Hi @dbridges, welcome! This looks like [a previously-identified issue](https://nextstrain.discourse.group/t/error-in-rule-colours-jobid-5/160/2) where some of the ncov build code assumes a UTF-8 character encoding.

Could you try the suggestions there and report back?

---

<div class="post-metadata">

**Author:** ![dbridges](https://avatars.discourse-cdn.com/v4/letter/d/db5fbb/32.png) [@dbridges](https://nextstrain.discourse.group/u/dbridges)\
**Post date:** [January 5, 2021, 12:41pm UTC](https://nextstrain.discourse.group/t/error-running-snakemake/251/3 "2021-01-05T12:41:48Z")

</div>

Thanks @trs, had a look at the thread you mentioned and the fix suggested sorted out the issue. Great support - thanks so much!
