Comments (11)
I tested it, the test script works for me, too! Thanks
from nuitka.
Are you sure your program is running with Python3.12, since there is no imp module.
from nuitka.
Ah, it's probably these things:
replacements:
"load_first_config(['config.py'], True)": "textwrap.indent(pkgutil.get_data('cv2', 'config.py').decode('utf8'), ' ') + textwrap.indent(pkgutil.get_data('cv2', 'config-3.py').decode('utf8'), ' ')"
# Before OpenCV 4.6
'native_module = importlib.import_module("cv2.cv2")': '"import imp; native_module = imp.load_dynamic(\"cv2\", os.path.join(os.path.dirname(__file__), \"cv2%s\"))" % getSharedLibrarySuffix(False)'
# After OpenCV 4.6
'native_module = importlib.import_module("cv2")': '"import imp; native_module = imp.load_dynamic(\"cv2\", os.path.join(os.path.dirname(__file__), \"cv2%s\"))" % getSharedLibrarySuffix(False)'
These could be changed to use _imp
I suppose.
from nuitka.
Thanks for your report, this is fixed on the factory branch, which is a development version under rapid development. You can try it out by going here: https://nuitka.net/doc/factory.html
Feedback on whether this is working is very welcome. Please do not share plans to do it; only confirm or deny that it is working.
from nuitka.
Let me know if it works, I only changed the code, expecting everything else to be fine now.
from nuitka.
I tried it, it seems to have fixed the initial error, but now the error changed to this one
build execution
> python -m nuitka --mingw64 --standalone --output-dir=. --main=.\hw.py
Nuitka-Options: Used command line options: --mingw64 --standalone --output-dir=. --main=.\hw.py
Nuitka: Starting Python compilation with Nuitka '2.4rc4' on Python '3.12' commercial grade 'not installed'.
Nuitka: Completed Python level compilation and optimization.
Nuitka: Generating source code for C backend compiler.
Nuitka: Running data composer tool for optimal constant value handling.
Nuitka: Running C compilation via Scons.
Nuitka-Scons: Backend C compiler: gcc (gcc 13.2.0).
Nuitka-Scons: Backend linking program with 102 files (no progress information available for this stage).
Nuitka-Scons: Compiled 102 C files using ccache.
Nuitka-Scons: Cached C files (using ccache) with result 'cache hit': 47
Nuitka-Scons: Cached C files (using ccache) with result 'cache miss': 55
Nuitka-Plugins:dll-files: Found 1 file DLLs from cv2 installation.
Nuitka: Keeping build directory 'hw.build'.
Nuitka: Successfully created 'hw.dist\hw.exe'.
pip freeze
python -m pip freeze
Nuitka @ https://github.com/Nuitka/Nuitka/archive/factory.zip#sha256=7a70543e409a3ab180ad6e157451ff2fd647c882c223f8e49b114c9bfd0aeebe
numpy==1.26.4
opencv-python-headless==4.9.0.80
ordered-set==4.1.0
zstandard==0.22.0
> .\hw.dist\hw.exe
Traceback (most recent call last):
File "C:\Users\SHAPIN~1\Desktop\repos\test\HWBF46~1.DIS\hw.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "C:\Users\SHAPIN~1\Desktop\repos\test\HWBF46~1.DIS\cv2\__init__.py", line 209, in <module cv2>
File "C:\Users\SHAPIN~1\Desktop\repos\test\HWBF46~1.DIS\cv2\__init__.py", line 181, in bootstrap
AttributeError: module '_imp' has no attribute 'load_dynamic'
from nuitka.
Too bad, I think I saw it on older versions, wasn't expecting it to not be there.
from nuitka.
So, in the tests of CPython 3.12, they copied the code of load_dynamic
from the former imp
module, which would be one way of doing it, and probably what we have to do. I will give it a shot, if anything is needed at all there, maybe for 4.6+ it is now needed at all, and we continued doing it.
from nuitka.
Unfortunately the workaround is still needed though.
from nuitka.
I devised a manual load with ExtensionFileLoader just as done in the 3.12 test suite, for which there seems to be no function in proper Python anymore. Manual module loading is going to spread like wildfire, and people barely get those things correct, but what do I know, slightly annoyed here.
from nuitka.
So right now factory is actually working.
from nuitka.
Related Issues (20)
- Backend C compiler crashes HOT 4
- CPython: There is a problem with detecting imports HOT 5
- cannot scan dependency with @rpath/QtSvg.framework/Versions/A/QtSvg' HOT 9
- pyglet.libs.win32.types系统找不到指定的文件 HOT 5
- Numpy 2.0 + standalone +no_docstrings causes TypeError: argument docstring of add_docstring should be a str HOT 4
- Compilation fails in non-English locale settings HOT 4
- Unexpected error: `AttributeError: 'compiled_cell' object has no attribute` HOT 4
- NUITKA_BOOL_UNASSIGNED, EXCEPTION_MATCH_BOOL_SINGLE HOT 4
- Module loader objects, need to expose more attributes to be compatible, (was: type object 'nuitka_module_loader' has no attribute 'filename') HOT 14
- NameError: name 'WinDLL' is not defined, Nuitka 2.3.9 build Scipy 1.14 HOT 7
- Import onnx gives program run error HOT 14
- Question: Is it possible to tell if a program fully compiled or used a Nuitka build backend at runtime? HOT 1
- Suggestion: Better aproach for getting Path to executable HOT 8
- `tsdownsample` library gives fatal error on MacOS HOT 7
- Nuitka does not import necessary pycryptodome library HOT 4
- Debian/Python 3.12: compilation "hello word" program failed HOT 2
- `--onefile` parameter fail to locate DLL dependencies when run through `uv` HOT 12
- Using `tsdownsample` gives pyo3_runtime.PanicException: Failed to access NumPy array API capsule HOT 3
- TypeError when trying to iterate through a type HOT 4
- Compilation is 4-6x slower for Python 3.12 vs 3.11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuitka.