All of lore.kernel.org
 help / color / mirror / Atom feed
* Python Error in SDK
@ 2015-04-07  6:44 Erik Bolton
  2015-04-08 16:21 ` Paul Eggleton
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Bolton @ 2015-04-07  6:44 UTC (permalink / raw)
  To: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 2527 bytes --]

Hey All;


This has been brought up before (although I think the error was different), but I'm having a lot of issues with the version of Python included with the SDK.


We use Python for code generation as part of our project. If I source the environment script and try to run our Python scripts I get this:


Traceback (most recent call last):
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py", line 569, in <module>
    main()
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py", line 551, in main
    known_paths = addusersitepackages(known_paths)
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py", line 278, in addusersitepackages
    user_site = getusersitepackages()
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py", line 253, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py", line 242, in getuserbase
    from sysconfig import get_config_var
  File "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/sysconfig.py", line 10, in <module>
    'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
AttributeError: 'module' object has no attribute 'lib'

If I try running something that doesn't exist I get this:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)

I've tried using update-alternatives to point the SDK python to my local python (Ubuntu 14.10, Python 2.7.8), but the errors persist.

I know a few people have simply deleted the python binary from the SDK, but I don't think that will help in my case.

I would try to remove it from the SDK in the actual package groups, but smartpm and a few other programs depend on it. I'm not sure they would play nice with my local version.

Any suggestions on how to fix this "correctly"?

Thanks very much.
-Erik
Disclaimer: This message contains information that may be privileged or confidential and is the property of AgJunction Inc and its subsidiaries. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

[-- Attachment #2: Type: text/html, Size: 3575 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Python Error in SDK
  2015-04-07  6:44 Python Error in SDK Erik Bolton
@ 2015-04-08 16:21 ` Paul Eggleton
  2015-04-08 17:39   ` Erik Bolton
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggleton @ 2015-04-08 16:21 UTC (permalink / raw)
  To: Erik Bolton; +Cc: yocto

Hi Erik,

On Tuesday 07 April 2015 06:44:01 Erik Bolton wrote:
> This has been brought up before (although I think the error was different),
> but I'm having a lot of issues with the version of Python included with the
> SDK.
> 
> We use Python for code generation as part of our project. If I source the
> environment script and try to run our Python scripts I get this:
> 
> Traceback (most recent call last):
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py",
> line 569, in <module> main()
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py",
> line 551, in main known_paths = addusersitepackages(known_paths)
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py",
> line 278, in addusersitepackages user_site = getusersitepackages()
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py",
> line 253, in getusersitepackages user_base = getuserbase() # this will also
> set USER_BASE
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.py",
> line 242, in getuserbase from sysconfig import get_config_var
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/sysconfig.
> py", line 10, in <module> 'stdlib':
> '{base}/'+sys.lib+'/python{py_version_short}',
> AttributeError: 'module' object has no attribute 'lib'
> 
> If I try running something that doesn't exist I get this:
> 
> Fatal Python error: Py_Initialize: Unable to get the locale encoding
> ImportError: No module named 'encodings'
> Aborted (core dumped)
> 
> I've tried using update-alternatives to point the SDK python to my local
> python (Ubuntu 14.10, Python 2.7.8), but the errors persist.
> 
> I know a few people have simply deleted the python binary from the SDK, but
> I don't think that will help in my case.
> 
> I would try to remove it from the SDK in the actual package groups, but
> smartpm and a few other programs depend on it. I'm not sure they would play
> nice with my local version.
> 
> Any suggestions on how to fix this "correctly"?

Basically when python (technically, "nativesdk-python" when talking about the 
SDK) gets pulled in, that's the minimal python core and not all of the modules 
in the normal Python distribution, resulting in failures such as these. You 
can add those however by adding the following either in your image recipe (if 
using -c populate_sdk) or in your configuration:

  TOOLCHAIN_HOST_TASK_append = " nativesdk-python-modules"

Rebuild and re-install the SDK and things should work a bit better after that.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Python Error in SDK
  2015-04-08 16:21 ` Paul Eggleton
@ 2015-04-08 17:39   ` Erik Bolton
  2015-06-03  9:08     ` Paul Eggleton
  0 siblings, 1 reply; 4+ messages in thread
From: Erik Bolton @ 2015-04-08 17:39 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto@yoctoproject.org

Hey Paul:

Thanks very much for the help.

I already have a meta-toolchain.bbappend in our project so I added nativesdk-python-modules to the TOOLCHAIN_HOST_TASK append line in there.

The system doesn't seem to detect the change, though. If I "bitbake meta-toolchain" no tasks are performed. If I "bitbake meta-toolchain -c cleanall" and rebuild it just repackages the toolchain...no new packages are added and there's no nativesdk-python-modules dir in the work dir for the SDK.

This is really odd, because I added some jibberish to meta-toolchain.append and tried again. It fails with a parsing error on the lines I added, so I know the file is being re-parsed.

Any thoughts?

Thanks again.
-Erik

-----Original Message-----
From: Paul Eggleton [mailto:paul.eggleton@linux.intel.com]
Sent: Wednesday, April 08, 2015 9:22 AM
To: Erik Bolton
Cc: yocto@yoctoproject.org
Subject: Re: [yocto] Python Error in SDK

Hi Erik,

On Tuesday 07 April 2015 06:44:01 Erik Bolton wrote:
> This has been brought up before (although I think the error was
> different), but I'm having a lot of issues with the version of Python
> included with the SDK.
>
> We use Python for code generation as part of our project. If I source
> the environment script and try to run our Python scripts I get this:
>
> Traceback (most recent call last):
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> py",
> line 569, in <module> main()
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> py", line 551, in main known_paths = addusersitepackages(known_paths)
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> py", line 278, in addusersitepackages user_site =
> getusersitepackages()
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> py", line 253, in getusersitepackages user_base = getuserbase() # this
> will also set USER_BASE
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> py", line 242, in getuserbase from sysconfig import get_config_var
>   File
> "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/sysconfig.
> py", line 10, in <module> 'stdlib':
> '{base}/'+sys.lib+'/python{py_version_short}',
> AttributeError: 'module' object has no attribute 'lib'
>
> If I try running something that doesn't exist I get this:
>
> Fatal Python error: Py_Initialize: Unable to get the locale encoding
> ImportError: No module named 'encodings'
> Aborted (core dumped)
>
> I've tried using update-alternatives to point the SDK python to my
> local python (Ubuntu 14.10, Python 2.7.8), but the errors persist.
>
> I know a few people have simply deleted the python binary from the
> SDK, but I don't think that will help in my case.
>
> I would try to remove it from the SDK in the actual package groups,
> but smartpm and a few other programs depend on it. I'm not sure they
> would play nice with my local version.
>
> Any suggestions on how to fix this "correctly"?

Basically when python (technically, "nativesdk-python" when talking about the
SDK) gets pulled in, that's the minimal python core and not all of the modules in the normal Python distribution, resulting in failures such as these. You can add those however by adding the following either in your image recipe (if using -c populate_sdk) or in your configuration:

  TOOLCHAIN_HOST_TASK_append = " nativesdk-python-modules"

Rebuild and re-install the SDK and things should work a bit better after that.

Cheers,
Paul

--

Paul Eggleton
Intel Open Source Technology Centre
Disclaimer: This message contains information that may be privileged or confidential and is the property of AgJunction Inc and its subsidiaries. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Python Error in SDK
  2015-04-08 17:39   ` Erik Bolton
@ 2015-06-03  9:08     ` Paul Eggleton
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggleton @ 2015-06-03  9:08 UTC (permalink / raw)
  To: Erik Bolton; +Cc: yocto@yoctoproject.org

Hi Erik,

I'm really not sure what to advise, other than debugging it by checking 
variable values with bitbake -e, adding print/bb.warn statements at various 
points, etc.

Sorry, this message was sitting in my inbox for some time - I don't suppose 
you have found anything since April?

Cheers,
Paul

On Wednesday 08 April 2015 17:39:52 Erik Bolton wrote:
> Hey Paul:
> 
> Thanks very much for the help.
> 
> I already have a meta-toolchain.bbappend in our project so I added
> nativesdk-python-modules to the TOOLCHAIN_HOST_TASK append line in there.
> 
> The system doesn't seem to detect the change, though. If I "bitbake
> meta-toolchain" no tasks are performed. If I "bitbake meta-toolchain -c
> cleanall" and rebuild it just repackages the toolchain...no new packages
> are added and there's no nativesdk-python-modules dir in the work dir for
> the SDK.
> 
> This is really odd, because I added some jibberish to meta-toolchain.append
> and tried again. It fails with a parsing error on the lines I added, so I
> know the file is being re-parsed.
> 
> Any thoughts?
> 
> Thanks again.
> -Erik
> 
> -----Original Message-----
> From: Paul Eggleton [mailto:paul.eggleton@linux.intel.com]
> Sent: Wednesday, April 08, 2015 9:22 AM
> To: Erik Bolton
> Cc: yocto@yoctoproject.org
> Subject: Re: [yocto] Python Error in SDK
> 
> Hi Erik,
> 
> On Tuesday 07 April 2015 06:44:01 Erik Bolton wrote:
> > This has been brought up before (although I think the error was
> > different), but I'm having a lot of issues with the version of Python
> > included with the SDK.
> > 
> > We use Python for code generation as part of our project. If I source
> > the environment script and try to run our Python scripts I get this:
> > 
> > Traceback (most recent call last):
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> > py",
> > line 569, in <module> main()
> > 
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> > py", line 551, in main known_paths = addusersitepackages(known_paths)
> > 
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> > py", line 278, in addusersitepackages user_site =
> > getusersitepackages()
> > 
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> > py", line 253, in getusersitepackages user_base = getuserbase() # this
> > will also set USER_BASE
> > 
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/site.
> > py", line 242, in getuserbase from sysconfig import get_config_var
> > 
> >   File
> > 
> > "/opt/poky/1.7.1/sysroots/x86_64-pokysdk-linux/usr/lib/python2.7/sysconfig
> > .
> > py", line 10, in <module> 'stdlib':
> > '{base}/'+sys.lib+'/python{py_version_short}',
> > AttributeError: 'module' object has no attribute 'lib'
> > 
> > If I try running something that doesn't exist I get this:
> > 
> > Fatal Python error: Py_Initialize: Unable to get the locale encoding
> > ImportError: No module named 'encodings'
> > Aborted (core dumped)
> > 
> > I've tried using update-alternatives to point the SDK python to my
> > local python (Ubuntu 14.10, Python 2.7.8), but the errors persist.
> > 
> > I know a few people have simply deleted the python binary from the
> > SDK, but I don't think that will help in my case.
> > 
> > I would try to remove it from the SDK in the actual package groups,
> > but smartpm and a few other programs depend on it. I'm not sure they
> > would play nice with my local version.
> > 
> > Any suggestions on how to fix this "correctly"?
> 
> Basically when python (technically, "nativesdk-python" when talking about
> the SDK) gets pulled in, that's the minimal python core and not all of the
> modules in the normal Python distribution, resulting in failures such as
> these. You can add those however by adding the following either in your
> image recipe (if using -c populate_sdk) or in your configuration:
> 
>   TOOLCHAIN_HOST_TASK_append = " nativesdk-python-modules"
> 
> Rebuild and re-install the SDK and things should work a bit better after
> that.
> 
> Cheers,
> Paul
> 
> --
> 
> Paul Eggleton
> Intel Open Source Technology Centre
> Disclaimer: This message contains information that may be privileged or
> confidential and is the property of AgJunction Inc and its subsidiaries. It
> is intended only for the person to whom it is addressed. If you are not the
> intended recipient, you are not authorized to read, print, retain, copy,
> disseminate, distribute, or use this message or any part thereof. If you
> receive this message in error, please notify the sender immediately and
> delete all copies of this message.

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-03  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-07  6:44 Python Error in SDK Erik Bolton
2015-04-08 16:21 ` Paul Eggleton
2015-04-08 17:39   ` Erik Bolton
2015-06-03  9:08     ` Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.