Can't run script in Olympe

I would like to control my drone, so I have installed ubuntu and followed a guide for Olympe.

Everything went good, I made a script called I did the “setup your shell environment” and " Create a simulated drone" part. But when I run:

(olympe-python3) $ python ./"

I get a ImportError, telling me that indent from textwrap can not import.

Then I have tried to run:

$ python3 ./"

But same problem, just not with “textwrap” but with “future”.

Do anyone know what I can do?

1 Like


There is currently multiple new dependencies issues that have been reported this week. The most important is a regression in the olympe postinst script with virtualenv 20.0 that has just been released.

If you look carefully at the postinst script log you should see that the script fails to install the olympe Pyhton virtual environment.

We may have to make a bugfix release for this issue just before the next 1.2.0 GSDK release that is currently in preparation.

In the meantime, here is a patch and a fixed version of the postinst script for virtualenv 20.0.1

diff --git a/linux/env/postinst b/linux/env/postinst
index e5a1c61..3d75366 100755
--- a/linux/env/postinst
+++ b/linux/env/postinst
@@ -65,9 +65,7 @@ PYTHON=${PYTHON_TMPENV_DIR}/bin/python3
 env -i PATH=/usr/bin:/bin ${PYTHON} -EsS "${GET_PIP}" --prefix "${PYTHON_TMPENV_DIR}" --no-warn-script-location virtualenv --ignore-installed
 # Now that we have this new python env, create our definitive virtualenvs
-if [ ! -e "${PYTHON_ENV_DIR}/py3/bin/python" ]; then
+PYTHONUSERBASE="${PYTHON_TMPENV_DIR}" ${PYTHON} -m virtualenv --copies -p ${PYTHON} ${PYTHON_ENV_DIR}/py3
 rm -rf "${BOOTSTRAP_DIR}"
# This script install olympe dependencies
# Usage:
# bash postinst

set -e

SCRIPT_PATH="`readlink -f "$0"`"
ENV_DIR="`dirname "$SCRIPT_PATH"`"
COMMON_DIR="`dirname "$ENV_DIR"`"
ARSDK_DIR="`dirname "$COMMON_DIR"`"
PRODUCT_DIR="`dirname "$ARSDK_DIR"`"
ROOT_DIR="`dirname "$PRODUCT_DIR"`"

# Check if we need to sudo things
if [ "$(id -u)" != "0" ]
  echo "This script might prompt you for your sudo password."

# Install system packages with apt
${SUDO} apt-get update || true # who doesn't have invalid/broken apt sources

# Install python
${SUDO} apt-get -y install python3 python3-dev python3-pip wget

# olympe-deps build dependencies
${SUDO} /usr/bin/python3 -m pip install clang
CLANG_VERSION=$(/usr/bin/python3 -m pip show clang |grep '^Version' |cut -d' ' -f2 |cut -c1-3)
${SUDO} apt-get -y install libclang-${CLANG_VERSION}-dev

# pdraw dependencies
${SUDO} apt-get -y install build-essential yasm cmake libtool libc6 libc6-dev \
  unzip freeglut3-dev libglfw3 libglfw3-dev libsdl2-dev libjson-c-dev \
  libcurl4-gnutls-dev libavahi-client-dev libgles2-mesa-dev

# ffmpeg build dependencies
${SUDO} apt-get -y install rsync

# arsdk build dependencies
${SUDO} apt-get -y install cmake libbluetooth-dev libavahi-client-dev \
    libopencv-dev libswscale-dev libavformat-dev \
    libavcodec-dev libavutil-dev cython python-dev

# Bootstrap a python environment
# First, we need a temporary valid python environment for pip/virtualenv
rm -rf "${BOOTSTRAP_DIR}"
mkdir -p ${BOOTSTRAP_DIR}
wget -O "${GET_PIP}"

# Python 3 tmp env
mkdir -p "${PYTHON_TMPENV_DIR}/bin"
env -i PATH=/usr/bin:/bin ${PYTHON} -EsS "${GET_PIP}" --prefix "${PYTHON_TMPENV_DIR}" --no-warn-script-location virtualenv --ignore-installed

# Now that we have this new python env, create our definitive virtualenvs
rm -rf "${BOOTSTRAP_DIR}"

PY_REQS_TXT=$(find "${MODULES_DIR}/" -maxdepth 3 -mindepth 1 -name requirements.txt)

# Perform a clean pip installation of all dependencies:
#  - use ignore-installed to force the installation of a package even if it is
#    present outside the virtual env
#  - prior to this brutal installation, uninstall every dependencies so that
#    files that belong to a previous version of a dependency are removed
${ENV_DIR}/setenv pip uninstall --yes $(echo "$PY_REQS_TXT"|xargs -d '\n' -I{} echo -r {})
${ENV_DIR}/setenv pip install --ignore-installed $(echo "$PY_REQS_TXT"|xargs -d '\n' -I{} echo -r {})

# Add workspace builts python package directory to sys.path
from sys import version_info;
print('{}.{}'.format(version_info.major, version_info.minor))
cp "${ENV_DIR}/python/" "$PY_PREFIX/lib/python$PY_XY"

Thank you so much. Should I just run this code in a terminal?


You should apply the patch above (the first snippet) or completely replace the content of ./product/olympe/linux/env/postinst with the corrected version (the second code snippet above).
Then just execute this script again and follow the normal installation procedure from there.



I got the same problem and changed the postint file but I get a new error :

Traceback (most recent call last):
File “./”, line 3, in
import olympe
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/”, line 6, in
import olympe.arsdkng.module_loader
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/”, line 60, in
from olympe.arsdkng.messages import ArsdkMessages, ArsdkMessage
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/”, line 57, in
import olympe_deps as od
ModuleNotFoundError: No module named ‘olympe_deps’

Have you rebuild Olympe as explained in the installation procedure after running the modified postinst script ? ./ -p olympe-linux -A all final -j4

thank you for your time and attention

yes I rebuild Olympe after modified postint script.

I tried on an other computer and I get the same error.
When I build and when I check the installation there is no error.

Hi ! I tried to install Olympe with fixed postinst you linked here, but I’ve the same error than Sacha:
"ModuleNotFoundError: No module named ‘olympe_deps’ "

at " import Olympe "…

1 Like

I used the patch you mentioned above, deleted all the file and redone all the procedure in the official wiki.
My error changes from “ImportError” to “ModuleNotFoundError: No module named ‘olympe_deps’”.
Interestingly, not like before, all the command didn’t report any errors, but “import olympe” did.
Looking forward to some workarounds for this issue.

1 Like