-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.6.2 include errors #124
Comments
To format your config wrap it with three backticks ( ``` ) before and after. Do you have Are your packages and files indented after the first line? For example
|
Have you tried with different versions of Python? |
I have not tried it with other versions of Python because i do not know how that would effect my code and all of my packages. I included |
I think it is because your Desktop is 64bit and your laptop is 32bit? Try setting the bitness to 32 bit http://pynsist.readthedocs.io/en/latest/cfgfile.html#python-section |
I have a first gen Surface Pro, i just checked the System specs and i do in fact have 64-bit operating system on both my Desktop and Laptop. |
Thanks @Siecje for helping debug this. :-) That error message usually means that the DLLs are not all for the same bitness. You can run 32-bit applications on a 64-bit operating system, but all the DLLs have to have the same bitness as the exe (python.exe) you're running. Where did you get the DLLs from? And can you check the bitness of the python.exe it installs in the application? |
I got the DLL's from my pythyon36 DLL folder. On the reddit page i refered to this post thinking it could solve my issue: |
BTW, you're using the 'bundled' Python format, which we made the default when you build with Python 3.6+ (and will be the only option at some point in the future). 'Bundled' Python can make much smaller installers than the alternative 'installer' format, but part of the reason for that is that it doesn't include Tkinter by default. So thanks for helping us figure out what's needed to use it with Tkinter! |
Here's some info on how to check if a Windows binary file is 32-bit or 64-bit: https://superuser.com/a/889267/209976 Can you try that on the |
The .exe is x64 If you need anything else from me please ask. Thank you very much for all the help. |
OK, that's the key. If the exe is x64, it needs x64 DLLs as well, but you've got x86 (32-bit) DLLs. I think the easiest way for you to fix it is to build with an x86 Python, so you can keep using the same DLLs. You can do that by adding |
I changed the bitness=32 and double checked the python.exe and it is in fact x86, but i still get the same errors. I am currently double checking. EDIT: should the DLL files be in the main directory or should i place them somewhere else? currently they are just included and that's it. EDIT2: I Triple verified that python.exe and both DLL files are x86. |
The DLLs might need to go in the same directory as After that, check the bitness of any other DLLs and |
Aha, I think that's progress - you're past one error and onto another. I think what you're trying is the right thing. You might also need to set the TCL_LIBRARY environment variable in Python before importing tkinter. |
It is now working, but now i'm trying not to include the 1000+ files of tcl folder. EDIT: Alright so it needs more than just that one init.tcl file so because i don't wanna find out, i included the whole TCL folder found in the python directory and i placed it in a folder named "lib" which i include while building so that it can actually find the files. EDIT2: ALRIGHT SO, with the fixes i made... i still have the original issue for some reason where i run the exe, i press the shortcut made by the installer, and nothing happens. Using the Cmd line works, but the shortcut doesn't and i really need that to work so anybody can run it easily. Any help in that area? |
Awesome! Could we get you to write up all the pieces you needed to distribute a tkinter application with bundled Python? Perhaps we can even make an example out of it. :-) For the issue with the shortcut, if it fails to start it should write out a log file with details of any errors that occurred. Have a look at the info here: |
I will definitely write up what is needed when i get the shortcut working. I found the log file and it gives the following error:
To clarify, this does not pop up when i run from the Cmd line. |
Are you using the |
I suspect that you might need to move either the lib folder, or the tcl/tk dlls, or both, to the directory where |
The only difference between the shortcut and running it from |
If you put the .dll files in the Python directory does it work? |
putting the 2 .DLL files in the python directory does not fix the shortcut issue. I just tried that :/ EDIT: Although i do suspect that like my other issue, it is a matter of what directory they should be in. |
Is it still the same error in the log file, or a different one? If we can't find a better way round it, one hackish workaround might be to use |
exact same error in the log file i am afraid. |
This seems like the same problem that I had by the of the long discussion I thought we added the |
Yup, your PR #101 added that. @SecretShop can you double check that by printing |
Or maybe those DLLs need to go in the |
EYYYYYYYYYYY in pkgs fixed it EDIT: I'm rebuilding the whole thing to make sure it builds and works properly. |
🎉 ✨ 🍰 |
Okay new issue, how do i make the installer put those .dll files into |
Something like this should do the trick: files = README.txt
tcl86t.dll > $INSTDIR\pkgs
tk86t.dll > $INSTDIR\pkgs |
It works now!
|
Thanks! It's definitely useful to work out what's needed for a Tkinter app with bundled Python, especially as I'm planning to make bundled Python the only option. |
Files or Folders needed and their location in ( )
Copy all the contents of Be sure to include the following as packages :
Finally, ensure |
Thanks! I think copying the tkinter folder to Does the lib folder go in the main installation directory? So you end up with paths like I'm pretty sure you do need |
You are correct about copying tkinter i just checked. I removed that and noted it just needs to be included. Yes and Yes, i clarified up above because i was unclear. Also yes, i double checked and this does grab that file. |
With thanks to pynsist creator @takluyver & to @SecretShop for their inputs on this tkinter issue, here's a pynsist config file for ready-reference of future readers of this thread (might save a few iterations & hours!): pynsist build config: for Filer app; w/ tkinter files=== Application section ===[Application] === Python section ===[Python] bitness is required for tkinter distribution; as of pynsist 2.1=== Include section ===[Include] packages=mypkg1 tkinter & _tkinter are required for tkinter distribution; as of pynsist 2.1 & python 361.files = lib The above files are required for tkinter distribution; as of pynsist 2.1;lib is a folder, with a copy of all contents of folder tcl found in the main directory of Python; must be named as lib!Related: https://bitbucket.org/anthony_tuininga/cx_freeze/issues/155/required-environment-variables-tcl_library |
Thanks! Would anyone be interested in turning this into an example in the examples directory in the repo? The ideal would be to include a script which can download and arrange the necessary files (like in the pywebview example), but it would also be a valuable contribution if it uses human-readable instructions on where to find the tcl/tk libraries. |
@takluyver I have exactly this requirement for Mu. Folks at the Raspberry Pi Foundation want My question: where do I source the dlls needed (tcl86t.dll and tk86t.dll) and I assume they'll work for both 32 and 64bit versions of Python. I've found installers (see: https://www.activestate.com/activetcl/downloads) but all we need, AFAICT, are the dlls. Right..? EDIT: Scratch that... we need the tcl directory too. :-/ Hmm... could we (pynsist) provide a zip for both 32 and 64 bit tcl dirs..? |
You should be able to get the DLLs from a regular Windows installation of Python. The problem for Pynsist is that the 'embeddable zip file' builds we're using don't include Tkinter. I don't know how Python loads the tcl/tk DLLs, but I would assume they need to match the bitness of the Python interpreter. |
OK... I'm in London today (away from my sacrificial Windows laptop), but will have a go tomorrow and let you know how I get on. |
Thanks. I may try to investigate it as well. |
My current thinking (pending actual work on a Windows machine) is:
The requirement for downloads means that you could still build this on, say, a Linux box. We'd need to host them somewhere (as files associated with this project perhaps..?). Thoughts..? |
Sounds good to me. We'll also need to make the My strategy for hosting some files previously has been to put them in an orphan branch in this repository, make a tag, and then use RawGit for the download URLs. An alternative might be to pack them into wheels and use PyPI for hosting. |
Ugh... so this is proving problematic. I suspect part of this is because I'm doing this work on Linux (although pynsist should work on non-WIndows platforms). Here's what I've done so far:
Ugh... "HELP"...!?!?!? |
tl;dr - once I know what needs to go where in the installed application so that it actually works, then I can work backwards from that to know what things need to be downloaded and copied into the correct locations. |
Also, when I try building the installer for Mu on Windows, well, you'll see here... ;-) https://ci.appveyor.com/project/carlosperate/mu/build/1.0.788
:-/ Although I notice the |
With the I'm not sure how to proceed until I know what the geography of a known-to-be-working application should look like in terms of tkinter. |
Apologies for the noise... that final error is because I put the |
Yeah, we should probably allow for empty lines in all lists in the config file. From the config @SnidhiSofpro posted above, it looks like the I'm going to try to play around with this tomorrow and see if I can get it working. May as well do something else useful while I'm on strike. ;-) |
OK... I've got it to work in that I've managed to build a 64bit installer for Mu that includes tkinter and (here's the ultimate goal) turtle modules. Now that I know what file goes where, I'm left wondering if it might just be easier to address this problem as part of Mu's CI / build automation. I.e. I'm going to zip up the files needed for 32 and 64 bit tkinter so you just have to unzip them into the project's directory before running pynsist so everything will get into the right place. It's a far quicker / simpler solution (for me, YMMV) than hacking a fix into pynsist itself. Thoughts..? (I'll point you to the resulting work when done.) In any case, I'll create a PR for an update to the docs to address tkinter in an easy to understand way. |
Assets to be included in the installer for 32 and 64bit Windows can be found here: https://github.com/mu-editor/mu_tkinter (subject to testing). |
Thanks @ntoll ! I might still look into some integration to make it easy to do this with Pynsist, but I don't know when I'll get round to that, so it would be good to have some documentation/example showing people how to do it with the machinery that's already there. |
OK... I've successfully completed this work for Mu. Documentation related PR coming just as soon as I've written it up. :-) |
I just want to say thanks to takluyver for creating this tool, and also to ntoll for the work you've done in sorting this out and putting the resources up. This afternoon, I just successfully built my first ever windows installer for my first ever Python app using a GUI. It is a 32bit installer for a project using Python 3.6.4, matplotlib, numpy, scipy, and tkinter. I decided to make it 32bit so that I could run this on legacy machines as well as new ones my clients might have. I would still be struggling if it weren't for this thread and these resources. After getting oriented on the structure of the installer.cfg, the only trouble I had was that some of the dependencies of matplotlib were not obvious. But I chased them down one at a time and added them as the execution showed the errors. In case anyone else comes across this same thing, they turned out to be, at least in my case: My working environment is Anaconda 3 and I guess you can say that this is a byproduct of it giving you almost everything you need, and casually shielding you from knowing exactly what that is precisely. |
Thanks @sprocket1 - it's always good to hear that the tool is working for someone. I would still like to make the dependency handling more automatic at some point. But I don't know when that point will be. |
thanks |
Link to Reddit where problem started: https://www.reddit.com/r/Python/comments/6txk3x/pynsist_troubles_with_running/
The following is my installer.cfg file
So i have my desktop and a laptop, and my desktop has python and everything on it to work with python. So every time i want to test to see if the program runs i put it on my laptop since it doesn't have python and i wanna make sure it works in that environment.
The following is the error message i get whenever i use command line to run "python\python.exe LolDataComp.launch.pyw":
The text was updated successfully, but these errors were encountered: