Hey.
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 takeoff.py. I did the “setup your shell environment” and " Create a simulated drone" part. But when I run:
(olympe-python3) $ python ./takeoff.py"
I get a ImportError, telling me that indent from textwrap can not import.
Then I have tried to run:
$ python3 ./takeoff.py"
But same problem, just not with “textwrap” but with “future”.
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 -p ${PYTHON} ${PYTHON_ENV_DIR}/py3
-fi
+PYTHONUSERBASE="${PYTHON_TMPENV_DIR}" ${PYTHON} -m virtualenv --copies -p ${PYTHON} ${PYTHON_ENV_DIR}/py3
PYTHON=/usr/bin/python3
rm -rf "${BOOTSTRAP_DIR}"
#!/bin/bash
# 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"`"
MODULES_DIR="${ROOT_DIR}/packages"
PYTHON_ENV_DIR="${OLYMPE_PYTHON_ENV_DIR:-${ROOT_DIR}/.python}"
# Check if we need to sudo things
if [ "$(id -u)" != "0" ]
then
SUDO="sudo"
echo "This script might prompt you for your sudo password."
else
SUDO=""
fi
# 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
PYTHON=/usr/bin/python3
BOOTSTRAP_DIR=/tmp/olympe/bootstrap
PYTHON_TMPENV_DIR="${BOOTSTRAP_DIR}/tmppython"
GET_PIP="${BOOTSTRAP_DIR}/get-pip.py"
rm -rf "${BOOTSTRAP_DIR}"
mkdir -p ${BOOTSTRAP_DIR}
wget https://bootstrap.pypa.io/get-pip.py -O "${GET_PIP}"
# Python 3 tmp env
mkdir -p "${PYTHON_TMPENV_DIR}/bin"
cp ${PYTHON} ${PYTHON_TMPENV_DIR}/bin
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
PYTHONUSERBASE="${PYTHON_TMPENV_DIR}" ${PYTHON} -m virtualenv --copies -p ${PYTHON} ${PYTHON_ENV_DIR}/py3
PYTHON=/usr/bin/python3
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
PY_PRINT_VERSION=$(cat <<-END
from sys import version_info;
print('{}.{}'.format(version_info.major, version_info.minor))
END
)
PY_XY=$($PYTHON -c "$PY_PRINT_VERSION")
PY_PREFIX="$PYTHON_ENV_DIR/py3"
cp "${ENV_DIR}/python/sitecustomize.py" "$PY_PREFIX/lib/python$PY_XY"
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 “./takeoff.py”, line 3, in
import olympe
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/init.py”, line 6, in
import olympe.arsdkng.module_loader
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/module_loader.py”, line 60, in
from olympe.arsdkng.messages import ArsdkMessages, ArsdkMessage
File “/home/linux/code/parrot-groundsdk/packages/olympe/src/olympe/arsdkng/messages.py”, 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 ? ./build.sh -p olympe-linux -A all final -j4
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’ "
Hi.
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.
Hello,
unfortunately i also have the same error. i tried it twice with a new ubuntu installation and the patch which was mentioned above.
could any of you come to a solution?
Thanks
Hi.
I tried the manual installation in the wiki. Here are errors I encountered during the process.
ERROR: sphinxcontrib-seqdiag 2.0.0 has requirement Sphinx>=2.0, but you’ll have sphinx 1.8.5 which is incompatible.
I encountered this error when I am trying to install the dependencies in parrot-groundsdk/packages/olympe/requirements.txt. Perhaps the package sphinxcontrib-seqdiag also needs a specific version. I finally installed sphinxcontrib-seqdiag-0.8.5.
WARNING:clangparser:missing terminating ‘"’ character (/home/wangyz/code/parrot-groundsdk/packages/common/libvideo-buffers/implem/generic/include/video-buffers/vbuf_generic.h:355:38)
WARNING:clangparser:missing terminating ‘"’ character (/home/wangyz/code/parrot-groundsdk/packages/common/arsdk-ng/libarsdk/include/arsdk/arsdk.h:355:38)
WARNING:clangparser:missing terminating ‘"’ character (/home/wangyz/code/parrot-groundsdk/packages/common/arsdk-ng/libarsdkctrl/include/arsdkctrl/arsdkctrl.h:355:38)
WARNING:clangparser:missing terminating ‘"’ character (/home/wangyz/code/parrot-groundsdk/packages/common/arsdk-ng/libarsdkctrl/include/arsdkctrl/internal/arsdk_discovery_internal.h:355:38)
I found these warnings during the building. However, the script finally says Finished task 'alchemy'. I just ignored these warnings.
Here are the info by the script that might be useful.
wangyz@Inspiron-7447:~/code/parrot-groundsdk$ source ./products/olympe/linux/env/shell
bash: /home/wangyz/code/parrot-groundsdk/.python//py3/bin/activate: No such file or directory.
(olympe-python3) wangyz@Inspiron-7447:~/code/parrot-groundsdk$ pip --version
Traceback (most recent call last):
File “/home/wangyz/.local/bin/pip”, line 7, in
from pip._internal.cli.main import main
ImportError: No module named _internal.cli.main
When I tried to get the version of pip in the virtual env, it reported error like this, and this is where i got stuck.
You have a broken pip installation on your machine.
To repair your pip installation you should :
try to : python3 -m pip uninstall pip
(In your case this will uninstall ~/.local/bin/pip* after you’ve confirmed the uninstall)
If 1. fails with a permission denied error, then you should just sudo the previous command: sudo python3 -m pip uninstall pip
please note that you should AVOID AT ALL COST ANY sudo pip in the future if you don’t want to break your system package management tools (apt and python3-pip).
If pip --version fails again then you have to (re-)install python3-pip : sudo apt install python3-pip --reinstall
Hi.
Thank you for your timely reply. But I still got errors like this in activating the virtual environment:
wangyz@Inspiron-7447:~/code/parrot-groundsdk$ source ./products/olympe/linux/env/shell
bash: /home/wangyz/code/parrot-groundsdk/.python//py3/bin/activate: No such file or directory.
However, I still got (olympe-python3) prompt after the error. And, I did get the response of pip --version, but the pip seems to be my system pip:
(olympe-python3) wangyz@Inspiron-7447:~/code/parrot-groundsdk$ pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
Would you give me some workarounds in setting the right venv?
Thanks.
Doing all the mentioned above, i could achieve Installation Ok for the following - python -c ‘import olympe; print(“Installation OK”)’ as mentioned in the olympe doc here - Installation - Olympe 1.8.0 documentation
Thank for the patch. I successfully installed the environment despite some warnings when I used the Manual dependency installation, maybe they are useful for you:
Ignoring faulthandler: markers 'python_version <= "2.7"' don't match your environment
Ignoring futures: markers 'python_version <= "2.7"' don't match your environment
Ignoring textwrap3: markers 'python_version <= "2.7"' don't match your environment
Everyting other than that seems to work fine.
By the way, since the olympe module runs in a virtual environment, how can I debug my script in IDEs like PyCharm?
I did never get it to work. I got help from a professor at my university, but even together, we could not fix it. I did however make a very nice project. I bought the Parrot AR 2 drone, and used a API called PS-drone. Amazing API, very user friendly.