ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
/opt/bin/python: bad interpreter: No such file or directory

Do you have a python binary in /opt/bin? What is the output of ls -al /opt/bin/python?

If not, why do you specify that as the interpreter to be used for this file?

/opt/bin/python: bad interpreter: No such file or directory

Do you have a python binary in /opt/bin? What is the output of ls -al /opt/bin/python?

If not, why do you specify that as the interpreter to be used for this file?


Edit:

The output is: ls: cannot access '/opt/bin/python': No such file or directory

Then it would appear there is no interpreter (or at least: no binary) there and you cannot specify it as the one to use for this file.

I used the same interpreter (#!/opt/bin/python) when I run the python script (outside ROS) from my terminal.

I'm not saying you're lying, but I would find that really strange: ROS does nothing special here. It certainly doesn't change any of your Python interpreters or where they are located.

If there is no file at /opt/bin/python, then you cannot specify it as the interpreter to use for that file. With or without ROS.

Then I added the line #!/opt/bin/env python following the steps of the tutorial for python subscriber node.

That makes more sense, as /opt/bin/env will figure out which python binary to use based on your current settings.

Suggestion: remove #!/opt/bin/python from your file.

/opt/bin/python: bad interpreter: No such file or directory

Do you have a python binary in /opt/bin? What is the output of ls -al /opt/bin/python?

If not, why do you specify that as the interpreter to be used for this file?


Edit:

The output is: ls: cannot access '/opt/bin/python': No such file or directory

Then it would appear there is no interpreter (or at least: no binary) there and you cannot specify it as the one to use for this file.

I used the same interpreter (#!/opt/bin/python) when I run the python script (outside ROS) from my terminal.

I'm not saying you're lying, but I would find that really strange: ROS does nothing special here. It certainly doesn't change any of your Python interpreters or where they are located.

If there is no file at /opt/bin/python, then you cannot specify it as the interpreter to use for that file. With or without ROS.

Then I added the line #!/opt/bin/env python following the steps of the tutorial for python subscriber node.

That I believe you mean: #!/usr/bin/env python: that makes more also little sense, as /opt/bin/env/usr/bin/env will figure out which python binary to use based on your current settings.

Suggestion: remove #!/opt/bin/python from your file.

/opt/bin/python: bad interpreter: No such file or directory

Do you have a python binary in /opt/bin? What is the output of ls -al /opt/bin/python?

If not, why do you specify that as the interpreter to be used for this file?


Edit:

The output is: ls: cannot access '/opt/bin/python': No such file or directory

Then it would appear there is no interpreter (or at least: no binary) there and you cannot specify it as the one to use for this file.

I used the same interpreter (#!/opt/bin/python) when I run the python script (outside ROS) from my terminal.

I'm not saying you're lying, but I would find that really strange: ROS does nothing special here. It certainly doesn't change any of your Python interpreters or where they are located.

If there is no file at /opt/bin/python, then you cannot specify it as the interpreter to use for that file. With or without ROS.

Then I added the line #!/opt/bin/env python following the steps of the tutorial for python subscriber node.

I believe you mean: #!/usr/bin/env python: that makes more also little sense, as /usr/bin/env will figure out which python binary to use based on your current settings.

Suggestion: remove #!/opt/bin/python from your file.

/opt/bin/python: bad interpreter: No such file or directory

Do you have a python binary in /opt/bin? What is the output of ls -al /opt/bin/python?

If not, why do you specify that as the interpreter to be used for this file?


Edit:

The output is: ls: cannot access '/opt/bin/python': No such file or directory

Then it would appear there is no interpreter (or at least: no binary) there and you cannot specify it as the one to use for this file.

I used the same interpreter (#!/opt/bin/python) when I run the python script (outside ROS) from my terminal.

I'm not saying you're lying, but I would find that really strange: ROS does nothing special here. It certainly doesn't change any of your Python interpreters or where they are located.

If there is no file at /opt/bin/python, then you cannot specify it as the interpreter to use for that file. With or without ROS.

Then I added the line #!/opt/bin/env python following the steps of the tutorial for python subscriber node.

I believe you mean: #!/usr/bin/env python: that makes more sense, as /usr/bin/env will figure out which python binary to use based on your current settings.

Suggestion: remove #!/opt/bin/python from your file.


Edit 2:

Reinstalletion worked ok, but after:

/usr/bin/env python -c 'import yaml'

I get:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named yaml

which python gave me:

/usr/local/bin/python

Without restarting laptop or terminal.

Now we're getting somewhere.

You do have a non-system-default Python interpreter on your system (it is a Python 2.7.15, while the normal Python version for Ubuntu 16.04 is actually 2.7.12) and it is taking precedence over the Ubuntu provided python.

The python-yaml Debian package only installs the yaml module for the system-default Python interpreter, so it makes sense that your custom Python interpreter cannot find it.

I don't know why you have that non-default Python in /usr/local/bin, but you'll either have to remove it or make sure that all modules required for ROS are also installed for the custom Python.