Skip to content
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

importing PygameShader when running script directly causes error: "no module named gaussianblur5x5" #1

Closed
SkysurferKon opened this issue Apr 2, 2022 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@SkysurferKon
Copy link

No description provided.

@yoyoberenguer
Copy link
Owner

yoyoberenguer commented Apr 2, 2022

Hi SkysurferKon,

Thank you for taking the time to report an issue.

Can you show me an example of script causing this issue ?
Do you mean that an error is thrown as soon as you are importing the library ?
Also if you could provide the python version used and the platform (windows ?)

It is highly recommended to use PIP for installing this library.
Check your python version first to make sure you have any of this version (3.6, 3.7, 3.8, 3.9, 3.10)
Then run the following command from the dos interpreter (cmd):

C:\>pip install PygameShader

If you have a different version you will see this type of error :

C:\...AppData\Local\Programs\Python\Python35\Scripts>pip install PygameShader
Collecting PygameShader
  Cache entry deserialization failed, entry ignored
  Could not find a version that satisfies the requirement PygameShader (from versions: )

No matching distribution found for PygameShader


To use the Gaussian blur you would normally import the method shader_blur5x5_array24_inplace from | blur
the library such as:

In Python :

for version < 1.0.3
import PygameShader
from PygameShader import shader_blur5x5_array24_inplace

for version > 1.0.3
import PygameShader
from PygameShader import blur

OR

To load all the methods from the library

import PygameShader
from PygameShader import *

This Error : no module named gaussianblur5x5 tells me that the cython file gaussianblur5x5 is either missing
or not cynthonize (compile for your environment or python version).
If you are using PIP to install PygameShader on Python version > 3.6 you would normally never see that issue as the PIP download the package with all the code already compile for your environment (PIP will detect automatically the right version
and download it for you, version 3.6, 3.7, 3.8, 3.9, 3.10).

This issue can eventually happen if you are trying to build the library from the source code using
C:\>python setup_shader.py build_ext --inplace

The line above will try to compile the cython code from the PYX files

  • misc.pyx
  • gaussianBlur5x5.pyx
  • shader.pyx
    and compare the cython declaration with shader.pxd header file
    The compilation will fail if you are missing any of this file
    For info the Github version of the code does not include the PYX files. Nevertheless theses
    file are included in the PIP versions

@yoyoberenguer yoyoberenguer added the question Further information is requested label Apr 3, 2022
@yoyoberenguer yoyoberenguer self-assigned this Apr 3, 2022
@yoyoberenguer
Copy link
Owner

.

@SkysurferKon
Copy link
Author

Thanks for writing this detailed explanation! Is PygameShader compatible with a PyInstaller "--onefile" exe file?

@yoyoberenguer
Copy link
Owner

Hi,
If you are looking for an automatic installer, the best way to install this library is to use the well known

pip install PygameShader==1.0.4

If you are a bit more adventurous you can also download the git source code and compile the library from source

But to answer your question regarding the PyInstaller program , I would say yes, PygameShader is compatible with PyInstaller even though I never tried to use PyInstaller since this is a cython/python library that does not include any hook file but uses an external library that load with an import statement

I used PyInstaller in the past for various project including project with C & Cython & python codes and would generate an executable file. In order to create a single file you would have to tweak and configure PyInstaller to know where to find all the source code, binaries and images that needs to be attached to the executable.

@yoyoberenguer
Copy link
Owner

yoyoberenguer commented May 29, 2022

Another utility that could perform the same task would be to use the great program call Inno Setup. This will do the same and build an executable file containing all the directories and source code etc. The advantage of Inno setup is to be able to de-install the project as you would normally do for commercial programs as an optional feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants