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.

Attempted to compile packages by compiled individual python files went wrong

See original GitHub issue

I’m having an issue when running main entry points located in sub packages of regular packages. Seems to be related to the compilation of __init__.py files of sub packages.

My output of python -m nuitka --version is:

0.8.4
Commercial: None
Python: 3.9.5 (default, Mar 28 2022, 18:48:27) 
Flavor: pyenv
Executable: /home/eyepick/.pyenv/versions/3.9.5/bin/python
OS: Linux
Arch: x86_64
Distribution: Ubuntu (based on Debian) 20.04.4

I installed Nuitka using python -m pip install nuitka, as recommended in the readme.

My output of python -m pip freeze is empty (the issue can be reproduced with no external dependency).

In order to reproduce the issue, download the zip. It contains:

  1. a bash script that does a depth-first search in the directory given as argument and compile each python module with Nuitka (skipping the black listed folders and directories given as arguments). It’s use is like:

bash nuitkize.sh package-name -f package-name/dir1/file1.py package-name/dir1/file2.py ... -d package-name/dir3 package-name/dir4 ...

It will compile each file of the package named package-name while skipping the files package-name/dir1/file1.py, package-name/dir1/file2.py, … and the directories package-name/dir3, package-name/dir4, …

  1. A test package to reproduce the issue.

To reproduce the issue, unzip the zip, cd into the folder and run bash nuitkize.sh test-package -d test-package/scripts. Then, run python -B -m scripts.script1 to get the error:

ImportError: dynamic module does not define module export function (PyInit_dir1)

Repeat the procedure but now compilng it by running bash nuitkize.sh test-package -f test-package/__init__.py test-package/dir1/__init__.py -d test-package/scripts. When running python -B -m scripts.script1 it should now run normally and print Entry f1.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Jun 30, 2022

The new warning is part of the 0.9.2 hotfix release I just made. Nothing to do here really anymore.

1reaction
kayhayencommented, Jun 29, 2022

Part of factory now, will be in next hotfix release too, https://nuitka.net/doc/factory.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python package looks for library in wrong path #5106 - GitHub
Trying to build the python package from source without installing it will somehow try to pick the wrong path for system libraries.
Read more >
Error compiling when installing with pip - Stack Overflow
I'm having issues when installing packages with pip. I'm running python 3.3 in Pyzo (pre-packaged with numpy, scipy etc) on Windows 8.1 64bit....
Read more >
Issue 22724: byte-compile fails for cross-builds - Python tracker
The byte-compiling for cross-builds fails because PYTHON_FOR_BUILD defined in configure, sets PYTHONPATH with the directory of the newly built ...
Read more >
Error compiling with Python 3 - ISSM Forum
Just had someone else running into issues with numpy. And it appears that their numpy directory set in configure was too shallow. The...
Read more >
How to Fix Python `No such file or directory` Compiler Errors ...
Instead, this error results from Python trying to call your system compiler during module installation. This is because the paths to your system ......
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