I made an app that uses tkinter and tkinterdnd moudles. It works completely fine when I launch it as a script, however when I try to make and executable file from it and laucnh it, foloowing error ocures:
Traceback (most recent call last):
File "TkinterDnD2\TkinterDnD.py", line 53, in _require
_tkinter.TclError: can't find package tkdnd
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "IxcomGUI.py", line 128, in <module>
File "IxcomGUI.py", line 11, in __init__
File "TkinterDnD2\TkinterDnD.py", line 285, in __init__
File "TkinterDnD2\TkinterDnD.py", line 55, in _require
RuntimeError: Unable to load tkdnd library.
[14512] Failed to execute script 'IxcomGUI' due to unhandled exception!
I tried following:
Installed tkinterdnd2 with pip install and built with pyinstaller myscript.py.
Manually installed tkinterdnd2 module as shown in this video https://www.youtube.com/watch?v=JIy0QjwQBl0&t=605s&ab_channel=RamonWilliams and built with pyinstaller myscript.py
Repeated previous step, but added this thing https://github.com/pmgagne/tkinterdnd2/blob/master/hook-tkinterdnd2.py
Tried to implicitly tell pyinstaller path to tkdnd module with specifying path to the module with --paths flag.
All this attempts led to error bellow. Does anyone know some kind of solution?
The issue here is that Drag n Drop requires two components: the TCL libraries and the Tkinter interface to them. I install both manually to config my environment. (See my answer to How to Install and Use TkDnD with Python Tkinter on OSX?). I know someone packaged something on PyPI for the TkinterDnD2, but I haven't looked into it.
I have a project which uses TkinterDnD2. I build it with PyInstaller and see the same error you see (more or less). Running PyInstaller with the --onedir option (rather than the --onefile option), I saw that tkdnd2.8 was missing from my dist directory.
To rectify this, on Windows, I added
--add-binary "C:/Python/Python38-32/tcl/tkdnd2.8;tkdnd2.8"
to the PyInstaller command line, and that did the trick. I can now build a --onefile executable, and it runs without error.
Apparently it was unnexpectedly easy to fix this issue. All you need to is to get to the <YourPath>\Python39\tcl directory and find tkdnd2.8 directory, and move it to the tcl8.6 directory. I have also renamed it to just tkdnd, however I don't know whether it's necessary.
Here is the original link that saved my day: http://pyinstaller.47505.x6.nabble.com/tkinter-TclError-can-t-find-package-tkdnd-td2330.html
I'm using tkinterdnd2 installed from pip, and not TkinterDnD.
What really worked for me was this flag:
--add-data "C:/Users/myName/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0/LocalCache/local-packages/Python39/site-packages/tkinterdnd2;tkinterdnd2"
It expects tkdnd to be a folder inside tkinterdnd2. Just using additional-hooks/hidden import on tkinterdnd2 and tkdnd did now preserve that subfolder structure.
Related
I am creating a bot and I am using libs like pandas, numpy and sklearn and I have also installed all these libraries in a virtual env. The bot works fine on Pycharm but when I use pyinstaller and create a standalone, it's standalone shows this error:
Traceback (most recent call last):
File "PyInstaller\loader\pyiboot01_bootstrap.py", line 167, in __init__
File "ctypes\__init__.py", line 373, in __init__
FileNotFoundError: Could not find module 'C:\Users\vabha\AppData\Local\Temp\_MEI38962\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "chandlerbing.py", line 3, in <module>
from sklearn.pipeline import Pipeline
.
.
.
Console debbug say FileNotFoundError... Let me translate it for you.
vcomp140.dll is missing and need to be used you had it on temporary location and now is not any more. Try also look on this answer or you can try also Auto Py To Exe maybe will work.
You need to have all the libraries installed in the same environment as pyinstaller. You probably installed pyinstaller in a global environment so you should install the libraries in the globa environment.
I want to make the python script into Windows executable with py2exe. I did not miss MSVCP90.dll and the Feiwings.py(the file that I use for transforming) and setup.py are under the same path. Doing those things under command window, everything works fine, the last lines of the traceback here are:
**binary dependencies****
your executable(s) also depend on these dlls which are not included. You may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and make sure you don't distribute files belonging to the operating system.
USER32.dll -C:\WINDOWS\system32\USER32.dll
SHELL32.dll -C:\WINDOWS\system32\SHELL32.dll
ADVAPI32.dll -C:\WINDOWS\system32\ADVAPI32.dll
WS2_32.dll -C:\WINDOWS\system32\WS2_32.dll
GDI32.dll -C:\WINDOWS\system32\GDI32.dll
KERNEL32.dll -C:\WINDOWS\system32\KERNEL32.dll
The setup.py has the content like this:
from distutils.core import setup
import py2exe
setup(console=['D:\python\Feiwings.py'])
When I cd the path to dist directory, it got an error.
Traceback (most recent call last):
File "Feiwings.py", line 2, in <module>
File "PySide\__init__.pyc", line 45, in <module>
File "PySide\__init__.pyc", line 43, in _setupQtDirectories
UnboundLocalError: local variable 'path' referenced before assignment
Thanks in advance!
It seems something is wrong in your PySide distribution. From the traceback, it shows a problem in the second line of your Feiwings program. In this line there is probably an import statement where you import something from PySide, right?
Apart from the py2exe problem, are you able to execute your code normally without raising the same error?
If so, I would guess that you should include other packages dependencies (eg.: PySide) in your setup, something similar to:
setup(packages=['PySide'],
console=['D:\python\Feiwings.py'])
Hope it helps!
Check the variable 'path' in the program. It seems not a error of Pyside(assuming that you have properly installed Pyside) but the way you have used the variable 'path'. Having a look at the error it seems you have used variable 'path' before assigning it any value.
I've never used py2exe before. I installed the package, created a setup.py, ran it and it seemed to work without any obvious errors. I went into the dist folder it created and tried to run the exe but I'm getting this error:
Traceback (most recent call last):
File "rl2.py", line 3, in <module>
File "libtcodpy.pyc", line 41, in <module>
File "ctypes\__init__.pyc", line 428, in __getitem__
File "ctypes\__init__.pyc", line 423, in __getattr__
File "ctypes\__init__.pyc", line 353, in __init__
WindowsError: [Error 126] The specified module could not be found
How can I solve this?
What exact commands did you use to get this output?
I recommend using PyInstaller.
You can build an EXE with PyInstaller using this command:
"python pyinstaller.py -y -w -F [PATH\TO\SCRIPT.py] -n [PROJECT_NAME]"
-y: answer yes to every question
-w: windowed (does not show commandline when running)
-F: Compile into one EXE instead of a directory with .dll files
-n: assign project name
Hope I helped
You probably need to manually specify ctypes in the packages section of your setup.py.
See here
I had same issue today. HEre is the solution will work 100%
The meaning of error is the imported dll file in your code is misssng in created dist folder. so you have to copy and paste dll file in dist folder, and it will work.
I used logimove.dll file and same issue. so i put logimove.dll file in dist file and it works. :)
While trying to use py2exe to create an executable for my GUI program, I got the following error:
Traceback (most recent call last):
File "dopy.py", line 139, in <module>
File "Tix.pyc", line 225, in __init__
_tkinter.TclError: can't find package Tix
My program imports Tix, but py2exe does not package it.
I could not find any solution online that worked, but the closest was http://www.py2exe.org/index.cgi/TixSetup.
Unfortunately, changing the data_files to my Tix path (My Tix8.4.3 instead of the old Tix8.1) does not work either.
My program executable is unable to start without Tix, and py2exe does not seem to want to include it.
Looking in the 'dist' folder that py2exe made, I noticed that there is a tcl folder, and inside it is included a 'tcl8.5' folder and a 'tk8.5' folder, but no Tix folder. These folders were identical ones under my 'Python/tcl/' folder.
Simply copying the 'tix8.4.3' folder into the 'dist/tcl/' folder will include the Tix DLLs and package files, and now my program works!
Use py2exe option packages to help py2exe find the package 'Tix'.
I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old Jython 2.1 jar with this one).
I'm running a script that uses the threading.py class. At some point the statement "import os" is evaluated from linecache.py and I get this error, which I can't seem to figure out how to fix:
'Execution failed. Traceback (most recent call last):
File "<string>", line 1, in <module>
File "../lib/python/threading.py", line 6, in <module>
import traceback
File "../lib/python/traceback.py", line 3, in <module>
import linecache
File "../lib/python/linecache.py", line 9, in <module>
import os
ImportError: No module named os'
What do you mean with "the jar that comes with the 2.5 download"? Did you extract the contents and use jython.jar or did you run the installer? If you just extracted and didn't run the installer your jython.jar will miss the whole LIB folder.
Can you check if jython.jar contains a LIB folder? (e.g. open jython.jar with 7z or WinZip).
Or try copying the LIB folder in the same folder where jython.jar resides.
Did you try setting these properties. Jython Registry. e.g. via -Dpython.home in the eclipse run configuration.
python.cachedir
python.path
python.home
How is the jar named? If similar to jython-complete.jar try renaming it to jython.jar
Something is wrong at a very deep level, but it's probably easy to fix. You are seeing an error that happens while trying to report some other error.
Probably you have your PYTHONPATH misconfigured. I don't know the details of Jython or Eclipse running Jython, but it looks like you have no standard library available to you.
If you are getting maven, using the dependency jython-standalone instead of jython may help (at least it did for me in a maven project with jython-standalone-2.5.3)