Problems using gdk

0

I am trying to use GDK (Greengrass Development Kit) for developing IoT Greengrass components. I've followed by instruction.
I've done the next steps:
init:

gdk component init --template HelloWorld --language python

Then have changed gdk-config.json file:

{
  "component": {
    "com.example.PythonHelloWorld": {
      "author": "SOME",
      "version": "1.0.0",
      "build": {
        "build_system" : "zip"
      },
      "publish": {
        "bucket": "greengrass-component-artifacts",
        "region": "eu-central-1"
      }
    }
  },
  "gdk_version": "1.0.0"
}

And after build command I got an error:

aleksandr@myPC:~/test/test$ gdk component build
[2021-12-23 10:34:34] INFO - Getting project configuration from gdk-config.json
[2021-12-23 10:34:34] INFO - Found component recipe file 'recipe.yaml' in the  project directory.
[2021-12-23 10:34:34] INFO - Building the component 'com.example.PythonHelloWorld' with the given project configuration.
[2021-12-23 10:34:34] INFO - Using 'zip' build system to build the component.
[2021-12-23 10:34:34] WARNING - This component is identified as using 'zip' build system. If this is incorrect, please exit and specify custom build command in the 'gdk-config.json'.
[2021-12-23 10:34:34] INFO - Zipping source code files of the component.

=============================== ERROR ===============================
Failed to build the component with the given project configuration.
Error building the component with the given build system.
Failed to zip the component in default build mode.
maximum recursion depth exceeded while calling a Python object

Can anyone please help me? What I have done wrong?

Python 3.8.0 was used.

asked 2 years ago734 views
3 Answers
0

Hi Namratha_K, Thank you for attention to my problem. I have tried do the steps from the guide :

mkdir HelloWorld-python
cd HelloWorld-python
gdk component init --template HelloWorld --language python

I've edited gdk-config.json:

{
  "component": {
    "com.example.PythonHelloWorld": {
      "author": "Alex",
      "version": "NEXT_PATCH",
      "build": {
        "build_system": "zip"
      },
      "publish": {
        "bucket": "greengrass-component-artifacts",
        "region": "eu-central-1"
      }
    }
  },
  "gdk_version": "1.0.0"
}

And, the recipe.yaml looks like:

---
RecipeFormatVersion: "2020-01-25"
ComponentName: "{COMPONENT_NAME}"
ComponentVersion: "{COMPONENT_VERSION}"
ComponentDescription: "This is simple Hello World component written in Python."
ComponentPublisher: "{COMPONENT_AUTHOR}"
ComponentConfiguration:
  DefaultConfiguration:
    Message: "World"
Manifests:
  - Platform:
      os: all
    Artifacts:
      - URI: "s3://BUCKET_NAME/COMPONENT_NAME/COMPONENT_VERSION/HelloWorld.zip"
        Unarchive: ZIP
    Lifecycle:
      Run: "python3 -u {artifacts:decompressedPath}/HelloWorld/main.py {configuration:/Message}"

After I've launched the command:

gdk component build

gdk have created directoryes HelloWorld-python/zip-build recursivelly. So, I got an error:

[2021-12-28 14:56:34] INFO - Getting project configuration from gdk-config.json
[2021-12-28 14:56:34] INFO - Found component recipe file 'recipe.yaml' in the  project directory.
[2021-12-28 14:56:34] INFO - Building the component 'com.example.PythonHelloWorld' with the given project configuration.
[2021-12-28 14:56:34] INFO - Using 'zip' build system to build the component.
[2021-12-28 14:56:34] WARNING - This component is identified as using 'zip' build system. If this is incorrect, please exit and specify custom build command in the 'gdk-config.json'.
[2021-12-28 14:56:34] INFO - Zipping source code files of the component.

=============================== ERROR ===============================
Failed to build the component with the given project configuration.
Error building the component with the given build system.
Failed to zip the component in default build mode.
 "[Errno 36] File name too long: '/home/aleksandr/test/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python'")]
answered 2 years ago
  • Hi, could you try again by uninstalling the existing version and installing the latest cli tool? Also, could you enable debug logs gdk component build -d and share them along with the platform details ( windows/linux) if the problem still exists?

  • Hi, I'm able to reproduce the error by having a symlink HelloWorld-python/zip-build to the HelloWorld-python folder. Though you may not have the same symlink situation, it's worth checking by removing the symlinks if any and trying the command again.

0

Hello, I have successfully developed IoT Greengrass components using Greengrass development kit. Please find below steps I have followed

  1. Installed GDK CLI 2.Ran below commands to create components folders mkdir ~/greengrassv2 cd ~/greengrassv2 3.Create and change to a component folder where the GDK CLI downloads the template or community component mkdir HelloWorld-python cd HelloWorld-python

  2. To create a component folder from a template, run the following command. gdk component init --template HelloWorld --language python python --version 2.7.16 python3 --version Python 3.9.9

  3. gdk-config.json and recipe.yaml

**gdk-config.json **

{ "component": { "com.example.PythonHelloWorld": { "author": "Namratha", "version": "NEXT_PATCH", "build": { "build_system": "zip" }, "publish": { "bucket": "bucket-name", "region": "us-east-1" } } }, "gdk_version": "1.0.0" }

recipe.yaml

RecipeFormatVersion: "2020-01-25"

ComponentName: "com.example.PythonHelloWorld"

ComponentVersion: "1.0.0"

ComponentDescription: "This is simple Hello World component written in Python."

ComponentPublisher: "Namratha"

ComponentConfiguration:

DefaultConfiguration:

 Message: "World"

Manifests:

  • Platform:

    os: all

    Artifacts:

    • URI: "s3://bucketname/HelloWorld-python.zip"

      Unarchive: ZIP

    Lifecycle:

    Run: "python3 -u {artifacts:decompressedPath}/HelloWorld/main.py {configuration:/Message}"

  1. Build using below command

    gdk component build
    

[2021-12-24 17:06:41] INFO - Getting project configuration from gdk-config.json

[2021-12-24 17:06:41] INFO - Found component recipe file 'recipe.yaml' in the project directory.

[2021-12-24 17:06:41] INFO - Building the component 'com.example.PythonHelloWorld' with the given project configuration.

[2021-12-24 17:06:41] INFO - Using 'zip' build system to build the component.

[2021-12-24 17:06:41] WARNING - This component is identified as using 'zip' build system. If this is incorrect, please exit and specify custom build command in the 'gdk-config.json'.

[2021-12-24 17:06:41] INFO - Zipping source code files of the component.

[2021-12-24 17:06:42] INFO - Copying over the build artifacts to the greengrass component artifacts build folder.

[2021-12-24 17:06:42] INFO - Updating artifact URIs in the recipe.

[2021-12-24 17:06:42] INFO - Creating component recipe in '/Users/xxxx/greengrassv2/HelloWorld-python/greengrass-build/recipes'.

Could you please follow above steps and let me know if you are still facing issue? Please share recipe file and steps to reproduce your issue.

AWS
SUPPORT ENGINEER
answered 2 years ago
  • I did the same, but got errors. The only difference is that the python and python3 commands are executed from python3.

0

I use Ubuntu 18.04.5 LTS.

python --version
Python 3.8.0

I've reinstalled gdk by command:

pip uninstall gdk
python3 -m pip install git+https://github.com/aws-greengrass/aws-greengrass-gdk-cli.git

Than I've created a component by template:

mkdir ~/greengrassv2
cd ~/greengrassv2
mkdir HelloWorld-python
cd HelloWorld-python
gdk component init --template HelloWorld --language python

The gdk-config.json :

{ "component": {"com.example.PythonHelloWorld": {"author": "Alex", "version": "NEXT_PATCH", build": {"build_system": "zip"}, "publish": {"bucket": "jetson-inference-bu", "region": "eu-central-1"}}},  "gdk_version": "1.0.0"}

And, after the command gdk component build -d I got:

[2021-12-30 12:35:20] INFO - Setting command output mode to DEBUG.
[2021-12-30 12:35:20] DEBUG - Calling '_gdk_component_build'.
[2021-12-30 12:35:20] INFO - Getting project configuration from gdk-config.json
[2021-12-30 12:35:20] DEBUG - Checking if the file '/home/aleksandr/greengrassv2/HelloWorld-python/gdk-config.json' exists.
[2021-12-30 12:35:20] DEBUG - Checking if the file '/home/aleksandr/.local/lib/python3.8/site-packages/gdk/static/config_schema.json' exists.
[2021-12-30 12:35:20] DEBUG - Validating the configuration file.
[2021-12-30 12:35:20] DEBUG - Looking for recipe file in the project directory.
[2021-12-30 12:35:20] INFO - Found component recipe file 'recipe.yaml' in the  project directory.
[2021-12-30 12:35:20] DEBUG - Parsing the component recipe file 'recipe.yaml'.
[2021-12-30 12:35:20] DEBUG - Checking if the file '/home/aleksandr/.local/lib/python3.8/site-packages/gdk/static/project_build_system.json' exists.
[2021-12-30 12:35:20] DEBUG - Identifying build systems supported by the CLI tool with default configuration.
[2021-12-30 12:35:20] INFO - Building the component 'com.example.PythonHelloWorld' with the given project configuration.
[2021-12-30 12:35:20] DEBUG - Deleting the directory '/home/aleksandr/greengrassv2/HelloWorld-python/greengrass-build' if it exists.
[2021-12-30 12:35:20] DEBUG - Creating 'greengrass-build' directory with artifacts and recipes.
[2021-12-30 12:35:20] INFO - Using 'zip' build system to build the component.
[2021-12-30 12:35:20] WARNING - This component is identified as using 'zip' build system. If this is incorrect, please exit and specify custom build command in the 'gdk-config.json'.
[2021-12-30 12:35:20] INFO - Zipping source code files of the component.
[2021-12-30 12:35:20] DEBUG - Deleting the directory '/home/aleksandr/greengrassv2/HelloWorld-python/zip-build' if it exists.
[2021-12-30 12:35:20] DEBUG - Copying over component files to the 'HelloWorld-python' folder.

=============================== ERROR ===============================
Failed to build the component with the given project configuration.
Error building the component with the given build system.
Failed to zip the component in default build mode.
[('/home/aleksandr/greengrassv2/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python', '/home/aleksandr/greengrassv2/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-build/HelloWorld-python/zip-...
answered 2 years ago
  • Please uninstall the same way it is installed i.e usepython3 -m pip uninstall gdk -y to uninstall gdk as sometimes pip and python3 -m pip may use different py versions for package installation. Before installing again, please check if both pip show gdk and python3 -m pip show gdk give you WARNING: Package(s) not found: gdk.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions