question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems compiling code which imports dulwich module

See original GitHub issue

Hello!
I’ve got a problem with Nuitka while trying to compile Python code which uses dulwich - Python implementation of Git.
nuitka --follow-imports --standalone --output-dir="C:\Users\user\build" C:\Users\user\build\nuitka_test.py

Here is the minimal piece of code which allows to reproduce the problem (there are actually 2 of them):

from dulwich import porcelain

def main():
    pass

if __name__ == "__main__":
    main()

The first warning is the six.py import problem (quite similar to issue #56):

Nuitka:WARNING:Unresolved '__import__' call at 'C:\Program Files\Python36\lib\site-packages\urllib3\packages\six.py:82' may require use of '--include-plugin-directory' or '--include-plugin-files'.

The consequence of this warning is the error arising when I try to execute some network-related code from the compiled executable (clone git repo, for example):

HTTPSConnectionPool(host='gitlab.company.com', port=443): Max retries exceeded with url: /project/repository.git/info/refs?service=git-upload-pack (Caused by SSLError(FileNotFoundError(2, 'No such file or directory'),))

The second problem is the exception:

IndexError: list index out of range:
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\SingleExe.scons", line 477:
    env = createEnvironment(compiler_tools=compiler_tools)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\SingleExe.scons", line 462:
    **args
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Environment.py", line 982:
    apply_tools(self, tools, toolpath)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Environment.py", line 107:
    env.Tool(tool)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Environment.py", line 1789:
    tool(self)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\__init__.py", line 299:
    self.generate(env, *args, **kw)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\default.py", line 40:
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\__init__.py", line 1271:
    c_compiler = FindTool(c_compilers, env) or c_compilers[0]
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\__init__.py", line 1172:
    if t.exists(env):
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\msvc.py", line 292:
    return msvc_exists(env)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\MSCommon\vc.py", line 759:
    vcs = cached_get_installed_vcs(env)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\MSCommon\vc.py", line 524:
    ret = get_installed_vcs(env)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\MSCommon\vc.py", line 535:
    VC_DIR = find_vc_pdir(ver)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\MSCommon\vc.py", line 344:
    comps = find_vc_pdir_vswhere(msvc_version)
  File "C:\Program Files\Python36\lib\site-packages\nuitka\build\inline_copy\lib\scons-3.0.4\SCons\Tool\MSCommon\vc.py", line 306:
    vc_pdir = os.path.join(vsdir[0], 'VC')

If I use just import dulwich in my code, only the second problem persists (but I didn’t find out which consequences it brings)

This behaviour tested on Python 3.6.1 in Windows 10 and Debian 9.4.
Nuitka (0.6.1 … 0.6.3) and Dulwich (0.19.8) were installed via pip.

Maybe this issue would also be interesting for @jelmer who is an initial dulwich developer.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Nov 12, 2021

I could’t install Python2 version due to missing C compiler MSVC 9 from PyPI, but I don’t think it matters.

1reaction
kayhayencommented, Nov 12, 2021

Tried this on Windows just now, works fine with current development version of Nuitka and probably stable version too, tried it with Python3.9 and latest dulwich in standalone mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python implementation of Git — dulwich 0.20.46 documentation
archive module that can create tarballs. Based on code from Jonas Haag in klaus. Add a dulwich.reflog module for reading and writing reflogs....
Read more >
How do I correctly install dulwich to get hg-git working on ...
Now when I run hg, I see: *** failed to import extension hggit from c:\code\hg-git\hggit: No module named dulwich.errors. Ok, so that tells...
Read more >
Python implementation of Git — dulwich 0.19.12 documentation
Add a dulwich.archive module that can create tarballs. Based on code from Jonas Haag in klaus. Add a dulwich.reflog module for reading and...
Read more >
dulwich Documentation
This is the Dulwich project. It aims to provide an interface to git repos (both local and remote) that doesn't call out to...
Read more >
Frequently Asked Questions — PyOxidizer 0.8.0 documentation
Why Build Another Python Application Packaging Tool?¶. It is true that several other tools exist to turn Python code into distributable applications!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found