Stream Manager cannot load cbor2 module


I'm attempting to use the stream manager sdk for GG version 2:

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 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) stderr. Traceback (most recent call last):. {,, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) stderr. File "", line 5, in <module>. {,, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) stderr. import cbor2. {,, currentState=RUNNING}
2021-02-03T19:47:26.630Z [WARN] (Copier) stderr. ModuleNotFoundError: No module named 'cbor2'. {,, 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) stderr. Command "python egg_info" failed with error code 1 in /tmp/pip-build-l9bd94a1/cbor2/. {,, currentState=NEW}
2021-02-03T20:48:47.669Z [WARN] (pool-2-thread-67) shell-runner-error. {,, 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?


asked 3 years ago487 views
2 Answers
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

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.

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