Stream Manager cannot load cbor2 module

0

I'm attempting to use the stream manager sdk for GG version 2: https://github.com/aws-greengrass/aws-greengrass-stream-manager-sdk-python

I installed the requirements for stream manager on my test core machine:
pip3 install --user -r requirements.txt

Then I installed the sdk by downloading the source code and running:
sudo python3 setup.py install

After installing the sdk, I realized that the installed .egg file was not readable by users outside of root/staff so I chmod'd to allow others to read it. Then I re-tested and it cannot read the cbor2 module. I ran another test component that just imported cbor2. It failed with the same errors as below.

The log for my component contains this error:
2021-02-03T19:47:26.630Z [WARN] (Copier) com.example.stream.create: stderr. Traceback (most recent call last):. {scriptName=services.com.example.stream.create.lifecycle.Run.script, serviceName=com.example.stream.create, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) com.example.stream.create: stderr. File "create-stream.py", line 5, in <module>. {scriptName=services.com.example.stream.create.lifecycle.Run.script, serviceName=com.example.stream.create, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) com.example.stream.create: stderr. import cbor2. {scriptName=services.com.example.stream.create.lifecycle.Run.script, serviceName=com.example.stream.create, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) com.example.stream.create: stderr. ModuleNotFoundError: No module named 'cbor2'. {scriptName=services.com.example.stream.create.lifecycle.Run.script, serviceName=com.example.stream.create, currentState=RUNNING}

Then I tried adding pip3 install cbor2 to the install script of the component recipe. This didn't install correctly:

2021-02-03T20:48:47.613Z [WARN] (Copier) com.example.stream.create: stderr. Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l9bd94a1/cbor2/. {scriptName=services.com.example.stream.create.lifecycle.Install.script, serviceName=com.example.stream.create, currentState=NEW}
2021-02-03T20:48:47.669Z [WARN] (pool-2-thread-67) com.example.stream.create: shell-runner-error. {scriptName=services.com.example.stream.create.lifecycle.Install.script, serviceName=com.example.stream.create, currentState=NEW, command=["pip3 install cbor2 "]}

On the same machine, I can run a python3 script directly and both cbor2 and stream_manager run fine (except of course for stream manager complaining about authorization). What could be causing the module loading problems?

Thanks!

DarrenB
asked 3 years ago428 views
2 Answers
0
Accepted Answer

Hi Darren,

Install with command pip3 install --user -r requirements.txt makes it install in the user home directory and not in some system path.
Few things you can try (In the order)

  1. Try to install the requirements without the --user option. ie, pip3 install -r requirements.txt
  2. If the above does not work, then I suspect some sought of mismatch in the python version (multiple installation?). You can be explicit about the python version and use python to install the requirements via pip. ie python3.7 -m pip install -r requirements.txt

I know pip3 install --user -r requirements.txtis in the documentation. Once you confirm that this works for you, I will get that rectified.

answered 3 years ago
0

Thanks. I didn't realize that cbor2 was getting installed to my user profile. #1 fixed the issue, but, I needed to use 'sudo pip3 install -r requirements.txt' Without sudo, it still installed to the ~/.local/lib/python3.6/site-packages location. Now, both stream-manager and cbor are in /usr/local/lib/python3.6/dist-packages.

I'm using ubuntu 18.04, fyi.

DarrenB
answered 3 years ago

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