Debian 9.4 Server
krogoth
, BitBake Build Tool Core version 1.30.0
devtool
They should be available as python3.5 packages on the hardware
I want to create recipes for:
I use the following steps in my $BUILD_DIR
:
devtool add pynmea2 https://github.com/Knio/pynmea2/archive/v1.7.1.tar.gz
devtool add influxdb-python https://github.com/influxdata/influxdb-python/archive/v5.2.0.tar.gz
I get the recipes from the tools. I change the RDEPENDS_${PN} += "python-re"
to RDEPENDS_${PN} += "${PYTHON_PN}-re"
for all runtime dependencies and shift this information to their respective .inc
files. The files are mentioned below in the Github Gist
Gists for pynmea2 and influxdb-python
for local tests, I add these recipes from the workspace
folder (created automatically by devtool
) to the local.conf
under `IMAGE_INSTALL_append = " influxdb-python pynmea2"
and burn the image for the hardware.
On the board, I run the python3
shell to see if I can import these packages. Here is the output from the shell:
pynmea2:
Python 3.5.1 (default, Sep 25 2018, 19:27:54)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynmea2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/site-packages/pynmea2/__init__.py", line 13, in <module>
from .types import *
File "/usr/lib/python3.5/site-packages/pynmea2/types/__init__.py", line 3, in <module>
from .talker import *
File "/usr/lib/python3.5/site-packages/pynmea2/types/talker.py", line 3, in <module>
from ..nmea_utils import *
File "/usr/lib/python3.5/site-packages/pynmea2/nmea_utils.py", line 2, in <module>
import datetime
ImportError: No module named 'datetime'
influxdb-python:
Python 3.5.1 (default, Sep 25 2018, 19:27:54)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import influxdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/site-packages/influxdb/__init__.py", line 9, in <module>
from .client import InfluxDBClient
File "/usr/lib/python3.5/site-packages/influxdb/client.py", line 14, in <module>
import requests
File "/usr/lib/python3.5/site-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/lib/python3.5/site-packages/requests/utils.py", line 12, in <module>
import cgi
File "/usr/lib/python3.5/cgi.py", line 30, in <module>
from email.parser import FeedParser
File "/usr/lib/python3.5/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.5/email/feedparser.py", line 27, in <module>
from email import message
File "/usr/lib/python3.5/email/message.py", line 16, in <module>
from email import utils
File "/usr/lib/python3.5/email/utils.py", line 30, in <module>
import datetime
ImportError: No module named 'datetime'
If I run the python
command on the board and try import datetime
, the module exists.
What is the problem? Why isn't datetime
available as a module for python 3.5
?
local.conf
snippet
IMAGE_INSTALL_append = " python3 python3-dev python3-enum pynmea2 influxdb-python python3-pyserial "
I also explicitly added IMAGE_INSTALL_append = " python3-datetime"
in the local.conf
file. But still the same error.
python-3.5-manifest.inc
SUMMARY_${PN}-modules="All Python modules"
RDEPENDS_${PN}-modules="${PN}-2to3 ${PN}-argparse ${PN}-asyncio ${PN}-audio ${PN}-codecs ${PN}-compile ${PN}-compression ${PN}-core ${PN}-crypt ${PN}-ctypes ${PN}-curses ${PN}-datetime ${PN}-db ${PN}-debugger ${PN}-difflib ${PN}-distutils ${PN}-doctest ${PN}-email ${PN}-enum ${PN}-fcntl ${PN}-gdbm ${PN}-html ${PN}-idle ${PN}-image ${PN}-importl
ib ${PN}-io ${PN}-json ${PN}-lang ${PN}-logging ${PN}-mailbox ${PN}-math ${PN}-mime ${PN}-mmap ${PN}-multiprocessing ${PN}-netclient ${PN}-netserver ${PN}-numbers ${PN}-pickle ${PN}-pkgutil ${PN}-pprint ${PN}-profile ${PN}-pydoc ${PN}-re ${PN}-readline ${PN}-reprlib ${PN}-resource ${PN}-selectors ${PN}-shell ${PN}-signal ${PN}-smtpd ${PN}-sqlit
e3 ${PN}-sqlite3-tests ${PN}-stringold ${PN}-subprocess ${PN}-syslog ${PN}-terminal ${PN}-tests ${PN}-textutils ${PN}-threading ${PN}-tkinter ${PN}-unittest ${PN}-unixadmin ${PN}-xml ${PN}-xmlrpc "
ALLOW_EMPTY_${PN}-modules = "1"
the manifest file already has datetime
in it? What should I change in the file if at all necessary? (should I add it in a meta-custom
layer?)
I saw a small snippet of This particular blogpost which mentions using python-modules
in the INSTALL_IMAGE_append
.
Having seen the python-3.5-manifest.inc
file mentioned in the question; I saw that the -modules
will provide me all the basic modules needed for my app to run.
Hence, in the local.conf
file I added IMAGE_INSTALL_appends = " python3-modules"
and loaded the image on the hardware. This infact worked perfectly.
Now in the python3 shell, I do not receive any datetime
module errors.
local.conf
nowIMAGE_INSTALL_append = " python3-modules influxdb-python pynmea2 pyserial"
This works perfect.
I am not sure at this point if i should add ${PYTHON_PN}-modules
in the RDEPENDS_${PN}
for the recipes of influxdb-python
and pynmea2
.
I updated the GitHub gists which now added ${PYTHON_PN}-modules
in the RDEPENDS
and it works on the board.
As a I understand adding python3-modules
would increase your image footprint since it needs to add a lot of modules in the rootfs. But these modules seem to be important to run many types of application, so there is an upside to it.