[lldb-dev] " Import error: No module named embedded_interpreter" on windows

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Mon Oct 5 13:15:44 PDT 2015


Are you using -DCMAKE_BUILD_TYPE=Debug when you generate CMake?

On Mon, Oct 5, 2015 at 1:14 PM kwadwo amankwa <que at lunarblack.com> wrote:

> Thanks for the response ,  sorry for the delay. As a matter of fact I
> actually got rid of the system python and installed my custom version.  I
> do suspect it is a linking problem though. When I build liblldb.dll it
> always loads python27.dll instead of python27_d.dll. Do you happen to know
> where the python27 lib is specified as an input library because the project
> properties in liblldb does not specify it . however the linker complains if
> I don't specify the lib directory in 'additional directories' and when I do
> it always links to the python27lib. I grepped the whole build directory and
> two files SystemInitializer.obj and LLDBWrapPython.obj seem to contain
> /DEFAULTLIB:python27.lib. Do you have an idea of what is causing the
> compiler to do this ?
>
>
> On 05/10/15 19:13, Zachary Turner wrote:
>
> Ahh, I thought you were doing this from inside LLDB.  There are a couple
> of problems:
>
> 1) You might be running with the system Python, not the custom Python you
> built with VS2013.  What is the value of `sys.executable`?
> 2) Even if you are running your own Python, the regular Python appears to
> be in your `sys.path`.  You will need to unset PYTHONPATH and PYTHONHOME
> from pointing to your system Python.  PYTHONHOME should point to your
> custom Python, and PYTHONPATH should point to the `lib\site-packages`
> directory that I mentioned earlier in your build directory.
>
>
>
> On Mon, Oct 5, 2015 at 11:06 AM kwadwo amankwa <que at lunarblack.com> wrote:
>
>> here it is;
>>
>> C:\Users\redbandit\Documents\GitHub\pygui>python
>> Python 2.7.10 (default, Sep 18 2015, 02:35:59) [MSC v.1800 64 bit
>> (AMD64)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import sys
>> >>> sys.path
>> ['', 'C:\\Python27\\Lib',
>> 'C:\\Users\\redbandit\\llvm\\build\\Debug\\lib\\site-packages\\lldb',
>> 'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts',
>> 'C:\\Users\\redbandi t\\Documents\\GitHub\\pygui',
>> 'C:\\Python27\\python27.zip', 'C:\\Python27\\DLLs',
>> 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
>> 'C:\\Python27\\li b\\site-packages']
>> >>> import lldb
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <module>
>> ImportError: No module named embedded_interpreter
>> >>> lldb.__file__
>> 'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts\\lldb.pyc'
>> >>> sys.path
>> ['C:/Users/redbandit/llvm/build/Debug/lib/site-packages/lldb',
>> 'C:/Users/redbandit/llvm/build/Debug/lib/site-packages/lib/site-packages',
>> '', 'C:\\Python27\\Lib', 'C:\\Users\\
>> redbandit\\llvm\\build\\Debug\\lib\\site-packages\\lldb',
>> 'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts',
>> 'C:\\Users\\redbandit\\Documents\\GitHub\\pygui', 'C:\\Pyt
>> hon27\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib\\plat-win',
>> 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
>> 'C:\\Python27\\lib\\site-packages', '.']
>>
>>
>> On 05/10/15 18:48, Zachary Turner wrote:
>>
>> Can you run the followign commands and paste the output?
>>
>> >>> import sys
>> >>> sys.path
>> ['D:/src/llvmbuild/ninja/bin',
>> 'D:/src/llvmbuild/ninja/lib/site-packages',
>> 'D:\\src\\llvmbuild\\ninja\\bin\\python27_d.zip',
>> 'C:\\Python27_LLDB\\x86\\DLLs', 'C:\\Python27_LLDB\\x86\\lib',
>> 'C:\\Python27_LLDB\\x86\\lib\\plat-win',
>> 'C:\\Python27_LLDB\\x86\\lib\\lib-tk', 'D:\\src\\llvmbuild\\ninja\\bin'
>> , 'C:\\Python27_LLDB\\x86', 'C:\\Python27_LLDB\\x86\\lib\\site-packages',
>> '.']
>> >>> import lldb
>> >>> lldb.__file__
>> 'D:/src/llvmbuild/ninja/lib/site-packages\\lldb\\__init__.pyc'
>> >>> sys.path
>> ['D:/src/llvmbuild/ninja/bin',
>> 'D:/src/llvmbuild/ninja/lib/site-packages',
>> 'D:\\src\\llvmbuild\\ninja\\bin\\python27_d.zip',
>> 'C:\\Python27_LLDB\\x86\\DLLs', 'C:\\Python27_LLDB\\x86\\lib',
>> 'C:\\Python27_LLDB\\x86\\lib\\plat-win',
>> 'C:\\Python27_LLDB\\x86\\lib\\lib-tk', 'D:\\src\\llvmbuild\\ninja\\bin'
>> , 'C:\\Python27_LLDB\\x86', 'C:\\Python27_LLDB\\x86\\lib\\site-packages',
>> '.']
>> >>>
>>
>> and also make sure that in the same folder as your _lldb_d.pyd, there is
>> an embedded_interpreter.py?
>>
>> On Mon, Oct 5, 2015 at 9:14 AM kwadwo amankwa <que at lunarblack.com> wrote:
>>
>>> Hi Zachary,
>>>
>>> thanks for the reply , I did use MSBUILD  as Ninja didn't work for me on
>>> my system.  As far as the _lldb_d.pyd file is concerned it is stored in the
>>> same place.  and it is being used by lldb.py because everything else works
>>> besides the embedded_interpreter. That is I am able to use the api from
>>> python it is just that interpreter issue that comes up .
>>>
>>> Cheers,
>>> Que
>>>
>>>
>>> On 05/10/15 16:56, Zachary Turner wrote:
>>>
>>> Are you using MSBuild or Ninja to build (i.e. are you clicking the Build
>>> Solution button in Visual Studio or running ninja from command line)?  I
>>> don't know where it puts this stuff with a VS2013 build, but with a ninja
>>> build, your directory will be organized like this:
>>>
>>> build
>>> |___bin
>>>      |___lldb.exe
>>>      |___liblldb.dll
>>> |___lib
>>>      |___site-packages
>>>            |___lldb
>>>                  |___lldb_d.pyd   // If this is a debug build, lldb.pyd
>>> if release
>>>
>>> I'm betting you're missing the pyd file.  Can you confirm? Then we can
>>> diagnose that if it turns out to be the problem.
>>>
>>> On Mon, Oct 5, 2015 at 5:20 AM kwadwo amankwa via lldb-dev <
>>> lldb-dev at lists.llvm.org> wrote:
>>>
>>>> Hi guys,
>>>>
>>>> Can someone point me in the right direction on this . I have managed to
>>>> set up my environment on windows , compiling python2.7.10 using VS2013
>>>> and building llvm/lldb in VS2013. lldb and all its libraries build
>>>> successfully so its just when I import lldb into my python project I get
>>>> this error.
>>>>
>>>> File "<string>", line 1, in <module>
>>>> Import error: No module named embedded_interpreter
>>>>
>>>>   Also when I use the 'script' command in the lldb interpreter , lldb
>>>> completely crashes  with an unhandled exception in the  python
>>>> file_write  function (fileobject.c:1852)
>>>>
>>>> n2 = fwrite(s, 1, n, f->f_fp);
>>>>
>>>> the call to fwrite causes an access violation  . My intuition tells me
>>>> that i'm missing  a lib or something but I can't put my finger on it.
>>>> Please Help !
>>>>
>>>>
>>>> _______________________________________________
>>>> lldb-dev mailing list
>>>> lldb-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20151005/bb99843c/attachment.html>


More information about the lldb-dev mailing list