I run Linux via ubuntu in windows. My terminal has python3 instead of python. I am using a package named PASTA, which uses commands with python as:
python run_pasta.py -i input_fasta
Since, I have python3, I am trying to run it this way:
python3 run_pasta.py -i ALL_FASTA.fasta -d protein --aligner=probcons
which gives me the following error, could anyone please tell how to fix this?
PASTA INFO: Performing initial alignment of the entire data matrix...
PASTA failed because one of the programs it tried to run failed. The
invocation that failed was:
"/mnt/f/Projects/WoldringLab/AnalyzingGenerativeModel/pasta-code/pasta/bin/hmmeralign"
"/home/aryaman3900/.pasta/pastajob/temp569cp9x3/init_aln/temphmmeralignourpmnyw/input.fasta"
"/home/aryaman3900/.pasta/pastajob/temp569cp9x3/init_aln/query-0.fasta"
"/home/aryaman3900/.pasta/pastajob/temp569cp9x3/init_aln/temphmmeralignourpmnyw/input.aligned"
"amino"
/usr/bin/env: ‘python’: No such file or directory
You can create a symlink (symbolical link) from python3 to python. What this will do is just to map each call to /usr/bin/python to your python3 executable:
sudo ln -s $(which python3) /usr/bin/python
You can learn more about the ln command by reading its man page via man ln.
Related
I'm trying to turn a simple python program into a debian package for Linux.
I created a folder /testhello, and created testhello/DEBIAN and testhello/usr. Inside testhello/DEBIAN i have a control file that contains:
Package: testhello
Version: 0.01
Architecture: all
Maintainer: Me,me#gmail.com
Installed-Size: 2
Depends: python3
Section: extras
Priority: optional
Homepage: your homepage
Description: describe
Inside testhello/usr there's a bin folder, that contains testhello.py, a file that contains a single line, print("hello world")
I then successfully ran dpkg -b testhello and then sudo dpkg -i testhello.
But when i run the command testhello in bash i am greeted with testhello: command not found
What can I do?
Edit 1: When i go to /bin i can see testhello.py there.
Check the shebang (first line):
#! /usr/bin/env python
print("hello world")
give execute permission and should work.
I have installed python and I have a file Wifite.py that exists in my current directory.
But whenever I try to run the Wifite2.py file I receive this error:
‘python’: No such file or directory
jarvus#jarvus:~/wifite2$ ls
bin PMKID.md setup.py wordlist
Dockerfile README.md tests wordlist-
EVILTWIN.md reaver-wps-fork-t6x TODO.md
LICENSE runtests.sh wifite
MANIFEST.in setup.cfg Wifite.py
jarvus#jarvus:~/wifite2$ ./Wifite.py
/usr/bin/env: ‘python’: No such file or directory
What changes should be made to get ./Wifite.py working?
The workaround I got is using:
python3 Wifite.py
But I'm looking for alternatives.
This message:
/usr/bin/env: ‘python’: No such file or directory
suggests that the hashbang in your script looks like this:
#!/usr/bin/env python
Since running the script explicitly with python3 worked OK, it sounds like you're on a distro where by default you only have python3 and no python. As other answers suggest, you may install python-is-python3 (which basically creates a python symlink pointing to python3). If you don't wish to do that, then just adjust the script's hashbang so that /usr/bin/env looks for python3:
#!/usr/bin/env python3
Seems you don't have python2 installed but only python3 but it is not registered as plain python.
Try
which python
which python2
which python3
If only the last command runs without error you can try to link python3 to python with
sudo apt-get install python-is-python3
Use shebangs!
In the first line of your script write the python interpretor path.
#! /usr/bin/python
Then chmod +x your file on shell. That will make it executable. And you can directly run it.
Try running python3 Wifite2.py from the directory where the file exists.
I am trying to install Opencv 3 for Python on Mac using this link (https://www.codingforentrepreneurs.com/blog/install-opencv-3-for-python-on-mac/)
I am using python 3.6.4 and I am currently at step 6 (regarding the link)
I am using Python directly from the Mac terminal and when I slot in the following command this error appears:
$ ln -S /usr/local/Cellar/opencv/3.4.0_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/lib/python3.6/site-packages/cv2.so
File "<stdin>", line 1
ln -S /usr/local/Cellar/opencv/3.4.0_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/lib/python3.6/site-packages/cv2.so
^
SyntaxError: invalid syntax
You essentially need to run a command like:
ln -s SRC TGT
where SRC is the library you have just built/installed and TGT is where you want it to be visible to Python.
Find the SRC file, independently of the OpenCV versions you have installed, like this:
SRC=$(find /usr/local/Cellar/opencv -name "cv2.cpython*so")
and check it looks correct with:
echo "$SRC"
There should be one line. If there is more than one line, it means you have multiple versions of OpenCV installed, so it may look like:
/usr/local/Cellar/opencv/3.4.0_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
/usr/local/Cellar/opencv/3.3.1_7/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
In that case, choose the one you want and manually set SRC to that one, e.g.
SRC=/usr/local/Cellar/opencv/3.4.0_1/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
Find the TGT directory, independently of the Python versions you have installed, like this:
TGT=$(find /usr/local/lib/ -type d -name "site-packages")
and check it looks correct with:
echo "$TGT"
There should be one line. If there is more than one line, it means you have multiple versions of Python installed, and it may look something like:
/usr/local/lib/python3.6/site-packages
/usr/local/lib/python3.5/site-packages
If that is the case, choose the one you want to use and set TGT manually, e.g.:
TGT=/usr/local/lib/python3.6/site-packages
Now make the link:
ln -s "$SRC" "$TGT/cv2.so"
In step 6, you first get the sys path, notice that this is done while running python.
You can tell because of the prompt ">>>" in
>>> print(sys.path)
If you then enter:
ln -s /usr/local/Cellar/opencv/3.4.1_4/....
While in Python, you will get the exact error you mentioned.
In order to finish step 6 you now must exit python by typing
>>> exit()
Now you will see the $ prompt.
I realize the way you stated your problem that you were already at the $ prompt, so this might be moot... but if you typed your question rather than cutting and pasting it, maybe you typed it incorrectly here and you were actually still in Python when you had the error.
$ ln -s /usr/local/Cellar/opencv/3.4.1_4/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/lib/python3.6/site-packages/cv2.so
Try to build atom/electron on Windows 7, but failed.
OS Environment:
Windows 7
VS 2013 Update 5
Python 2.7
Node.js 4.2.3
Git 2.6.4
atom/electron - Latest pull (2015.12.17)
It failed when running the bootstrap script "$ python bootstrap.py -v", the screenshot is here:
Trying to find a way through, any help will be appreciated.
-- dean
Found a way...:
Situation failed one: "can't open file"
According to the official documentation: Build Instructions (Windows)
$ python script\bootstrap.py -v
the result will be:
D:\Program Files\Python27\python.exe: can't open file 'scriptbootstrap.py': [Errno 2] No such file or directory
Situation failed two: "WindowsError: [Error 3]...."
Pay attention to this:
$ cd script
$ python bootstrap.py -v
I cd into the script folder, and run the bootstrap script, and failed.
Situation OK: Use "/" instead of "\"
See the screenshot below:
Explanations are welcome...
--dean
I'm pretty new to CentOS (5) and also node.js, but I already got an older version of node.js to work on my virtual server.
Now I'm trying to install a newer version, and I know that CentOS needs Python 2.4 while node needs 2.6 or newer, so I installed Python 2.7 using altinstall.
But even if I set an alias for Python that points to version 2.7 before running ./configure, I still get this error:
/root/node/wscript: error: Traceback (most recent call last):
File "/root/node/tools/wafadmin/Utils.py", line 274, in load_module
exec(compile(code, file_path, 'exec'), module.__dict__)
File "/root/node/wscript", line 222
"-pre" if node_is_release == "0" else ""
^
SyntaxError: invalid syntax
That's the content of ./configure:
#! /bin/sh
# v8 doesn't like ccache
if [ ! -z "`echo $CC | grep ccache`" ]; then
echo "Error: V8 doesn't like cache. Please set your CC env var to 'gcc'"
echo " (ba)sh: export CC=gcc"
exit 1
fi
CUR_DIR=$PWD
#possible relative path
WORKINGDIR=`dirname $0`
cd "$WORKINGDIR"
#abs path
WORKINGDIR=`pwd`
cd "$CUR_DIR"
"${WORKINGDIR}/tools/waf-light" --jobs=1 configure $*
exit $?"
And at the top of wscript there is the following line: "#!/usr/bin/env python". I also tried replacing that with something else, though I think it should work when using a Python alias
Any ideas what I need to do to get this to work?
Thanks!
I have python 2.7.3 'altinstalled' on Centos 5.x, with the binary named "/usr/local/bin/python2.7"
I compile and install nodejs v0.8.16 using:
PYTHON=/usr/local/bin/python2.7
export PYTHON
python2.7 configure && make && make install
running configure with python2.7 overrides the default python handling
creating a PYTHON env var allows make install to find the correct version of python
(I still had to identify and install missing development modules one by one before the install would succeed)
I changed the PATH in bash_profile to include the path to the desired version of python as follows:
vi ~/.bash_profile
replace PATH=$PATH:$HOME/bin
with PATH=/usr/local/python272/bin:$PATH:$HOME/bin
source ~/.bash_profile
./configure
make
It picks up the correct python version. No need to change wscript
I'm on CentOS 5.6, python 2.7.2 (installed in /usr/local/python272) and using node.js 0.4.12
I ran into this same exact problem. I wound up editing the wscript file and changed that line (222) from this:
"-pre" if node_is_release == "0" else ""
...to this:
""