Do you have something odd in the shell environment that prevents python
from looking in the right location?

Alex

On Fri 22. Mar 2024 at 9.11, Ashu Joshi <[email protected]> wrote:

> But I can see python3.8 present in usr/lib and if I go in that directory,
> I can see encodings as well.. see below output in target's terminal.
>
> /usr/lib/python3.8 $
> /usr/lib/python3.8 $ find -iname "encodings"
> ./encodings
>
>
> On Fri, Mar 22, 2024 at 1:29 PM Alexander Kanavin <[email protected]>
> wrote:
>
>> This means the python installation on the target is incomplete/broken.
>> You need to look into how the image was formed because encodings module is
>> included in the core python package and is normally always present.
>>
>> Alex
>>
>> On Fri 22. Mar 2024 at 8.38, Ashu Joshi <[email protected]> wrote:
>>
>>> How do i start python3 because when i try to start python by writing
>>> python3 in target's terminal, i get above error message related to
>>> encodings.
>>>
>>> On Fri, Mar 22, 2024 at 11:48 AM Alexander Kanavin <
>>> [email protected]> wrote:
>>>
>>>> You need to first start python3 and run it there, not directly from the
>>>> shell.
>>>>
>>>> Alex
>>>>
>>>> On Fri, 22 Mar 2024 at 07:00, Ashu Joshi <[email protected]> wrote:
>>>>
>>>>> It doesn't allow me to run import encodings as it is giving another
>>>>> error import:not found
>>>>>
>>>>> On Thu, Mar 21, 2024 at 7:53 PM Alexander Kanavin <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> It's a little odd that the application is looking for python modules
>>>>>> in /lib and not /usr/lib.
>>>>>>
>>>>>> If you run python3 on the target and issue 'import encodings', does
>>>>>> that work? Then they are installed in /usr/lib, and you need to find out
>>>>>> why the app redirects python to look elsewhere.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> On Thu, 21 Mar 2024 at 14:36, Ashu Joshi <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> It seems I have been able to install the package in gateway but
>>>>>>> getting some encoding related error. Below is the error:
>>>>>>>
>>>>>>> ~ $ wm-gw --help
>>>>>>> Python path configuration:
>>>>>>>   PYTHONHOME = '/'
>>>>>>>   PYTHONPATH = (not set)
>>>>>>>   program name = 'python3'
>>>>>>>   isolated = 0
>>>>>>>   environment = 1
>>>>>>>   user site = 1
>>>>>>>   import site = 1
>>>>>>>   sys._base_executable = '/usr/bin/python3'
>>>>>>>   sys.base_prefix = '/'
>>>>>>>   sys.base_exec_prefix = '/'
>>>>>>>   sys.executable = '/usr/bin/python3'
>>>>>>>   sys.prefix = '/'
>>>>>>>   sys.exec_prefix = '/'
>>>>>>>   sys.path = [
>>>>>>>     'lib/python38.zip',
>>>>>>>     '/lib/python3.8',
>>>>>>>     '/lib/python3.8/lib-dynload',
>>>>>>>   ]
>>>>>>> Fatal Python error: init_fs_encoding: failed to get the Python codec
>>>>>>> of the file
>>>>>>>                                             system encoding
>>>>>>> Python runtime state: core initialized
>>>>>>> ModuleNotFoundError: No module named 'encodings'
>>>>>>>
>>>>>>> I even tried to unset PYTHONHOME and  PYTHONPATH  by adding below in
>>>>>>> the recipe file but still encountering the same error. Any idea how to 
>>>>>>> fix
>>>>>>> this?
>>>>>>>
>>>>>>> do_configure(){
>>>>>>>     unset PYTHONPATH
>>>>>>>     unset PYTHONHOME
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Mar 21, 2024 at 3:13 PM Ashu Joshi <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Entire recipe is:
>>>>>>>>
>>>>>>>> FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
>>>>>>>> DESCRIPTION = "Wirepas gateway transport service that connects the
>>>>>>>> local dbus to a remote MQTT broker"
>>>>>>>> LICENSE = "Apache-2.0"
>>>>>>>> LIC_FILES_CHKSUM =
>>>>>>>> "file://LICENSE;md5=cb6bb17b0d0cca188339074207e9f4d8"
>>>>>>>>
>>>>>>>> SRC_URI = "file://wirepasTransport.service \
>>>>>>>>            file://settings.yml \
>>>>>>>> "
>>>>>>>>
>>>>>>>> PYPI_PACKAGE = "wirepas_gateway"
>>>>>>>> PV = "1.4.3"
>>>>>>>> inherit pypi pkgconfig setuptools3
>>>>>>>>
>>>>>>>> SRC_URI[md5sum] = "941a4407513445c64f16b57a1474fc43"
>>>>>>>>
>>>>>>>> DEPENDS += "systemd python3 python3-pkgconfig-native python3-pip"
>>>>>>>>
>>>>>>>> SYSTEMD_SERVICE_${PN} = "wirepasTransport.service"
>>>>>>>> SYSTEMD_AUTO_ENABLE_${PN} = "enable"
>>>>>>>>
>>>>>>>> do_install() {
>>>>>>>>       install -m 0755 -d ${D}${sysconfdir}/systemd/system
>>>>>>>>       install -m 0755 ${WORKDIR}/wirepasTransport.service
>>>>>>>> ${D}${sysconfdir}/systemd/system
>>>>>>>>
>>>>>>>>       install -m 0755 -d ${D}/usr/share
>>>>>>>>       install -m 0644 ${WORKDIR}/settings.yml ${D}/usr/share
>>>>>>>>
>>>>>>>> #      install -m 0755 -d ${D}/usr/share/wirepas_gateway
>>>>>>>> #      install -m 0644 ${WORKDIR}/wirepas_gateway-1.4.3
>>>>>>>> ${D}/usr/share/wirepas_gateway
>>>>>>>> }
>>>>>>>>
>>>>>>>> FILES_${PN} += "usr/share/wirepas_gateway"
>>>>>>>> #FILES_${PN} += "/usr/share/wirepas_gateway/wirepas_gateway-1.4.3"
>>>>>>>> FILES_${PN} +=
>>>>>>>> "${sysconfdir}/systemd/system/wirepasTransport.service"
>>>>>>>> FILES_${PN} += "/usr/share/settings.yml"
>>>>>>>>
>>>>>>>> Error was basically because of commented code wherein I was trying
>>>>>>>> to export the entire directory. I have commented out that for now.. I 
>>>>>>>> found
>>>>>>>> that by creating rpm or opkg package we can export the package to 
>>>>>>>> target.
>>>>>>>> Need help around that, if that is the correct way and how to use this
>>>>>>>> method in yocto recipe. If not, what can be the other way using which 
>>>>>>>> we
>>>>>>>> can ship or install the package in target.
>>>>>>>>
>>>>>>>> On Thu, Mar 21, 2024 at 1:26 PM Alexander Kanavin <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Please share your complete recipe and all of the error message,
>>>>>>>>> otherwise it’s impossible to tell what is happening.
>>>>>>>>>
>>>>>>>>> Alex
>>>>>>>>>
>>>>>>>>> On Thu 21. Mar 2024 at 8.29, Ashu Joshi <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>> I am trying to install wirpas_gateway package from pypi using
>>>>>>>>>> yocto recipe.. Once service is build completely and  I flash image to
>>>>>>>>>> target, i don't see any of the installed packages. Does anyone has 
>>>>>>>>>> nay
>>>>>>>>>> reference how to install these packages in target as well. I dont 
>>>>>>>>>> see any
>>>>>>>>>> generated binary which i can ship tp target. However, source code of 
>>>>>>>>>> the
>>>>>>>>>> package can be seen in work directory. Currently I am trying to do
>>>>>>>>>> something like below:
>>>>>>>>>>
>>>>>>>>>> do_install() {
>>>>>>>>>>       install -m 0755 -d ${D}${sysconfdir}/systemd/system
>>>>>>>>>>       install -m 0755 ${WORKDIR}/wirepasTransport.service
>>>>>>>>>> ${D}${sysconfdir}/systemd/system
>>>>>>>>>>
>>>>>>>>>>       install -m 0755 -d ${D}/usr/share
>>>>>>>>>>       install -m 0644 ${WORKDIR}/settings.yml ${D}/usr/share
>>>>>>>>>>
>>>>>>>>>>       install -m 0755 -d ${D}/usr/share/wirepas_gateway
>>>>>>>>>>       install -m 0644 ${WORKDIR}/wirepas_gateway-1.4.3
>>>>>>>>>> ${D}/usr/share/wirepas_gateway
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> FILES_${PN} += "usr/share/wirepas_gateway"
>>>>>>>>>> FILES_${PN} += "/usr/share/wirepas_gateway/wirepas_gateway-1.4.3"
>>>>>>>>>> FILES_${PN} +=
>>>>>>>>>> "${sysconfdir}/systemd/system/wirepasTransport.service"
>>>>>>>>>> FILES_${PN} += "/usr/share/settings.yml"
>>>>>>>>>>
>>>>>>>>>> wirepas_gateway-1.4.3 is directory which contains setup and other
>>>>>>>>>> files. Getting error while trying to ship this to target.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 
>>>>>>>>>>
>>>>>>>>>>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62825): https://lists.yoctoproject.org/g/yocto/message/62825
Mute This Topic: https://lists.yoctoproject.org/mt/105061124/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to