New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'module_name' in SymTab.py #1904

Open
Berserker66 opened this Issue Oct 2, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@Berserker66

Berserker66 commented Oct 2, 2017

Quite possibly a derp on my part, but should still have a better exception name if it is.

The error:

E:\vulkan>call "E:\Visual Studio 2017 Community\VC\Auxiliary\Build\vcvars64.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26730.16
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'setup_requires'
  warnings.warn(msg)
running build_ext
cythoning vulkan.__init__.pyx to vulkan.__init__.c
Traceback (most recent call last):
  File "cython_setup.py", line 37, in <module>
    "Topic :: Software Development :: Libraries :: Python Modules",
  File "C:\Program Files\Python36\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Program Files\Python36\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Program Files\Python36\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Program Files\Python36\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Program Files\Python36\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "C:\Program Files\Python36\lib\site-packages\Cython\Distutils\old_build_ext.py", line 193, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Distutils\old_build_ext.py", line 346, in cython_sources
    full_module_name=module_name)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Main.py", line 693, in compile
    return compile_single(source, options, full_module_name)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Main.py", line 643, in compile_single
    return run_pipeline(source, options, full_module_name)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Main.py", line 494, in run_pipeline
    err, enddata = Pipeline.run_pipeline(pipeline, source)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Pipeline.py", line 354, in run_pipeline
    data = run(phase, data)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Pipeline.py", line 334, in run
    return phase(data)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Pipeline.py", line 32, in parse
    scope = context.find_module(full_module_name, pos = initial_pos, need_pxd = 0)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Main.py", line 188, in find_module
    scope = scope.find_submodule(name)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Main.py", line 337, in find_submodule
    parent_module = None, context = self)
  File "C:\Program Files\Python36\lib\site-packages\Cython\Compiler\Symtab.py", line 1099, in __init__
    self.module_name = parent_module.module_name
AttributeError: 'NoneType' object has no attribute 'module_name'

I had a module like this:

ext_modules = [Extension("__init__",
                         ["vulkan.__init__.pyx"],
                         )]

fixed by changing to

ext_modules = [Extension("vulkan",
                         ["vulkan.pyx"],
                         )]

and moving the file accordingly.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Oct 3, 2017

Contributor

Shouldn't it be vulkan\__init__.pyx ?

Contributor

scoder commented Oct 3, 2017

Shouldn't it be vulkan\__init__.pyx ?

@Berserker66

This comment has been minimized.

Show comment
Hide comment
@Berserker66

Berserker66 Oct 3, 2017

Well, yes, but I changed that to just be vulkan. But that then turned out to not work (but more due to how the vulkan package works, as opposed to cython.)
Anyway, My current problem is even different to that but seems to be a cython issue:

The command is now:

ext_modules = cythonize("vulkan/*.pyx")

[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'setup_requires'
  warnings.warn(msg)
running build_ext
building 'vulkan.__init__' extension
E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IE:\Visual Studio 2017 Community\VC\Redist\MSVC\14.10.25017\onecore\x64\Microsoft.VC150.CRT" "-IC:\Program Files\Python36\include" "-IC:\Program Files\Python36\include" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Visual C++ BuildTools\VC\Tools\MSVC\14.11.25503\include" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared" /Tcvulkan\__init__.c /Fobuild\temp.win-amd64-3.6\Release\vulkan\__init__.obj
__init__.c
E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\Python36\libs" "/LIBPATH:C:\Program Files\Python36\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64" "/LIBPATH:E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64" /EXPORT:PyInit___init__ build\temp.win-amd64-3.6\Release\vulkan\__init__.obj /OUT:E:\vulkan\vulkan\__init__.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\vulkan\__init__.cp36-win_amd64.lib
LINK : error LNK2001: unresolved external symbol PyInit___init__
build\temp.win-amd64-3.6\Release\vulkan\__init__.cp36-win_amd64.lib : fatal error LNK1120: 1 unresolved externals
error: command 'E:\\Visual Studio 2017 Community\\VC\\Tools\\MSVC\\14.11.25503\\bin\\HostX64\\x64\\link.exe' failed with exit status 1120

Googline for that link error tells me that plenty of people in the past had problems cythoning various __init__files.

Berserker66 commented Oct 3, 2017

Well, yes, but I changed that to just be vulkan. But that then turned out to not work (but more due to how the vulkan package works, as opposed to cython.)
Anyway, My current problem is even different to that but seems to be a cython issue:

The command is now:

ext_modules = cythonize("vulkan/*.pyx")

[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
C:\Program Files\Python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'setup_requires'
  warnings.warn(msg)
running build_ext
building 'vulkan.__init__' extension
E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IE:\Visual Studio 2017 Community\VC\Redist\MSVC\14.10.25017\onecore\x64\Microsoft.VC150.CRT" "-IC:\Program Files\Python36\include" "-IC:\Program Files\Python36\include" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Visual C++ BuildTools\VC\Tools\MSVC\14.11.25503\include" "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared" /Tcvulkan\__init__.c /Fobuild\temp.win-amd64-3.6\Release\vulkan\__init__.obj
__init__.c
E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\Python36\libs" "/LIBPATH:C:\Program Files\Python36\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64" "/LIBPATH:E:\Visual Studio 2017 Community\VC\Tools\MSVC\14.11.25503\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64" /EXPORT:PyInit___init__ build\temp.win-amd64-3.6\Release\vulkan\__init__.obj /OUT:E:\vulkan\vulkan\__init__.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\vulkan\__init__.cp36-win_amd64.lib
LINK : error LNK2001: unresolved external symbol PyInit___init__
build\temp.win-amd64-3.6\Release\vulkan\__init__.cp36-win_amd64.lib : fatal error LNK1120: 1 unresolved externals
error: command 'E:\\Visual Studio 2017 Community\\VC\\Tools\\MSVC\\14.11.25503\\bin\\HostX64\\x64\\link.exe' failed with exit status 1120

Googline for that link error tells me that plenty of people in the past had problems cythoning various __init__files.

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Oct 4, 2017

Contributor
Contributor

scoder commented Oct 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment