Missing Python modules, Digi Embedded Yocto

Hi all,

I am using the ConnectCard i.MX28 Jump Start eval board, and have been experimenting with the minimal (i.e. non-graphical) build of Digi Embedded Yocto.

I am in the process of fleshing out a Python based script that I want to run on the device, and have encountered errors related to missing Python modules.

My application leverages the subprocess module, part of the Python Standard Library.

https://docs.python.org/2/library/subprocess.html

On the ccardimx28js, I see the following upon attempts to import it …

root@ccardimx28js:~# python
Python 2.7.3 (default, Sep 3 2015, 13:19:15)
[GCC 4.8.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import subprocess
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named subprocess
>>>

I do see the subprocess module in the list of rpms (in the workspace/ccardimx28js/tmp/deploy/arm5vte/rpm directory).

There is not much information in the public literature about resolving problems like this for Python in the Yocto framework, and the few discussions on the topic that I find seem to go unresolved and/or abruptly end.

Also, I attempted to add this and remake the image by adding the following to my local.conf file per a suggestion in one of the aforementioned threads.

TOOLCHAIN_HOST_TASK_append = " nativesdk-python-subprocess"

This had no effect. I still get the error that subprocess is not a recognized Python module.

Any help is sincerely appreciated.

Thanks in advance.

did you add python interpreter to the rootfs from your rootfs project configuration?

Hello Leonid,

Thanks for the prompt reply and recommendation.

I did not explicitly add anything to the root filesystem configuration (at least initially).

Even in that scenario, using the default Digi minimal, non-graphical build of embedded Yocto, I did have some basic Python capabilities in the resultant image. I was able to launch Python, import modules like math, OS, shlex, etc. But the subprocess module was not available, which surprised me as that is part of the Python standard library.

Since posting the question, I believe I have found a solution that works for me. Adding the following to the local.conf configuration file gives me access to the Python subprocess module and all its attendant methods.

[b]IMAGE_INSTALL_append = " python-subprocess"[/b]

Thanks again.

You need to add the python-subprocess package to the rootfs.

Add the following lines to your project’s conf/local.conf file:

IMAGE_INSTALL_append = " python-subprocess"

(Notice the space before python-subprocess. This is needed by the _append operator)

In general if you need to know the package name of one specific python module, you can have a look at the directory name that contains the needed files under /tmp/work/cortexa9hf-vfp-neon-dey-linux-gnueabi/python/2.7.3-r0.3/packages-split.

Hope this helps.

1 Like

Thanks for the confirmation. Per the post yesterday evening, this is exactly how I resolved the issue; still a bit surprising to me that part of the standard library is not part of the Digi embedded Python solution.

I will accept this answer as the correct one; seems more appropriate than accepting my own reply to the question.