Import problem with pygame
See original GitHub issueHello, I’m not sure if it is a bug or a question. I tried to compile pygame project with nuitka and standalone option, always with the same error. Error:
Nuitka:INFO: Starting Python compilation.
Nuitka-Plugins:WARNING: Use '--plugin-enable=pylint-warnings' for: Understand PyLint/PyDev annotations for warnings.
Nuitka-Plugins:WARNING: Use '--plugin-enable=numpy' for: Numpy support for at least 'numpy'.
Traceback (most recent call last):
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\__main__.py", line 196, in <module>
main()
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\__main__.py", line 189, in main
MainControl.main()
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\MainControl.py", line 688, in main
main_module = createNodeTree(filename=filename)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\MainControl.py", line 146, in createNodeTree
Optimization.optimize(main_module.getOutputFilename())
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\optimizations\Optimization.py", line 625, in optimize
makeOptimizationPass()
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\optimizations\Optimization.py", line 537, in makeOptimizationPass
changed = optimizeModule(current_module)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\optimizations\Optimization.py", line 182, in optimizeModule
optimizeShlibModule(module)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\optimizations\Optimization.py", line 177, in optimizeShlibModule
Plugins.considerImplicitImports(module=module, signal_change=signalChange)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\plugins\Plugins.py", line 194, in considerImplicitImports
plugin.considerImplicitImports(module, signal_change)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\plugins\PluginBase.py", line 165, in considerImplicitImports
module_filename = self.locateModule(importing=module, module_name=full_name)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\plugins\PluginBase.py", line 445, in locateModule
_module_package, module_filename, _finding = Importing.findModule(
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\importing\Importing.py", line 282, in findModule
module_filename = _findModule(module_name=module_name)
File "C:\Programy\Programowanie\Python\Python38\lib\site-packages\nuitka\importing\Importing.py", line 566, in _findModule
assert not module_name.endswith("."), module_name
AssertionError: .
python -m nuitka --version 0.6.10 Python: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] Executable: C:\Programy\Programowanie\Python\Python38\python.exe OS: Windows Arch: x86_64
The way of execution: python -m nuitka --standalone main.py (I’ve tried also with --follow-imports parameter)
Example of code:
import pygame
pygame.init()
pygame.font.init()
myfont = pygame.font.SysFont('Tahoma', 50)
screen = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
BLACK = 0, 0, 0
running = True
while running:
screen.fill(BLACK)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.update()
clock.tick(60)
pygame.quit()
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
ImportError: No module named 'pygame' - Stack Overflow
It is because your version of Pygame is not compatible with your version of Python or Pydev. Go to this link and get...
Read more >ModuleNotFoundError: No module named 'pygame' in Python
The Python "ModuleNotFoundError: No module named 'pygame'" occurs when we forget to install the pygame module before importing it or install it ...
Read more >I can't import the Pygame module. When I'm trying to ... - Quora
The error is because your version of Pygame is not compatible with your version of Python or Pydev. Go to this link and...
Read more >How to Fix Modulenotfounderror: no module named 'pygame'
This error means that the pygame module is not installed. Another option is that you have several python versions installed on your machine....
Read more >import pygame error mac - Reddit
import pygame error mac. So I'm a newbie and I installed pygame through terminal on mac and it says that it's installed sucessfully...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is fixed on the factory branch: https://nuitka.net/doc/factory.html
Your test program worked after making this fix. A workaround may also be to delete the line in question or maybe the whole
.pyi
file, but I am not entirely sure if that wouldn’t make it miss some dependencies. I believe older versions of pygame didn’t have this annotation.Yours, Kay
Released as part of 0.6.11