# Adding python internal modules (cgi.py)

**URL:** https://forum.legato.io/t/adding-python-internal-modules-cgi-py/3343
**Category:** Legato Linux distribution (Yocto project)
**Created:** [June 18, 2018, 9:16am UTC](https://forum.legato.io/t/adding-python-internal-modules-cgi-py/3343 "2018-06-18T09:16:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lsn](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@lsn](https://forum.legato.io/u/lsn)
#### Post date: [June 18, 2018, 9:16am UTC](https://forum.legato.io/t/adding-python-internal-modules-cgi-py/3343/1 "2018-06-18T09:16:01Z")

</div>

Hello,

I am trying to add some python libraries to my FX30S image.  
So far, I successfully added some libraries.

Some others, like _sqlalchemy_, was requiring some python internal module named “_dummy\_threading_” and thus producing some error output stating "No module named ‘dummy\_threading’ ".  
I found out you can solve this issue by adding _‘python-threading’_ to the image.

Unfortunately, I came across a similar issue with the ‘_python-requests_’ library, which cannot be imported throwing 'No module named ‘cgi’ ".  
_cgi.py_ seems to be a python internal module, much like _‘dummy\_threading’_, but I can’t find a way to include it to my image.

Does anyone have a solution to this ?

Lucas

Additionnal info:  
FX30S firmware version R13  
Python 2.7.3

---

<div class="post-metadata">

### Author: ![Manukumar](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Manukumar](https://forum.legato.io/u/Manukumar)
#### Post date: [June 25, 2018, 12:46pm UTC](https://forum.legato.io/t/adding-python-internal-modules-cgi-py/3343/2 "2018-06-25T12:46:04Z")

</div>

We can suggest you to update python version.We have seen that in “poky/meta/recipes-devtools/python/python-3.3-manifest.inc” there is “+FILES\_${PN}-netserver” through which it is taking python 3.3 version.PLease change to version python3.5 by updating FILES\_${PN}-netserver to +FILES\_${PN}-netserver="${libdir}/python3.5/cgi.\* ${libdir}/python3.5/_HTTPServer._ ${libdir}/python3.5/SocketServer.\* "  
probably this might resolve “No module named ‘cgi’”.

Also, We observed that in meta-openembedded/meta-python/recipes-devtools/python/python-cython.inc there is no “python-distribute” in the “RDEPENDS\_$PN” we can add and try the same

---

<div class="post-metadata">

### Author: ![lsn](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@lsn](https://forum.legato.io/u/lsn)
#### Post date: [June 27, 2018, 9:42am UTC](https://forum.legato.io/t/adding-python-internal-modules-cgi-py/3343/3 "2018-06-27T09:42:31Z")

</div>

Thank you for your help !

Some python internal modules must be explicitly added to the image (as runtime dependencies for example).  
As you mentioned, looking at `poky/meta/recipes-devtools/python/python-X.Y-manifest.inc` indicates what module contains what package.  
In this case, adding `python-netserver` will make `cgi.py` available.  
No need to upgrade the python version to 3.5, this will even work with python 2.

External reference : [Adding python internal modules (cgi.py) to yocto image - Stack Overflow](https://stackoverflow.com/questions/50906293/adding-python-internal-modules-cgi-py-to-yocto-image)
