# mafft does not work inside my Qiime2 environment

**URL:** https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267
**Category:** Technical Support
**Tags:** conda, mafft
**Created:** [April 18, 2021, 5:07am UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267 "2021-04-18T05:07:22Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![kathrine-mcaulay](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kathrine-mcaulay/32/10858_2.png) [@kathrine-mcaulay](https://forum.qiime2.org/u/kathrine-mcaulay)
#### Post date: [April 18, 2021, 5:07am UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/1 "2021-04-18T05:07:22Z")

</div>

Hello, I am running `q2cli version 2021.2.0`, installed using conda, on MacOS Mojave 10.14.6.

I am having issues with `mafft` but it doesn't seem to be related to the memory/large file issues covered in posts like [this one](https://forum.qiime2.org/t/mafft-error-non-zero-exit-status-1/6345). The command I was running when I discovered the issue was:

```auto
qiime phylogeny align-to-tree-mafft-fasttree \
  --i-sequences rep-seqs.qza \
  --o-alignment aligned-seqs.qza \
  --o-masked-alignment masked-aligned-rep-seqs.qza \
  --o-tree unrooted-tree.qza \
  --o-rooted-tree rooted-tree.qza

```

However, before I go into the specifics of this error, simply running `mafft` within my conda Qiime2 environment does not invoke the same behavior as running it outside of this environment:

```auto
(qiime2-2021.2) ~ $ mafft

v0.000 != v7.055b (2013/07/25)

There is a problem in the configuration of your shell.
Check the MAFFT_BINARIES environmental variable by
$ echo $MAFFT_BINARIES

This variable must be *unset*, unless you have installed MAFFT
with a special configuration. To unset this variable, type
$ unset MAFFT_BINARIES
or
% unsetenv MAFFT_BINARIES
Then retry
$ mafft input > output

To keep this change permanently, edit setting files
(.bash_profile, .profile, .cshrc, etc) in your home directory
to delete the MAFFT_BINARIES line.
On MacOSX, also edit or remove the .MacOSX/environment.plist file
and then re-login (MacOSX 10.6) or reboot (MacOSX 10.7).

Please send a problem report to kazutaka.katoh@aist.go.jp,
if this problem remains.

```

So I checked where it was accessing mafft:

```auto
(qiime2-2021.2) ~ $ which mafft
/opt/local/bin/mafft

```

And then deactivated the environment and checked again:

```auto
(qiime2-2021.2) ~ $ conda deactivate
(base) ~ $ which mafft
/opt/local/bin/mafft

```

It's the same, **but** in the base environment `mafft` results in different behaviour:

```auto
(base) ~ $ mafft

---------------------------------------------------------------------

   MAFFT v7.055b (2013/07/25)

        Copyright (c) 2013 Kazutaka Katoh
        MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)
        http://mafft.cbrc.jp/alignment/software/
---------------------------------------------------------------------

Input file? (fasta format)
@ 

```

I have tried:

1. to unset the binaries both inside and outside of the conda environment with `unset MAFFT_BINARIES` as indicated in the error message, but this does not seem to change anything
2. adding mafft to `~/.bash_profile`, although this seems unnecessary as `which mafft` already points to the correct location.
3. searching for generic solutions when unable to unset an environment variable, but I have been unable to find a solution. I am certain it is something simple, but unfortunately this is not my forte. I appreciate that this may not be, technically speaking, a Qiime2 issue, but I am hoping that it is a behavior that you will understand in the context of Qiime2 and thus be able to advise.

---

<div class="post-metadata">

### Author: ![andrewsanchez](https://forum.qiime2.org/user_avatar/forum.qiime2.org/andrewsanchez/32/20160_2.png) [@andrewsanchez](https://forum.qiime2.org/u/andrewsanchez)
#### Post date: [April 19, 2021, 11:35pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/2 "2021-04-19T23:35:41Z")

</div>

Hi, @kathrine-mcaulay 👋 !

Do you recall having installed `mafft` separately, outside of your QIIME 2 installation and how you went about it? These sorts of issues often arise as a result of a misconfigured `PATH` variable. And you are probably correct that it is likely something simple! With your QIIME 2 conda environment activated, can you share the output of the `env` command as well as `conda list`?

---

<div class="post-metadata">

### Author: ![kathrine-mcaulay](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kathrine-mcaulay/32/10858_2.png) [@kathrine-mcaulay](https://forum.qiime2.org/u/kathrine-mcaulay)
#### Post date: [April 20, 2021, 2:14am UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/3 "2021-04-20T02:14:38Z")

</div>

Thanks @andrewsanchez. I actually have zero memory of installing `mafft` outside of my QIIME2 installation and as you will see from the attached files, things are a little disorganized...

[conda\_list\_qiime2\_4.19.21.txt](https://forum.qiime2.org/uploads/short-url/rM6mZ7WAnu4HMBxWTlyh2wIszFw.txt) (29.7 KB) [env\_qiime2\_4.19.21.txt](https://forum.qiime2.org/uploads/short-url/7MWaI5HpakbZXFsNaHKcdQpcZj.txt) (7.9 KB)

---

<div class="post-metadata">

### Author: ![andrewsanchez](https://forum.qiime2.org/user_avatar/forum.qiime2.org/andrewsanchez/32/20160_2.png) [@andrewsanchez](https://forum.qiime2.org/u/andrewsanchez)
#### Post date: [April 20, 2021, 4:50pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/4 "2021-04-20T16:50:13Z")

</div>

When it comes to the `PATH` variable, the order of items matters. You can see below that the `mafft` installation external to your qiime 2 conda environment appears before the qiime 2 environment. It's important that the qiime 2 environment comes first. Otherwise, your computer will favor programs that appear earlier in the list.

`PATH=/opt/local/bin/mafft:/Users/m213406/Filtlong/bin:/Users/m213406/nanotimeparse:/Users/m213406/NanoOK/bin:/opt/local/share/arb/bin:/opt/local/bin:/opt/local/sbin:/Users/m213406/opt/anaconda3/envs/qiime2-2021.2/bin:/Users/m213406/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/m213406/centrifuge/bin:/usr/local/ncbi/blast/bin:/Library/TeX/texbin:/opt/X11/bin`

Usually, the `PATH` variable is configured in the `~/.bash_profile` on mac os, but it could be conifigured elsewhere like in `~/.zshrc`. The way to fix this is figure out where `PATH` is being set, and to remove the line that is prepending `mafft` to the variable. For example, if you find the following line in your `~/.bash_profile`:

```bash
export PATH=/opt/local/bin/mafft:$PATH

```

This would prepend that specific `mafft` installation. In this case, you could just remove that line entirely.

Note that there are also several other items which appear at the beginning of the list, prior to the `qiime2` bit. This may or may not cause problems, but is often a sign of a less than ideal approach to configuring `PATH`.

I hope that helps! Good luck, and let me know how you get along.

---

<div class="post-metadata">

### Author: ![kathrine-mcaulay](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kathrine-mcaulay/32/10858_2.png) [@kathrine-mcaulay](https://forum.qiime2.org/u/kathrine-mcaulay)
#### Post date: [April 21, 2021, 2:11pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/5 "2021-04-21T14:11:48Z")

</div>

Hmmm, ok so this line _was_ in my `~/.bash_profile`, but only because I put it there while trying to troubleshoot this before posting on here. I do not have .bashrc or .zshrc on this machine.

I believe I installed these other programs in my base environment, is this what is forcing them before `qiime2` inside this environment? I can certainly uninstall `nanotimeparse` as I ended up having to use that inside a virtual machine anyway. Regarding the others: `arb` was installed using MacPorts and the others I manually added to `~/bash_profile`. Presumably I have messed things up doing this.

Do you want me to take this elsewhere since it isn't really a QIIME2 question at this stage?

---

<div class="post-metadata">

### Author: ![andrewsanchez](https://forum.qiime2.org/user_avatar/forum.qiime2.org/andrewsanchez/32/20160_2.png) [@andrewsanchez](https://forum.qiime2.org/u/andrewsanchez)
#### Post date: [April 21, 2021, 11:31pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/6 "2021-04-21T23:31:20Z")

</div>

> [@kathrine-mcaulay](#):
>
> I believe I installed these other programs in my base environment, is this what is forcing them before `qiime2` inside this environment?

It looks like those other programs have nothing to do with conda and were installed by other means.

> [@kathrine-mcaulay](#):
>
> Do you want me to take this elsewhere since it isn’t really a QIIME2 question at this stage?

I'm happy to assist. This is a somewhat common issue so it's handy to have a record of problems/solutions here on the forum.

---

<div class="post-metadata">

### Author: ![kathrine-mcaulay](https://forum.qiime2.org/user_avatar/forum.qiime2.org/kathrine-mcaulay/32/10858_2.png) [@kathrine-mcaulay](https://forum.qiime2.org/u/kathrine-mcaulay)
#### Post date: [April 22, 2021, 4:59pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/7 "2021-04-22T16:59:24Z")

</div>

Thank you, I appreciate it.

I removed the other programs that I am not using frequently from my `PATH`. This seemed to remove any reference to `mafft` from the output of `env`. I then uninstalled and reinstalled QIIME2 and this seems to have solved the problem.

Thanks again for helping me troubleshoot!

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [May 23, 2021, 11:00pm UTC](https://forum.qiime2.org/t/mafft-does-not-work-inside-my-qiime2-environment/19267/8 "2021-05-23T23:00:09Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
