Building Torizon on Krikston (6.x.y) branch

Hi
I need to make image with Python 3.9 and 3.10 Integrated in my custom image .
As the latest Python version of The Branch Dunfell is 3.813 and The both “Torizon” and" tdx-Refrence-Minimal-image" are based on Dunfell right know I need a solution for adding newer python to project .
beside that a have seen That the Krikstone6.x.y has been made as the main branch for meta-toradex-toizon in toradex github and the Krikston branch supports python3.10.

Please give me solution about how I can build my image base on Krikston branch.
I’m using Colibri iMX7D 1GB.
cheers joe.

Hi @joe.hiko ,

At the time of writing this a TorizonCore release based on Kirkstone is currently under active development and we don’t recommend using it for production.

If you only need an updated version of Python you can try building TorizonCore with the Dunfell branch, but substituting the python3 recipe with a more recent one that has the version you want e.g. OpenEmbedded Layer Index - python3.

Just keep in mind that using a more up-to-date recipe could give you some dependency errors when building the image, so it might not be a straightforward process.

Another alternative is running a more recent Python 3 version in a container. It’s probably an easier solution if it fits your use-case.

Let me know if this helps you.

Best regards,
Lucas Akira

Thanks for your response
i am actually new to yocto, and my company need python3.9 on the main linux not container .
i am going to add python3 3.9.9 recipe from hardknott branch(or any other recipe that you suggest is easier to add ) . but i need help in this process as I’m new to yocto .it would be nice if you could help me with this process.
Thanks in Advance
Joe

Hi @joe.hiko ,

Sure, these links should help you get started with basic Yocto setup:

As for upgrading Python, you would probably want to backup layers/openembedded-core/meta/recipes-devtools/python/ before starting.

I suggest you start by putting the recipe python3_3.9.9.bb and the python3 directory from Hardknott in layers/openembedded-core/meta/recipes-devtools/python/, merging with the python3 folder from Dunfell in the process.

After that try building Python with bitbake -k python3, looking for error messages if any appear. If it completes successfully you can try building TorizonCore itself.

Best regards,
Lucas Akira

Thanks Akira
i have done what you said i have added the python3_3.9.9.bb instead of The old version and by changing some patches and try and error i finally compiled the Python3.9.9 recipe successfully.
But The problem is that when i try build the image. i got error from the other dependencies .
and most of them is just for setuptool !!! .

Log data follows:
| DEBUG: Executing shell function do_compile
| Running from numpy source directory.
| Traceback (most recent call last):
|   File "/home/pokileda/Desktop/secc/image-project/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/python3-numpy/1.17.4-r0/numpy-1.17.4/setup.py", line 444, in <module>
|     setup_package()
|   File "/home/pokileda/Desktop/secc/image-project/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/python3-numpy/1.17.4-r0/numpy-1.17.4/setup.py", line 421, in setup_package
|     from setuptools import setup
| ModuleNotFoundError: No module named 'setuptools'
| ERROR: 'python3 setup.py build ' execution failed.
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/pokileda/Desktop/secc/image-project/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/python3-numpy/1.17.4-r0/temp/run.do_compile.3059694' failed with exit code 1

This is The example for Numpy when i tried to bake it by bitbake -k python3-numpy regards Joe

Hi @joe.hiko ,

I did some tests on my side and I ended up with the same setuptool errors you’re getting, and I couldn’t find a lot of information online on how to solve this.

I’m not a Yocto expert either, so it looks like adapting this recipe will be a difficult and long process, if even viable to do so.

In this case I have a few suggestions:

  • Do you really need Python 3.9 on the OS itself? TorizonCore was made to run applications on containers, so it will probably be easier to adapt your use-case than to continue with Yocto;

  • You can also wait until we have nightly builds of TorizonCore 6, which is based on Kirkstone that has Python 3.10. Our current goal is to provide them in the next 2 weeks if everything goes as expected. Just keep in mind that these first nightly releases might not even boot on some SoMs.

Best regards,
Lucas Akira

Hi @joe.hiko ,

We managed to put Python 3.9.9 in TorizonCore 5.7.0 with a custom layer using Yocto. You can take a look here: Upgrade python version in TorizonCore with yocto - #7 by lucas_a.tx.

You can disregard the changes I suggested in my previous answers, use a clean TorizonCore Yocto build and follow the instruction in the link above.

See if this helps you.

Best regards,
Lucas Akira

2 Likes

Thank You Akira
ill give a try and see if every things goes well :slight_smile:
Thanks Joe

Hi Akira
I have tried to Put Python 3.9.9 in image as instruction you have mentioned but i faced the error

ERROR: python3.9-3.9.9-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: '/home/pokileda/Desktop/secc/image-project/build/../layers/openembedded-core/meta/classes/staging.bbclass', lineno: 581, function: extend_recipe_sysroot
     0577:                    if "/bin/" in l or "/sbin/" in l:
     0578:                        # defer /*bin/* files until last in case they need libs
     0579:                        binfiles[l] = (targetdir, dest)
     0580:                    else:
 *** 0581:                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0582:
     0583:    # Handle deferred binfiles
     0584:    for l in binfiles:
     0585:        (targetdir, dest) = binfiles[l]
File: '/home/pokileda/Desktop/secc/image-project/build/../layers/openembedded-core/meta/classes/staging.bbclass', lineno: 156, function: staging_copyfile
     0152:        os.symlink(linkto, dest)
     0153:        #bb.warn(c)
     0154:    else:
     0155:        try:
 *** 0156:            os.link(c, dest)
     0157:        except OSError as err:
     0158:            if err.errno == errno.EXDEV:
     0159:                bb.utils.copyfile(c, dest)
     0160:            else:
Exception: FileExistsError: [Errno 17] File exists: '/home/pokileda/Desktop/secc/image-project/build/tmp/sysroots-components/x86_64/python3-native/usr/lib/python-sysconfigdata/_sysconfigdata.py' -> '/home/pokileda/Desktop/secc/image-project/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/python3.9/3.9.9-r0/recipe-sysroot-native/usr/lib/python-sysconfigdata/_sysconfigdata.py'

That i think the problem is from The directory of python is already exist .
what should i do to solve this problem ?
Regards.

Hi @joe.hiko ,

I’ve updated the layer and the Pyhon 3.9 recipe, and this error should be fixed. Can you try doing a clean build with it?

Best regards,
Lucas Akira

Hi Akira
I have successfully compiled python 3.9 with the Recipe That you have provided .but i had a problem with installing python packages for python3.9 as we had 2 python and setuptool installs the packages for python 3.8 .
I came with a better idea ,and i have added the python3.9 from honister branch . and i replace it with 3.8 in openembeded recipe . despite the python 3.9 from hardknott branch i had no setup tools problem further by updating some other recipe i have successfully compiled python 3.9 for dunfell branch .
also thank you for your support and if you want i can give you more detail about what i have done .
cheers joe.

Hi @joe.hiko ,

Glad you were able to find a solution! Please, if you can give more details about what you did, that would be really helpful.

Best regards,
Lucas Akira