Hi all,
I am really struggling with hisat2 recently and getting confused. I'm trying to run hisat2:
hisat2-build -p 2 genome.fa genome
This is my error:
/usr/bin/env: ‘python’: No such file or directory
Hi all,
I am really struggling with hisat2 recently and getting confused. I'm trying to run hisat2:
hisat2-build -p 2 genome.fa genome
This is my error:
/usr/bin/env: ‘python’: No such file or directory
This error means one of the two things: 1) you don't have a system-wide installation of python; 2) your have python installed but it is not in its standard directory (/usr/bin/python). To figure this out, type:
which python
This will tell you where your python is, or it will again say No such file or directory. If the latter happens, you need to install python. If the previous command gives you a different python location, say /bin/python, you need to copy that line and paste it as a first line in hisat2-build. First find where hisat2-build is:
which hisat2-build
Then open this file and instead of the first line being #!/usr/bin/env python, enter #!/bin/python.
but after I run this command
which python
the output is
/usr/bin/which: no python in (/home/yun/Downloads/hisat2-2.2.0:/home/yun/Downloads/Trimmomatic-0.39:/home/yun/Downloads/FastQC:/home/yun/.local/bin:/home/yun/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)
You have two options, and both of them require admin privileges by you, or by someone who can make these changes for.
The first option is to install python (which is usually a synonym for python v2.7), and it should by default go into /usr/bin directory. After that hisat2-build will work without any modification.
Your second option is to try running hisat2-build with your existing python3 installation. Don't know if that will work, but it might. In that case you need to edit hisat2-build as administrator and replace #!/usr/bin/env python on the first line with /usr/bin/python3. To see whether this even have a chance of working, you can run hisat2-build like this:
python3 `/usr/local/bin/hisat2-build`
You can find the exact hisat2-build location with which command.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
How did you install
hisat2? Usingconda?Please post the output from:
Rather surprising that you have no system
pythoninstalled. As Mensur Dlakic already said below you will need to installpython.here is my result:
but
hisat2-buildisread only, I can't edit it.do you have root/sudo permissions on this system? if you have sudo permissions, try
sudo ln -s /usr/bin/python3 /usr/bin/python. If you have root permissons, log in as root and then tryln -s /usr/bin/python3 /usr/bin/python. If you do not root/admin privileges and you are using bash shell. try this:.bashrc.bashrc(note that dot in the file name)alias python=/usr/bin/python3. .bashrcand press enter buttonLet us know if this works. Please also note that copy/paste from web may introduce unwanted spaces and/or characters.
I don't think these suggestions are in the spirit of how Linux uses
pythonwhich usually refers to v2. If the OP has sudo privileges, I think they should installpython(v2-something).These two solutions may work for this problem (assuming Hisat2 is OK with python3), but there is a good chance there will be a problem down the line where a program expecting
python2will be trying to run usingpython3. There is a solution further below that will usepython3without introducing a possible confusion in the system.Not true.
Ubuntu team proposal to make python 3 as default python version on ubuntu and debian is available here:
Old documentation: https://wiki.ubuntu.com/Python/3
Updated documentation: https://wiki.ubuntu.com/Python
Old documentation was written in 2014 and latest HISAT is released in 2020.
may be, may be not. As far as I know, later versions of HISAT 2 supports python 3, which user is supposed to use. Here is the link for HISAT2 support for pyhon3 (HISAT 2.2.1 release 7/24/2020): (https://daehwankimlab.github.io/hisat2/). If you have any link to such documentation where down the lane, hisat2-build or other components of hisat2 requires python 2, please post here. To my understanding, hisat2 suite of tools moved to python3.
Not true based on what? I have Ubuntu 20.04, and here is what it gives for
which python:Then:
I realize that python v2 has been phased out starting this year, but in a majority of computers in the world
pythonunder Linux still refers to v2.I said
where a program expecting python2meaning any program, not specifically Hisat2. There are tons of scripts out there with#!/usr/bin/pythonas their first line that are expecting python v2 and will not work with v3.It will be many years from now, when python v2 is completely phased out, before
/usr/bin/pythoncan be safely linked to python3 without worrying that will mess up many existing scripts.Based on distro release notes (https://wiki.ubuntu.com/FocalFossa/ReleaseNotes#Python3_by_default) for 20.04. Copy/pasted : In 20.04 LTS, the python included in the base system is Python 3.8. Python 2.7 has been moved to universe and is not included by default in any new installs.
SO post saying the same: https://askubuntu.com/questions/1232812/whats-the-default-python-version-in-ubuntu-20-04.
Here is the link release manifest for said distro: https://old-releases.ubuntu.com/releases/20.04/ubuntu-20.04-desktop-amd64.manifest. There is no single entry for python 2 or python 2.7, where as python3.8 multiple entries.
Tool chain upgrades for 20.04 : glibc 2.31, OpenJDK 11, rustc 1.41, GCC 9.3, Python 3.8.2, ruby 2.7.0, php 7.4, perl 5.30, golang 1.13 (https://wiki.ubuntu.com/FocalFossa/ReleaseNotes?action=show&redirect=FocalFossa%2FReleaseNotes%2F20.04).
Most importantly, I am on impish and default python is not 2.
Everything you said above is true, but doesn't contradict what I said. New Ubuntu versions install python3 by default and do not install python2 - they are phasing out python2. However, they install python3 as
/usr/bin/python3and there is nothing installed as/usr/bin/python. This is most likely the case with our OP, who has python3 installed but not the/usr/bin/pythonentry.The reason system doesn't link
/usr/bin/pythonto python3 is exactly to avoid problems with scripts that have#!/usr/bin/pythonas their first line and are expecting python2. Linux developers know that a large number of scripts out there are in this category, which is why/usr/bin/pythonis missing in newer Linux distros even though python3 is installed. The only way to get the system to create/usr/bin/python, at least to my knowledge, is to install python2.Now, one can always do what you are suggesting and make a symbolic link to python3. That may solve the immediate problem, but globally speaking I think is not the right thing to do and will at some point cause problems.
It did work. But after I input:
The erroe is
You are not helping us here. What is it that worked, because there are lots of suggestions above?
Are you referring to
sudo ln -s /usr/bin/python3 /usr/bin/pythonas what worked? If so, it seems that you are using2.2.0of the program which is not the newest release, and may not supportpython3. If you made a link topython3with/usr/bin/python, you are doing exactly what I argued with @cpad0112 not to be a good idea. In other words, you may be using python3 with a script that expects a python2 syntax, and that throws an error.Like I suggested before, the cleanest solution most likely is to install python2 system-wide and to make sure that
/usr/bin/pythonactually points to it.