ArduPilot / ArduPilot/pymavlink

pip install fails for python >= v3.7 in docker

Open
#486 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
728
Forks
739
Avg merge
4d 10h
Merged PRs (30d)
7

Description

The documentation says
> It is recommended to install pymavlink from PyPI with pip, that way dependencies should be auto installed by pip.
> sudo python -m pip install --upgrade pymavlink

### Using python v3.6 OK
Create a dockerfile with the following content,
```Dockerfile
FROM python:3.6

RUN python -m venv /opt/venv && . /opt/venv/bin/activate
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /opt/venv

RUN pip install --upgrade pymavlink
```
Then build it,
```sh
docker build -t test .
```
#### Result
It will build fine.

### Using python >= v3.7 FAILS
Update and build the dockerfile from previous example,
```Dockerfile
FROM python:3.7
...
```

#### Result
The pip install of pymavlink fails,
```sh
Downloading pymavlink-2.4.14.tar.gz (4.1 MB)
ERROR: Command errored out with exit status 1:
command: /opt/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uxdat5ec/pymavlink/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uxdat5ec/pymavlink/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-4ausdmc0
cwd: /tmp/pip-install-uxdat5ec/pymavlink/
Complete output (44 lines):
WARNING: The wheel package is not available.
ERROR: Command errored out with exit status 1:
command: /opt/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-6f9ect9_/future/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-6f9ect9_/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aplvpm4y
cwd: /tmp/pip-wheel-6f9ect9_/future/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for future
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "/opt/venv/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/venv/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp7f5svmnk', '--quiet', 'future']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-uxdat5ec/pymavlink/setup.py", line 181, in
ext_modules = extensions
File "/opt/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 143, in setup
_install_setup_requires(attrs)
File "/opt/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/opt/venv/lib/python3.7/site-packages/setuptools/dist.py", line 698, in fetch_build_eggs
replace_conflicting=True,
File "/opt/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 783, in resolve
replace_conflicting=replace_conflicting
File "/opt/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1066, in best_match
return self.obtain(req, installer)
File "/opt/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1078, in obtain
return installer(requirement)
File "/opt/venv/lib/python3.7/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
return fetch_build_egg(self, req)
File "/opt/venv/lib/python3.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
raise DistutilsError(str(e))
distutils.errors.DistutilsError: Command '['/opt/venv/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp7f5svmnk', '--quiet', 'future']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Dockerfile examples in the issue and reproduce the failure by running docker build with Python 3.7 or newer, comparing it with Python 3.6. Trace the pymavlink installation and its future wheel error; done means pip install --upgrade pymavlink completes successfully on the affected Python versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.