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.

Confusion about usage

See original GitHub issue

I am using Python 3.7.6 on Windows 10 64-bit (1909). I get the problem with Nuitka 0.6.8 (not tried earlier versions) :

>python -m nuitka --version
0.6.8
Python: 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Program Files\Python37\python.exe
OS: Windows
Arch: x86_64

Nuitka was installed with PIP. No VEnv used. Python was installed with “python-3.7.6-amd64.exe”.
The paramiko module was installed by PIP as a dependency of pysftp. I suspect the PyNaCl module was installed as a dependency of paramiko.

This is the code (nuitkaTest.py) to reproduce the problem:

import paramiko
#import nacl
#import nacl._sodium
print("OK")

Although it also happens with programs that import “pysftp”, since that depends on paramiko.

This is how I compiled the code:

python -m nuitka --recurse-all --remove-output --show-progress --show-modules --show-scons nuitkaTest.py

And when I run the resulting executable, this is what it outputs:

>nuitkaTest.exe
Traceback (most recent call last):
  File "......\nuitkaTest.py", line 1, in <module>
    import paramiko
  File "C:\Program Files\Python37\lib\site-packages\paramiko\__init__.py", line 22, in <module paramiko>
    from paramiko.transport import SecurityOptions, Transport
  File "C:\Program Files\Python37\lib\site-packages\paramiko\transport.py", line 90, in <module paramiko.transport>
    from paramiko.ed25519key import Ed25519Key
  File "C:\Program Files\Python37\lib\site-packages\paramiko\ed25519key.py", line 22, in <module paramiko.ed25519key>
    import nacl.signing
  File "C:\Program Files\Python37\lib\site-packages\nacl\signing.py", line 17, in <module nacl.signing>
    import nacl.bindings
  File "C:\Program Files\Python37\lib\site-packages\nacl\bindings\__init__.py", line 17, in <module nacl.bindings>
    from nacl.bindings.crypto_aead import (
  File "C:\Program Files\Python37\lib\site-packages\nacl\bindings\crypto_aead.py", line 18, in <module nacl.bindings.crypto_aead>
    from nacl._sodium import ffi, lib
ModuleNotFoundError: No module named 'nacl._sodium'

I tried tricking Nuitka to import the module (see the commented-out import lines), without success. I also tried using command line parameters (–include-package & --recurse-to) without success.

And I was also able to reproduce the same problem using this code, which has a much smaller dependency list:

import nacl.signing
#import nacl
#import nacl._sodium
print("OK")

But for some reason the problem does not happen if you ONLY import “nacl”.

For what it’s worth, I believe the paramiko & nacl modules are correctly installed:

>python
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>> import nacl
>>> import nacl.signing
>>>

And my programs work fine with the Python interpreter.

I have the latest version of paramiko installed (2.7.1 according to pip list).
I also have the latest version of PyNaCl installed (1.3.0 according to pip list).

Any work-around to this apparent bug would be great…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
cshandley-ukcommented, May 28, 2020

Thanks, I’ve done more experimenting, and using --standalone does allow it to work… At the expense of needing a ton of “.pyd” files in a “nuitkaTest.dist” folder (which is useless for me as I need a self-contained executable). I hadn’t realised it was putting the executable inside that folder, and so I had been inadvertently testing an older executable.

So it seems the problem is a Nuitka limitation - it’s unable to create an executable that doesn’t need some or all of the following files present:

nacl/_sodium.pyd pyexpat.pyd select.pyd unicodedata.pyd _asyncio.pyd _bz2.pyd _cffi_backend.pyd _ctypes.pyd _decimal.pyd _elementtree.pyd _hashlib.pyd _lzma.pyd _msi.pyd _multiprocessing.pyd _overlapped.pyd _queue.pyd _socket.pyd _sqlite3.pyd _ssl.pyd _tkinter.pyd

This is a great shame, and I hope the issue can be rectified eventually.

0reactions
kayhayencommented, May 30, 2020

The trap of accelerated binary and standalone binary being in a different directory is very real. Not sure though, if Nuitka should feel entitled to remove both. But an error would probably do good.

For #575 there is #230 but no progress. So being on a roadmap is not quite right. But maybe some day, there is not just simply somebody who wants it, but also somebody who creates it. For all I can tell, that person is not me until a company pays me good daily rate to do it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

confusion noun - Definition, pictures, pronunciation and ...
[uncountable, countable] a state of not being certain about what is happening, what you should do, what something means, etc.
Read more >
Confusion Definition & Meaning
The meaning of CONFUSION is an act or instance of confusing. How to use confusion in a sentence.
Read more >
Confusion definition and meaning | Collins English Dictionary
confusion in American English · 1. the act of confusing · 2. the state of being confused · 3. disorder; upheaval; tumult; chaos....
Read more >
Confusion Between Verbs and Other Forms | SEA
Students frequently exhibit confusion in distinguishing between a word that is serving as a true verb in a sentence and a word that...
Read more >
How to Use Fusion vs confusion Correctly
The word confusion is derived from the Latin word confudere which means to mingle or blend together, the prefix con- means together or...
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