So you had a successfull pip installation, yet when you type this, you get a ‘command not found’ error, instead of a nice looking output:
Unfortunately this is a common problem, because .. well, let’s just say ‘reasons’.
What you will do to solve it is to update your
PATH variable, so your shell knows where did pip put all the anvi’o programs.
A bit more info for the curious: PATH is an environmental variable and contains all the places to look for on your computer when you enter a command. For instance, if you type
which ls, you will get a location, which will show where the
ls program lives. Every time you type ls, your shell knows where to find it, because the directory that contains
ls (and all the other programs) is in your PATH variable. You can check it yourself. Type
echo $PATH, and see all directories that are known to your system as places where programs can live and be found.
I could give you a single line of command to solve this issue, however, the directory path on my computer may not be identical to yours (and it would require just too much heuristics to find what is the actual directory on your’s). Therefore it is important you do these steps on your computer. I am sorry it is not always easy and straightforward to install open source software, and thank you very much for your patience.
Finding where the anvi’o programs are
In order to add the proper directory into your
PATH variable, first we need to find out where anvi’o programs are. We will ask pip.
If you type this, you will get a list of file paths for each file that is installed on your system for anvi’o:
All these are relative paths. But relative to what? The root directory is at the very top of your output, which is very hard to get. But if you type this, you will get that particular line where pip installed everything anvi’o:
From this output I learn that my anvio installation is under
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages. But this doesn’t really help. Because I still don’t know where the binaries went. Let’s see what is the relative path of
anvi-profile among the installed files:
OK. So three directories up from the installation directory, there is a directory called
bin, and anvi’o programs went in there. Let’s see:
Yes. Now if you type this while in that directory, you will see that everything works magically:
So this is the directory where anvi’o programs live on your computer:
Please note that the directory names on my computer and yours may differ.
Updating the PATH variable
Now you know which directory is missing from your
PATH variable, it is time to make sure it will always be there. The best way to do it is to add this line into your
~/.bash_profile, a special file that is read to update all environmental variables every time you start a new terminal:
If you don’t want to try to find and open that file, you can run this command, and it will add it at the end of the file:
Testing if everything works
Open a new terminal and type this to make sure the directory you just added is somewhere in the output:
If the output looks alright, then this should work this time:
If this doesn’t solve your problem please post a comment or send me an e-mail, and I will help you sort it out.