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

kwadwo amankwa via lldb-dev lldb-dev at lists.llvm.org
Wed Oct 7 13:27:28 PDT 2015


I'll work my way backwards . Eventually I'll get there. Anyway if you 
need any help on adding python 3 support , I'll be more than happy to help

thanks ,
Que

On 07/10/15 20:40, Zachary Turner wrote:
> When you built LLDB, did you specify a -DPYTHON_HOME=<path> on your 
> CMake command line, and also run the install_custom_python.py script?  
> There's a lot of steps, so it seems like almost everybody misses at 
> least one step when doing this.
>
> I'm actively working (as in, literally right now) on getting LLDB to 
> work with Python 3.  If all goes smoothly, hopefully all of these 
> problems will disappear and everything will just work without any user 
> configuration required at all.
>
> On Wed, Oct 7, 2015 at 12:17 PM kwadwo amankwa <que at lunarblack.com 
> <mailto:que at lunarblack.com>> wrote:
>
>     Hi Zachary,
>
>     Ok so I did end up reconfiguring it and rebuilding but that was no
>     help . I then realized that I was importing python27.dll as well
>     as python27_d.dll . When I rebuilt liblldb I started getting an
>     single unresolved error for
>     imp_Py_InitModule which I guess was the symbol for the
>     Py_InitModule4 python api  which is actually a macro which is
>     defined depending on a few flags . So I ended up rebuilding
>     python27 and the unresolved error went away and built everything
>     from scratch . The good news is that when I invoke the 'script'
>     command in the lldb interpreter it doesn't crash anymore and I can
>     use the python interpreter . I can even import the lldb module
>     without getting the embedded interpreter Import error . However I 
>     when I actually import lldb from a python module and run it with
>     the standalone interpreter I still get the Import Error.  I have
>     checked the PYTHONPATH which was different for the lldb embedded
>     interpreter and updated the variable to contain the missing paths
>     but no cigar :-( . Any suggestions ?
>
>
>     On 05/10/15 21:21, Zachary Turner wrote:
>>     Can you try to regenerate CMake with that command line and see if
>>     that helps?
>>
>>     On Mon, Oct 5, 2015 at 1:17 PM kwadwo amankwa <que at lunarblack.com
>>     <mailto:que at lunarblack.com>> wrote:
>>
>>
>>         No
>>
>>         On 05/10/15 21:15, Zachary Turner wrote:
>>>         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 <mailto: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 <mailto: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 <mailto: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
>>>>>>                     <mailto: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
>>>>>>                         <mailto: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/20151007/2a7dc36e/attachment-0001.html>


More information about the lldb-dev mailing list