So this is the error it's throwing in cmd windows 10. Seems to be something to do with pynput? Not really sure what I can do to fix this and appreciate any help.
C:\Users\Michael\Desktop\herprogram\dist\beeb>beeb.exe
Traceback (most recent call last):
File "C:\Users\Michael\Desktop\herprogram\beeb.py", line 5, in <module>
import pynput
File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pynput\__init__.py", line 40, in <module>
File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pynput\keyboard\__init__.py", line 31, in <module>
File "pynput\_util\__init__.py", line 76, in backend
ImportError
[11880] Failed to execute script beeb
Many thanks
I switched to a different module pywinauto which is officially supported by pyinstaller and used:
import pywinauto
pywinauto.mouse.double_click(button='left', coords=(0, 0))
This solved the issue. Thanks guys
Related
I am using darkflow for custom object detection it is working perfectly fine and it is running perfectly through anaconda prompt. I made the exe using pyinstaller, So when I was running the exe it is showing the above error. Can anyone help me to get rid of this? I tried installing darkflow globally also but it didn't work.
Traceback (most recent call last):
File "demo.py", line 1, in <module>
from darkflow.net.build import TFNet
File "c:\users\camfyvision\anaconda3\envs\darkflow\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "darkflow\net\build.py", line 7, in <module>
from .framework import create_framework
File "c:\users\camfyvision\anaconda3\envs\darkflow\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "darkflow\net\framework.py", line 1, in <module>
from . import yolo
File "c:\users\camfyvision\anaconda3\envs\darkflow\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "darkflow\net\yolo\__init__.py", line 2, in <module>
from . import predict
File "c:\users\camfyvision\anaconda3\envs\darkflow\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "darkflow\net\yolo\predict.py", line 7, in <module>
from ...cython_utils.cy_yolo_findboxes import yolo_box_constructor
File "c:\users\camfyvision\anaconda3\envs\darkflow\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
File "darkflow\cython_utils\cy_yolo_findboxes.pyx", line 1, in init darkflow.cython_utils.cy_yolo_findboxes
import numpy as np
ModuleNotFoundError: No module named 'darkflow.cython_utils.nms'
This is the error I got when I did drag and drop of the exe into propmt and also I am providing below the corresponding information I got regarding the error when I was making the exe using pyinstaller.
136360 INFO: Updating manifest in C:\Users\CamfyVision\AppData\Roaming\pyinstaller\bincache00_py36_64bit\darkflow.cython_utils.cy_yolo_findboxes.pyd
136361 INFO: Updating resource type 24 name 2 language 1033
136413 INFO: Updating manifest in C:\Users\CamfyVision\AppData\Roaming\pyinstaller\bincache00_py36_64bit\darkflow.cython_utils.cy_yolo2_findboxes.pyd
136414 INFO: Updating resource type 24 name 2 language 1033
Using PyInstaller to generate an .exe on a windows platform, i have an error when runnig the .exe:
> (venv) ...>my.exe Traceback (most recent call last): File ".\my.py",
> line 6, in <module> File
> ".\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
> line 631, in exec_module exec(bytecode, module.__dict__) File
> "site-packages\websockets\__init__.py", line 3, in <module> File
> ".\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
> line 631, in exec_module exec(bytecode, module.__dict__) File
> "site-packages\websockets\client.py", line 6, in <module> File
> ".\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
> line 631, in exec_module exec(bytecode, module.__dict__) File
> ".\venv\Lib\site-packages\zmq\asyncio\__init__.py", line 18, in
> <module> ImportError: cannot import name 'SelectorEventLoop' [3696]
> Failed to execute script My
I am using python 3.6.4 and pyinstaller 3.3
I just added ayncio 3.4.3 to the project (everything worked find before that)
Any idea would be welcomed
After digging a lot, i came up with a solution.
The sources of the issue are:
the zmq (for zeromq) i use. It embeds its own asyncio
PyInstaller modifies sys.path to add the libraries from zeromq.
When importing asyncio in my code, it tries to import the one from zeromqand fails.
I made an ugly hack to get around that. I post it so it might help someone
former_path = sys.path[:]
sys.path = [v for v in sys.path if 'zmq' not in v]
import asyncio
sys.path = former_path
So far, i couldn't find any side effect
Trying to distribute a program that relies on tensorflow...
Using tensorflow it works nicely both as script and with pyinstaller.
Using tensorflow-gpu it works as script but not with pyinstaller.
The cuda and cudnn dlls have been copied into the bundle folder by pyinstaller.
I use python 3.6.5 and tensorflow 1.7.0. (Can change version if it helps...)
Error message:
Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.dict)
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
File "importlib__init__.py", line 126, in import_module
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "interface.py", line 14, in
File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.dict)
File "site-packages\tensorflow__init__.py", line 24, in
File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.dict)
File "site-packages\tensorflow\python__init__.py", line 49, in
File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.dict)
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
ImportError: Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.dict)
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
File "importlib__init__.py", line 126, in import_module
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
[10816] Failed to execute script interface
Make sure you are also packaging MSVCP140.DLL, as missing this from the %PATH% can throw this error.
I tend to use cx_Freeze instead of pyinstaller when distributing tensorflow applications. Once you overcome the error cx_Freeze has with scipy, it's simpler overall.
Maybe this can help. I manually rename the file _pywrap_tensorflow_internal.pyd to tensorflow.python._pywrap_tensorflow_internal.pyd in the dist folder. Everything works.
I fixed this problem by making dirs as ".../dist/[MmyPyName]/tensorflow/python/_pywrap_tensorflow_internal.pyd"
tensorflow-gpu = 1.10.0
python = 3.6.2
cuda = 9.0
cudnn = 7.3.0
When installing it with pyinstaller, make sure that in the .spec file include this as hidden import:
hiddenimports=['tensorflow.python._pywrap_tensorflow_internal',],
This will include the missing module in the correct path.
I've trouble making an CONSOLE app work after packaging.
App flashes once and closes.
in terminal i've put: pyinstaller --onefile --windowed --icon=name.icns Script.py
So far i've tried running the app through terminal to try and get error ( you know like in windows but it failed lol ).
Is there a way to see the reason why it closed?
EDIT:
When i run Executable within app i get this error:
File "Script.py", line 14, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages/requests/__init__.py", line 43, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages/urllib3/__init__.py", line 8, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages/urllib3/connectionpool.py", line 28, in <module>
File "site-packages/urllib3/packages/six.py", line 92, in __get__
File "site-packages/urllib3/packages/six.py", line 115, in _resolve
File "site-packages/urllib3/packages/six.py", line 82, in _import_module
ImportError: No module named 'queue'
I have nothing about "queue" in code and .py works great and gives no import error.
Thank you.
Seems like there's an error importing one of your modules, perhaps its dependencies aren't being detected correctly.
You can try to explicitly add a module via the command line by including --hidden-import=queue, you might have to do this for more modules that haven't been detected. More discussion in this question.
I wrote a program using PyQt4.QtGui and QtCore,I packaged it into exe,and it works good on my computer,but it can't run on others' computer
The error is this:
cx_Freeze: Python error in main script
---------------------------
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console3.py", line 27, in <module>
File "baidu.py", line 6, in <module>
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1607, in _handle_fromlist
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 313, in _call_with_frames_removed
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1558, in _find_and_load
File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1525, in _find_and_load_unlocked
File "ExtensionLoader_PyQt4_QtGui.py", line 11, in <module>
ImportError: DLL load failed: 找不到指定的模块。
The packaged files are:
├─_bz2.pyd
├─_hashlib.pyd
├─_socket.pyd
├─_ssl.pyd
├─baidu.exe
├─icudt49.dll
├─icuin49.dll
├─icuuc49.dll
├─LIBEAY32.dll
├─libGLESv2.dll
├─lxml.etree.pyd
├─PyQt4.QtCore.pyd
├─PyQt4.QtGui.pyd
├─PyQt4.QtNetwork.pyd
├─python33.dll
├─Qt5Core.dll
├─Qt5Gui.dll
├─Qt5Network.dll
├─Qt5PrintSupport.dll
├─Qt5Widgets.dll
├─sip.pyd
├─SSLEAY32.dll
└─unicodedata.pyd
I just used "cxfreeze baidu.py --base-name=Win32GUI --target-dir d:\123" to package it.
I wonder if I missed some arguments when using cxfreeze result in this problem,and how to package it to exe.Thank you
d3dcompiler_43.dll is needed to run pyqt