OTA_Using_HTTPS and OTA_Using_MQTT failed to build using MTB 3.0

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
stan4233_475378
Moderator
Moderator
Moderator
5 solutions authored 25 replies posted 10 questions asked

Hello, I'm unable to build the examples "OTA_Using_HTTPS" and "OTA_Using_MQTT" using MTB 3.0.  I have tried BSP "CY8CPROTO-062-4343W" and "CY8CEVAL-062S2-LAI-4373M2".  The error happened during the linking step:

ModuleNotFoundError: No module named 'cryptography.hazmat.primitives.asymmetric.ed25519' 

There were also some compile warnings.  Please find attached logs.

Thank you!

0 Likes
1 Solution
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

I was able to build the CE's after doing some changes. The reason for these build errors is that python3 installed on your machine doesn't have required packages or has an older version of a package. You can follow the below steps to avoid errors and build successfully.

1. First, visit the below link, copy the contents and paste them in a created txt file named "requirements.txt" on your linux machine.

(https://github.com/mcu-tools/mcuboot/blob/main/scripts/requirements.txt)

2. Run the below cmd on your terminal to update cryptography package. If you get any error in this step, you need to update pip first and then update cryptography. If python version is 3.6 or older, you will get "CryptographyDeprecationWarning" error. So, install python newer than 3.6 version

Updating pip - (python3 -m pip install --upgrade pip)

Updating cryptography - (python3 -m pip install --upgrade cryptography)

3. Install cbor package, if you don't have already.

(python3 -m pip install cbor)

4. Do "cd" to the path where the "requirements.txt" file is present and run the below cmd. You should get "Requirement already satisfied" msg and installed "intelhex", "cbor2" packages if you don't have already.

python3 -m pip install -r requirements.txt)

5. Now, you can open MTB IDE and hopefully build CE without any errors.

Thanks

View solution in original post

6 Replies
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

In the attached logs, I see ubuntu64 in the path of MTB. Are you using ubuntu machine for building the code example? If so, have you tried building with windows machine? 

I will try to build the example and see if i get the same errors. I will let you know the result.

Thanks

0 Likes
stan4233_475378
Moderator
Moderator
Moderator
5 solutions authored 25 replies posted 10 questions asked

Hello, unfortunately, I only have run MTB on Ubuntu.

0 Likes

Hi,

I am able to build the application successfully for CY8CPROTO-062-4343W kit using MTB on windows machine. I will try to build on linux machine as well to check for those errors.

Thanks

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

When i build the above code examples in MTB running on linux machine, I've also got the same errors. From my analysis, it looks like default cryptography package is installed in python sub directory of tools on windows MTB installation folder which is not the case with linux MTB. I am trying different things to make it work like updating cyrptography package on linux machine. I will let you know if it gets resolved.

Thanks

0 Likes
Phanindra_I
Moderator
Moderator
Moderator
250 sign-ins 10 likes given 25 likes received

Hi,

I was able to build the CE's after doing some changes. The reason for these build errors is that python3 installed on your machine doesn't have required packages or has an older version of a package. You can follow the below steps to avoid errors and build successfully.

1. First, visit the below link, copy the contents and paste them in a created txt file named "requirements.txt" on your linux machine.

(https://github.com/mcu-tools/mcuboot/blob/main/scripts/requirements.txt)

2. Run the below cmd on your terminal to update cryptography package. If you get any error in this step, you need to update pip first and then update cryptography. If python version is 3.6 or older, you will get "CryptographyDeprecationWarning" error. So, install python newer than 3.6 version

Updating pip - (python3 -m pip install --upgrade pip)

Updating cryptography - (python3 -m pip install --upgrade cryptography)

3. Install cbor package, if you don't have already.

(python3 -m pip install cbor)

4. Do "cd" to the path where the "requirements.txt" file is present and run the below cmd. You should get "Requirement already satisfied" msg and installed "intelhex", "cbor2" packages if you don't have already.

python3 -m pip install -r requirements.txt)

5. Now, you can open MTB IDE and hopefully build CE without any errors.

Thanks

stan4233_475378
Moderator
Moderator
Moderator
5 solutions authored 25 replies posted 10 questions asked

Hi,

Thank you! Your solution works!  Now the projects (OTA_Using_HTTPS, OTA_Using_MQTT and Bluetooth_LE_Battery_Server) are able to build successfully in MTB 3.0.

============================================================

ubuntu64@ubuntu:~$ gedit requirements.txt &

ubuntu64@ubuntu:~$ python3 --version
Python 3.6.9

ubuntu64@ubuntu:~$ python3 -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2... (1.7MB)
100% |████████████████████████████████| 1.7MB 671kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1

ubuntu64@ubuntu:~$ python3 -m pip install --upgrade cryptography
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (2.1.4)
Collecting cryptography
Downloading cryptography-38.0.3-cp36-abi3-manylinux_2_24_x86_64.whl (4.1 MB)
|████████████████████████████████| 4.1 MB 4.7 MB/s
Collecting cffi>=1.12
Downloading cffi-1.15.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (402 kB)
|████████████████████████████████| 402 kB 5.9 MB/s
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
|████████████████████████████████| 118 kB 13.8 MB/s
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-38.0.3 pycparser-2.21

ubuntu64@ubuntu:~$ python3 -m pip install cbor
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography.utils import int_from_bytes
Defaulting to user installation because normal site-packages is not writeable
Collecting cbor
Downloading cbor-1.0.0.tar.gz (20 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: cbor
Building wheel for cbor (setup.py) ... done
Created wheel for cbor: filename=cbor-1.0.0-cp36-cp36m-linux_x86_64.whl size=51525 sha256=62a6c0bcc4424dff170ff03f246b3ae30ef99d643fcf05457a716a5f32b58664
Stored in directory: /home/ubuntu64/.cache/pip/wheels/14/62/c6/8c93de62510c9c7a9c6d5b3a09fd74b4c3943ec0e32c431753
Successfully built cbor
Installing collected packages: cbor
Successfully installed cbor-1.0.0

ubuntu64@ubuntu:~$ python3 -m pip install -r requirements.txt
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography.utils import int_from_bytes
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cryptography>=2.6 in ./.local/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (38.0.3)
Collecting intelhex
Downloading intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
|████████████████████████████████| 50 kB 2.5 MB/s
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (6.7)
Collecting cbor2
Downloading cbor2-5.4.2.post1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (189 kB)
|████████████████████████████████| 189 kB 1.4 MB/s
Requirement already satisfied: cffi>=1.12 in ./.local/lib/python3.6/site-packages (from cryptography>=2.6->-r requirements.txt (line 1)) (1.15.1)
Requirement already satisfied: pycparser in ./.local/lib/python3.6/site-packages (from cffi>=1.12->cryptography>=2.6->-r requirements.txt (line 1)) (2.21)
Installing collected packages: intelhex, cbor2
Successfully installed cbor2-5.4.2.post1 intelhex-2.3.0

============================================================