Home/Support/Support Forum/Missing Python modules, Digi Embedded Yocto
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Missing Python modules, Digi Embedded Yocto

0 votes
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 "<stdin>", line 1, in <module>
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.
asked Sep 3, 2015 in Linux by jfmonaco New to the Community (15 points)

Please log in or register to answer this question.

3 Answers

+1 vote
 
Best answer
You need to add the python-subprocess package to the rootfs.

Add the following lines to your project's conf/local.conf file:
Code:
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 <project>/tmp/work/cortexa9hf-vfp-neon-dey-linux-gnueabi/python/2.7.3-r0.3/packages-split.

Hope this helps.
answered Sep 4, 2015 by jviguera Community Contributor (138 points)
selected Sep 4, 2015 by jfmonaco
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.
0 votes
did you add python interpreter to the rootfs from your rootfs project configuration?
answered Sep 3, 2015 by LeonidM Veteran of the Digi Community (3,556 points)
0 votes
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.

IMAGE_INSTALL_append = " python-subprocess"

Thanks again.
answered Sep 4, 2015 by jfmonaco New to the Community (15 points)
...