I followed the directions in the Kivy documentation on how to package applications for Windows, but my application crashes as soon as I try to run it. The last line of the traceback suggests a problem with my RecycleView widget:
File "C:\Users\awende\AppData\Local\Continuum\Anaconda3\lib\site-packages\kivy\factory.py", line 139, in __getattr__
module = __import__(name=item['module'], fromlist='.')
ModuleNotFoundError: No module named 'kivy.uix.recycleview.__init__.'
Failed to execute script SingleTabApp
I have tried importing kivy.uix.recycleview in all my .py and .kv files that it wasn't already imported in, but this doesn't seem to be the problem. I am not sure if this is a problem with my code, or if something else is going on.
Other potentially relevant information:
I am using Python 3.6.1 with the current dev version of PyInstaller.
Kivy version 1.10.0
SingleTabApp is the name of my main Python script, and was working correctly prior to using PyInstaller.
install a recent version of cython, notice that for a version of cython there is a corresponding version of kivy. To implement RecycleView, the version of kivy in your "package apk" not your computer must be at least 1.10
I ran across the same problem with PyInstaller on Windows 7. I appied a quick fix to factory_registers.py and it worked! (https://github.com/kivy/kivy/issues/5276)
A quick fix for the issue with pyinstaller is to change e.g. r('RecycleViewBehavior', module='kivy.uix.recycleview.init') to r('RecycleViewBehavior', module='kivy.uix.recycleview').
PS factory_registers.py also has r('RecycleView', module='kivy.uix.recycleview.__init__'), I didn't touch it.
Related
I have a GUI application made using PySide2 and it some major modules it uses are OpenVino(2019), dlib, OpenCV-contrib(4.2.x) and Postgres(psycopg2) and I am trying to freeze the application using PyInstaller (--debug is True).
The program gets frozen without errors but during execution, I get the following error:
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
after which the application exits.
I have tried many suggestions provided in other stackoverflow questions/github issues but none of them have worked.
I have python version 3.7.6 but I have also tried with 3.6.8 (both local installation and after creating new venv in pycharm). I have tried different versions of pycharm as well(it shows som other errors below 3.5). I have tried pycharm 3.6 both develop branch and master branch.
I have checked my PYTHONPATH and PYTHONHOME in env variables, they are pointing to python's location.
I have modified my specfile to include the necessary binaries, files, imports and folders. I would share it if needed. Also any other logs during build or execution.
I would like to know what I should do to solve this, wheather this issue is because of some component or is this a PyInstaller issue, and if so, should I raise it on github.
My os is windows 10.
You changed the python version. So, you have to give a new path according to the Python version.
Just remove all older version and the current one and reinstall new Python v.3.8.1
You need to include base_library.zip in your application folder
I was building a simple GUI I made with PyQT5, and everything works fine during development build using py2app. When I go to to build the .app file, however I get a crash in the PyQt5 code:
File "/usr/local/lib/python2.7/site-packages/PyQt5/uic/port_v3/ascii_upper.py", line 24, in <module>
_ascii_trans_table = bytes.maketrans(b'abcdefghijklmnopqrstuvwxyz',
AttributeError: type object 'str' has no attribute 'maketrans'
I've traced this down to what seems to be PyQt5 trying to run python 3 code from the port_v3 module, however I am doing everything in 2.7, and I can't figure out why it's trying to load Python 3 when it gets to building the PyQt portion of the app. Any ideas how to track this down or a workaround?
After digging around and watching py2app take forever, seemingly trying to package every module installed on my machine for a simple app, I abandoned py2app altogether. I went with pyinstaller instead and it worked like a charm. Quick build and everything worked fine with all the dependencies for python 2.7.13 and PyQt5.
I know this isn't a solution to my original question about py2app, but still solved the original problem of trying to get an .app file bundled, so anyone else having this issue with py2app, I'd suggest trying pyinstaller.
(New in python+kivy here).
Hi, I'm trying to get python with Kivy up in running and I just wanted to know if there's a way to run Kivy apps in PyCharm since I'm getting an error:
Traceback (most recent call last):
File "C:/Kivy/kivy/examples/tutorials/pong/main.py", line 1, in <module>
import kivy
ImportError: No module named kivy
when loading this file with pycharm, notice that that's the sample game out of the box, I can run the app via right click->sendTo->kivy.bat but I don't think that large scale apps actually do it that way -.- there must be a simpler(and hopefully more graphic) way to use Kivy, after a lot of asking to Dr. Google I give up, Thanks in advance!:)
BTW: My main interest is making apps that makes basic database requests and at the same time are GUI friendly , Kivy was my first option next to WX but if there are any suggestions they are welcome :)
I just put up a tutorial on how to setup pycharm & kivy on os x
Short Version for Windows (I assume this will work):
After you install kivy, you need to create a python interpreter for kivy - if you already had python installed, it's the wrong python to do Kivy work. Check C:/Kivy/kivy/ or the contents of kivy.bat to get the path to the python.exe distributed with kivy ( I found C:\Kivy141\Python\python.exe on one page, but that may be if you install kivy manually)
When you find it, your kivy project python interpreter needt to be that one.
Good luck!
With PyCharm on OSX I had the same problem and solved it by creating a VirtualEnv in PyCharm (see PyCharm docs for this) and some Kivy paths to the virtualenv. You can find this by selecting the VirtualEnv and select the tab "Paths".
You can probably find out the correct paths by inspecting the kivy.bat file. I did something similar on the Mac.
I wanted to include a picture to show my paths settings, but my Stackoverflow karma level doesn't allow this.
PyCharm 4.0 changed the answer, now it's just set some environment variables. I updated the Kivy Wiki for setting up PyCharm on OSX
For OSX 10.10.2, kivy 1.9.0, and Pycharm 5.0.2 (free Community Edition), the instructions at the link below worked for me:
Setting up Kivy 1.9.0 with PyCharm 4.5 EAP on OS X 10.10.3
Substitute PyCharm for PyCharm-EAP in the instructions(which only occurs once).
I entered each Environment variable separately, rather than pasting them in as one long string.
Pay attention to the titles of the windows where you enter things. The instructions tell you EXACTLY which window you should be looking at.
To anyone that may see this:
Follow the wiki guide to create the symlink.
In Pycharm, add a local file for the project interpreter, then click the "more" button, go to the pencil, and manually change the link to /Applications/Kivy.app/Contents/Resources/script . That's how I got mine to work, latest PyCharm CE, Kivy, Python 3.5, and El Capitan
I'm running Python 2.7, with the latest version of GTK installed.
I'm trying to import gtk with the following line of code:
import gtk
It is throwing the following error:
Traceback (most recent call last): File
"C:\GTKTutorial\tutorial.py", line 3, in
import gtk File
"C:\Python27\lib\site-packages\gtk-2.0\gtk__init__.py", line 40, in
from gtk import _gtk ImportError: DLL load failed: The specified
procedure could not be found.
How do I fix this? import pygtk is working, and I have Glade 3.8.0 installed.
Where did you get the PyGTK installer from? Try using this one: http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/pygtk-all-in-one-2.22.6.win32-py2.7.msi
I just spent 3 days debugging this issue on my computer. This problem can have many root causes because importing gtk actually causes a lot of DLLs being loaded. If any of them fails, you get the same error message. For me, the break-through was
http://www.dependencywalker.com/
which I used to profile the command
python -i -c "import gtk"
On my PC, a wrong version of zlib1.dll was in the system32 directory, which prevented the right one in gtk\bin from loading. And it did that even though the first entry in my path pointed to gtk\bin.
I deleted the zlib1.dll from system32 (the application that put it there deserves to die) and the import worked fine. Your problem may be different, but dependency walker probably can give you a hint on what is going wrong.
Windows can have other reasons for loading a DLL other than the one you put in your directory or path. I found the blog
http://www.davidlenihan.com/2007/07/winsxs.html
useful. It describes Microsoft's solution for managing many versions of DLLs, and how to troubleshoot problems with it.
I used to use Python 2.7 and then IDLE was working. I uninstalled it and installed Python 3.1.
Right now Idle cannot launch. What should i do to get it running?
NOTE:
I tried c:\Python31\pythonw.exe c:\Python31\Lib\idlelib\idle.py
i uninstalled 3.1 and installed back 2.7, not working neither...
I got the same problem on window 10. Steps to solve the problem:
Locate the .idlerc folder in your profile directory (e.g. C:\Users\{your-username} without the braces).
Delete the .idlerc directory.
It worked for me...
In the past, I've often found that when I had some issues with the python.org version of some Python release, specifically on Windows, installing instead the activepython version of the same release, from ActiveState, made the problems go away. So, in your shoes, the first thing I would try would be ActivePython (I don't think they have a 2.7 yet -- it's probably been around for too short a time yet -- but they definitely do have a 3.1).
EDIT: Versions 2.5, 2.6, 2.7, 3.2, 3.3, and 3.4 have been added.
I too faced the same problem. But at last solved like this -->
Run Python\Lib\idlelib\idle.py as admin, i got the error that the file "recent-files.lst" can't be opened.
So go to your home folder, show hidden files, click on .idlerc and delete the file named "recent-files". Now IDLE is working...
My system is Win7/64 Enterprise edition and the Python version is 2.7.3 (I need this one...).
This is what I got when I ran idle.py from the command window:
"
C:\Python27\Lib\idlelib>idle.py
Traceback (most recent call last):
File "C:\Python27\Lib\idlelib\idle.py", line 11, in <module>
idlelib.PyShell.main()
File "C:\Python27\Lib\idlelib\PyShell.py", line 1406, in main
root = Tk(className="Idle")
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1685, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:\Program Files (x86)\CSR\BlueSuite 2.5.0} C:/Python27/lib/tcl8.5 C:/lib/t
cl8.5 C:/lib/tcl8.5 C:/library C:/library C:/tcl8.5.2/library C:/tcl8.5.2/librar
y
This probably means that Tcl wasn't installed properly.
"
Indeed there was no "tcl8.5" folder in any of the listed above place but it was under:
"C:\Python27\tcl".
When I copied it under "C:\Python27\lib" then IDLE started (with some other warnings but this seems related to my corp environment...)
In conclusion this looks like either an installer failing to copy the folder where it is supposed to or failing to set up some environment variables correctly or there's an actual bug int the release likely to show up on Win7/64 on certain edition(s).
I am not a Python expert enough to debug Python itself, so please somebody take it from here...in the meantime I will see if the "workaround" is good enough :-)
Just try to delete the files which end with .idlerc in your profile.
1. Enter <win-r>, and type %USERPROFILE%\.idlerc
2. delete all files in idlerc folder
3. it works on my PC(win7 OS)
I ran into this weird situation also, and did a bit of troubleshooting. As a rigorous task, uninstalling, and re-installing the versions of python(2.6, 2.7, 3.1) and all my associated extensions and other site packages: in addition to the subsequent options that others have provided, that may have, or may not have, helped fix issues with the IDLE working properly. I found and error on my part, installing a 32 bit .msi on a 64 bit system causes a runtime .dll error with tkinter and therfore, causes IDLE to not start up properly, or not at all. Be mindful, and don't be a blind bat like me... :)
Once I copied the C:\Python27\tcl\tcl8.5 folder to C:\Python27\Lib as suggested in Bogdan's answer the error message "This probably means that Tcl wasn't installed properly" went away. Instead I started seeing "This probably means that tk wasn't installed properly". I had to copy the C:\Python27\tcl\tk8.5 folder to C:\Python27\Lib as well. Once I did that running idle.py from the command line in C:\Python27\Lib\idlelib was error-free.
Run python setup program, change python 2x, choose to entirely remove tcl/tk, proceed, then run setup again, change python again, on the tcl\tk choose entire feature will be installed, proceed.
It worked for me.
Even I was facing same issue with my code, But It is resolved now.
I was using 2.6 which was having old version of Xlrd, so I updated xlrd in 2.7 using pip and I opened my file with 2.7 and it works.
Delete the .idlerc directory as suggested above, run the python installer again and choose repair. If needed associate the .py files with the python.exe executable in Python27 folder. This worked for me after removing python 3.7.