NanoPB and NCS python standard libs

Hi 

Im am struggling getting nanopb to parse proto files in NCS toolchain zephyr context.

It appears that the python38 embedded in NCS toolchain does not include all standard libraries.

From the trace below it can be seen that the plistlib is included from my global python310 install which ends up in af version conflict

Is is possibly to run the NCS build in a true virtual python environment or is it possible to add the standard libraries for the embedded python version in NCS

Traceback (most recent call last):
File "D:\bluebird\build\nanopb\generator\nanopb_generator.py", line 51, in <module>
from .proto import nanopb_pb2
ImportError: attempted relative import with no known parent package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\bluebird\build\nanopb\generator\nanopb_generator.py", line 72, in <module>
import proto.nanopb_pb2 as nanopb_pb2
File "D:\bluebird\build\nanopb\generator\proto\__init__.py", line 7, in <module>
import pkg_resources
File "c:\nordic\v1.8.0\toolchain\opt\bin\Lib\site-packages\pkg_resources\__init__.py", line 32, in <module>
import plistlib
File "C:\Python310\lib\plistlib.py", line 61, in <module>
from xml.parsers.expat import ParserCreate
File "c:\nordic\v1.8.0\toolchain\opt\bin\Lib\site-packages\xml\parsers\expat.py", line 4, in <module>
from pyexpat import *
ImportError: Module use of python38.dll conflicts with this version of Python.
--nanopb_out: protoc-gen-nanopb: Plugin failed with status code 1.

Parents
  • Hi Anders,

    Could you confirm that your installation procedure was through nRF Connect for Desktop and Toolchain Manager? 
    Can you describe how you installed nRF Connect for Desktop and Toolchain Manager?
    Which versions of nRF Connect for Desktop and Toolchain Manager have you been using?
    Have you made any changes to the installation process yourself?

    Instead through Toolchain Manager, you could install nRF Connect SDK manually. This would give you more control over the installation process.
    Try creating python virtual environment with a suitable python version required by NCS. After activation of the virtual environment, you could just follow the steps outlined in the guide for manual installation which is linked above.

    Best regards,
    Dejan

  • Hi Dejan

    Sorry for the late reply but have been out office the last week.

    My installation has been through Toolchain manager, and i have done no changes to the process.

    It might be a solution to do manual setup with separate virtual python environment. I will give that a try

    Best regards


    Anders

Reply Children
Related