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.

Star imports of built-in names are not working as expected

See original GitHub issue

Today I wanted to try a very fast experiment, the idea was trying to create executables for all the existing matplotlib examples, here’s what I did so far:

  • Having a virtualenv with these requirements (i’ve got more but just posting the basic ones to run many of the matplotlib examples):

    matplotlib==2.2.2 pyparsing==2.2.0 python-dateutil==2.7.3 cycler==0.10.0 numpy==1.14.0+mkl

  • git clone and make sure I was able to run all included examples, so far so good, all of them would run flawlessly (tested manually many dozens)

  • Create nuitka modules by doing:

    nuitka --output-dir=build --no-pyi-file --include-package=cycler --module --jobs=4 --show-scons D:\virtual_envs\py364_32\lib\site-packages\ nuitka --output-dir=build --no-pyi-file --include-package=dateutil --module --jobs=4 --show-scons D:\virtual_envs\py364_32\lib\site-packages\dateutil nuitka --output-dir=build --no-pyi-file --include-package=matplotlib --module --jobs=4 --show-scons D:\virtual_envs\py364_32\lib\site-packages\matplotlib nuitka --output-dir=build --no-pyi-file --include-package=numpy --module --jobs=4 --show-scons D:\virtual_envs\py364_32\lib\site-packages\numpy nuitka --output-dir=build --no-pyi-file --include-package=pyparsing --module --jobs=4 --show-scons D:\virtual_envs\py364_32\lib\site-packages\

  • Finally, copying manually the required implicit dlls/data to use numpy&matplotlib.

I’ve created a beautiful package to give more relevant information, you can download from here

Once you’ve extracted that nice package containing all dependencies the idea was I’d just set PYTHONPATH pointing out to that folder (absolute path) and everything would run flawlessly… Well, unfortunately the plan fail and it didn’t work 😉

Anyway, here’s the current traceback I’ve got stuck with:

(py364_32) D:\sources\others\sources_compilers\nuitka_tests\matplotlib\examples\color>echo %PYTHONPATH%

(py364_32) D:\sources\others\sources_compilers\nuitka_tests\matplotlib\examples\color>python
D:\sources\others\sources_compilers\nuitka_tests\bin\matplotlib\ UserWarning: could not find rc file; returning defaults
<module 'numpy' from 'D:\\sources\\others\\sources_compilers\\nuitka_tests\\bin\\numpy.pyd'>
Traceback (most recent call last):
  File "", line 25, in <module>
    ax.plot(t, smiddle, t, slower, t, supper)
  File "D:\sources\others\sources_compilers\nuitka_tests\bin\matplotlib\", line 1855, in inner
  File "D:\sources\others\sources_compilers\nuitka_tests\bin\matplotlib\axes\", line 1531, in plot
  File "D:\sources\others\sources_compilers\nuitka_tests\bin\matplotlib\axes\", line 2516, in autoscale_view
  File "D:\sources\others\sources_compilers\nuitka_tests\bin\matplotlib\axes\", line 2500, in handle_single_axis
  File "D:\sources\others\sources_compilers\nuitka_tests\bin\numpy\core\", line 2334, in isclose
TypeError: 'numpy.bool_' object is not iterable

Can you think of any reason why I’m getting this error when trying to use the modules generated by nuitka? Do you see any nuitka command missing any relevant arguments on my previous steps?

This plan was great, proving that I’d be able to build all matplotlib very fast and having them running on other boxes without python installed would be quite amazing (at least in my books)

Regards, B

Ps. nuitka(develop) + 3.6.x + win7 + vs2015

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

kayhayencommented, Sep 26, 2018

Make it a new issue, definitely its another one. Not sure what could be going on there, maybe something is duplicated that shouldn’t be. I would appreciate a reproducer, although bi-sect is welcome.

My expectation is that the new global dict names registry finds an existing bug that was previously not found. It was of course tested.

kayhayencommented, Sep 19, 2018

And this is basically only delayed, because getting out what is already there, has to have higher priority, but only that. I expect to release on weekend and start working on phase 1 of the solution I described. I changed the subject, to make it clear. Feel free to raise other issues once you proceed with the tests and create new issues. You will know because I will close it or put the factory label on, say it’s in develop, etc. that is how I make things known.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to efficiently fix "undefined, or defined from * imports ...
This import causes my IDE (Spyder) to give warnings like "undefined, or defined from * imports" for lines like value = variable +...
Read more >
how the Python import system works - Ten thousand meters
First, we'll discuss the core concepts of the import system: modules, submodules, packages, from <> import <> statements, relative imports, and ...
Read more >
Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
Read more >
6. Modules — Python 3.11.1 documentation
When a module named spam is imported, the interpreter first searches for a built-in module with that name. These module names are listed...
Read more >
Name may be undefined, or defined from star imports
Confirm that the variable is defined in the star imports. If it is, explicitly import it instead of importing * . If not,...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found