what can i do to solve Webots error message - python

I'm new to webots program and I'm building a new robot controller, but when I hit the start simulation button, it gives me this error :
WARNING: "python3.8.exe" was not found.
Webots requires Python version 3.7 or 2.7 (64 bit) from python.org in your current PATH.
To fix the problem, you should:
1. Check the Python command set in the Webots preferences.
2. Check the COMMAND set in the [python] section of the runtime.ini file of your controller program if any.
3. Fix your PATH environment variable to use the required Python 64 bit version (if available).
4. Install the required Python 64 bit version and ensure your PATH environment variable points to it.

The first thing I recommend to start with is to download Python 3.7. in the documentation https://cyberbotics.com/doc/guide/using-python it is claimed that Webots supports python 3.7 (I think you are using windows). Python 3.8 support is only specified for MacOS and Ubuntu. Download link for Python 3.7: https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe.
When installing, be sure to specify that python should be added to the Path variable (I have circled this field in the figure below with a red rectangle). After installing python, you must restart Webots.
Also using the Windows command line, try running Python using the "python" command, also in the settings in Webots: Tools-Preferences (see the window below) the command that runs Python on your computer is specified. The command to run Python from the command line and the command to run Python specified in Webots-Preferences must match.

Related

Webots using Python 2.7 when Python 3.x is default

On my mac I switched python versions to 3.7 and when using the command python -V in the terminal it shows that it successfully switched. Webots still shows that the deprecated 2.7 version is being used. When I checked the command, it says python
I've messed with creating a runtime.ini as well, which seemed to work but doesn't recognize webot modules like "Controller," or "Robot." Though I can't find anything about what the module names would be and how I could include them in the Options for the runtime.ini with the -m flag.
Any help would be appreciated, thanks
I was able to solve this by setting the absolute path, shown in the image link, to a valid version of Python 3 in the Webots->Preferences command field. I had a slight error with NumPy not coming with this version but was easily fixable by doing <absolute-path-to-version-specified> -m pip install NumPy
I hope this is helpful to others as it was the last thing I tried and cost me some time.
Webots preferences screenshot example

Python executable running on different Linux versions

I need to write a program that will be running in the end on CentOS (Version 6.3 - its a security appliance but I have root access)
I installed a development environment in Ubuntu and used pyinstaller to create a single executable. In PyCharm I can select between Python versions 2.7 and 3.6 - I tried both and created the exe.
The program works fine on Ubuntu, but unfortunately not under CentOS
CentOS shows me Python Version 2.66
Questions:
should it work in general?
I am getting errors- (missing lib's) (but files exist):
"./ICC: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/_MEIoHOzeE/libz.so.1)" - I assume the versions do not match?
is it important which python version is installed on CentOS (2.66) (I was hoping the executable would contain everything needed?)
I used pyinstaller with the option "--onefile"
I added "#!/usr/bin/python" as first line of my source code
if I run the.py file (source code) I get multiple errors:
./ICC.py: line 1: import: command not found
./ICC.py: line 2: import: command not found
./ICC.py: line 13: version: command not found
./ICC.py: line 24: try:: command not found
./ICC.py: line 25: syntax error near unexpected token (' ./ICC.py: line 25: logfile = open ("/tmp/icm-log.txt","w")'
(same code runs fine on ubuntu, guess things have changed in newer python versions which would make sense)
Do I need to write the program in Python 2.66? Do I need to move development to CentOS?
I cannot upgrade Python on CentOS as it might break other things
Any recommendations, ideas, hints on how to make this work.
When you use PyInstaller to create an executable binary you must do so on the target machine or target environment.
The output of PyInstaller is specific to the active operating system and the active version of Python. This means that to prepare a distribution for:
a different OS
a different version of Python
a 32-bit or 64-bit OS
you run PyInstaller on that OS, under that version of Python. The Python interpreter that executes PyInstaller is part of the bundle, and it is specific to the OS and the word size."
More info available here

pysqlcipher installation on ubuntu with Python 3.4 - syntaxerror

I'm following this tutorial to install pysqlcipher, but get a syntax error.
I'm working on Ubuntu 14.04 LTS. I have created a virtual environment with "virtualenv" to use Python 3.4. Despite the tutorial (of the link above), I cannot success to install sqlcipher! The installation crashes when I run this:
python setup.py build_sqlcipher
The error message is this one:
File "setup.py", line 64
print "CFLAGS", os.environ['CFLAGS']
^
SyntaxError: invalid syntax
The project only works on Python 2; it is not compatible with Python 3.
This specific error shows the project is using the Python 2 print statement, which was removed from the language in version 3. It was replaced by a function to do printing instead.
In all likelihood, fixing this one line is not going to be enough. You'll have to ask the project maintainers if they have any plans in supporting Python 3. I see the project already has a ticket open asking for support, it looks like the project is already working on supporting this, but it is not ready at this point in time.
Instead, install Python 2.7 on your Ubuntu machine and run the code with that version.

python does not work

I always downloaded python from python.org and install it on Windows machines (XP and 8 ) easily. On this Windows XP machine however I have the following problem. After installing python2.7 32 bit on the machine , I cannot start neither the interactive python page nor the python shell ( IDLE or GUI ) ( neither form the Windows Start nor from the command line). I set the path in Windows ( and I double checked and renewed the command line shell as well). From the Windows command line when I type the python -- version, I get the python version, so I assume it is installed. When I simply type python from the command line I get :
ImportError: No module name site
When I try python helloworld.py I get the same error message.
I searched around in FAQ, I seems nobody has such problem. I appreciate any help with this problem.
I suggest that you uninstall the Python with Add or Remove Programs in control panel(link on how to do that below)
http://support.microsoft.com/kb/307895
Then use the first download link on the python website or click the link below:
Python Download

Python 2.7 - ImportError: No module named Image

Recently, I have been studying OpenCV to detect and recognize faces using C++. In order to execute source code demonstration from the OpenCV website I need to run Python to crop image first. Unfortunately, the message error is 'ImportError: No module named Image' when I run the Python script (this script is provided by OpenCV website). I installed "python-2.7.amd64" and downloaded "PIL-1.1.7.win32-py2.7" to install Image library. However, the message error is 'Python version 2.7 required, which was not found in the registry'. And then, I downloaded the script written by Joakim Löw for Secret Labs AB / PythonWare to register registry in my computer. But the message error is "Unable to register. You probably have the another Python installation".
I spent one month to search this issue on the internet but I cannot find the answer. Please support me to resolve my issue.
Thanks,
Tran Dang Bao
You installed the 64-bit version of Python, but the 32-bit version of PIL. Either switch to the 32-bit version of Python, or you need a 64-bit version of PIL (not available that I could find). There is pillow, a PIL-compatible replacement that might work. A 64-bit version is available here:
Pillow-2.1.0.win-amd64-py2.7.‌exe
The solution is very simple. You don't need to worry about x86 or 64 bit,
all you have to do is import as follows:
from PIL import Image
but make sure Pillow is installed.
Works for me.
Try to put the python(2.7) at your Windows path.
Do the following steps:
Open System Properties (Win+Pause) or My Computer and right-click then Properties
Switch to the Advanced tab
Click Environment Variables
Select PATH in the System variables section
Click Edit
Add python's path to the end of the list (the paths are separated by semicolons).
example C:\Windows;C:\Windows\System32;C:\Python27

Categories