PyInstaller + Wine + NLTK = WinError 127 "RtlIpv6AddressToStringA". Any ideas? - python

The issue
I developed a PyQt app that uses NLTK to throw item recommendations based on a query, and now I need to package it into a standalone app. After checking the internet for weeks, I tried fbs, but ended up going to pyinstaller. When I tweaked the necessary things, the app was succesfully built... For Linux. Issue here is, I need it to be able to run on Windows, and I'm using Ubuntu.
In order to package it for Windows, I read everywhere that the best choice is to just wine pyinstaller and call it a day, but when I do that, I end up with this error message:
OSError [WinError 127] Procedure not found: 'RtlIpv6AddressToStringA'
For what I can collect, this is a semi-usual thing, since it looks like NLTK and PyInstaller do not get along well.
What I tried
Modifying hook-nltk.py and changed the lines regarding nltk_data
Using PyInstaller with the .py file as well as the .spec file
Looking pretty much everywhere finding someone with a similar problem, to no avail

Related

Pyinstaller can not find scipy.special._ufuncs on another computer

I am trying to get setup with a easily distributable python program which happens to use scipy. I have two windows 10 64 bit virtual machines. On one I have installed the dependencies for my program, and it runs correctly. Additionally I have installed pyinstaller and performed a freeze. The program runs correctly as the building user on the first VM, as well as a new user on the first VM. The issue is that I get a error loading dll on the second VM, which I just spun up as a test.
I attempted to find all imports from scipy and include them as hidden imports. I also included the scipy "extra dll".
pyinstaller --windowed --icon="%SCRIPT_FOLDER%\res\icon.ico" --hidden-import=numpy --hidden-import=scipy._lib._util --hidden-import=scipy.special._ufuncs --hidden-import=scipy --hidden-import=scipy.stats --hidden-import=scipy.interpolate --hidden-import=scipy.special --hidden-import=scipy.cluster.hierarchy --paths C:\Users\User\AppData\Local\Programs\Python\Python37\Lib\site-packages\scipy\extra-dll --workpath "%WORK_FOLDER%" --distpath "%OUTPUT_FOLDER%" "%SCRIPT_FOLDER%\..\something.py" -n something
Also, I can see the referenced dll files in the correct spot in the frozen output folder under scipy/special there are _ufuncs.cp37-win_amd64.pyd and also _ufuncs_cxx.cp37-win_amd64.pyd
The error is generated specifically on the line "from scipy import special".
Also of note, though I guess it does not help much, is that I have followed a similar procedure for OSX and Linux platforms with no such issue, and no need for any manual hidden import specification...
Would appreciate any help that you can give to help figure out what is going wrong.

Create a python 3 exe with pyinstaller with Pmw module

Based on this Previos Post I'm trying to figure out how to make an exe out of my python files. The main issue seems to be that Pmw and its modules do not seem to import correctly though pyinstaller. The main error says:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\User\Name\AppData\Local\Temp\_MEI61522\Pmw
Looking at the Pmw init it seems what it's doing is looking for files in the directory which have Pmw_### and looking in there which has lib and then PmwLoader.suffix and loadther then imports all the dependencies
So now it seems pyinstaller isn't understanding this file dependency system created by Pmw and when I tried to follow the previous post instruction I ran into other errors that made the code unable to compile.
If anyone has any insight on this, that would be fantastic
PMW has a script for bundling (almost) everything into one file which I found in Lib\site-packages\Pmw\Pmw_\bin\bundlepmw.py
My version wasn't entirely Python 3 compliant so I had to make a few edits to the file before adding it to my sources.
Ugly but it worked for me.
Welp, I gave up on pyinstaller and downgraded to python 3.4 and used cx_freeze and created created a single Pmw.py file from some code which I found from python-pmw-and-cx-freeze

package a pyqt desktop application its resource file with pyinstaller

I have created a desktop gui application which i want to package. I was directed to use pyinstaller to package it so i did. I have a mainwindow.py file where i import a resource file (converted to python code) as well as other imports going on in there. However when i run the output file,it gives me an error. I suspected it was due to my resource file, from the error so i tried pyinstaller on one of the modules and it worked perfectly. however i keep getting an error with the MainWindow.py file. I have the image of the error here for your consideration. How do i go around this error?
I have managed to solve the problem. After reading this answer, I tried pyrcc4 with the '-py3' flag and it worked. I think without the py3 flag,the resource file is converted into a python 2.x code. And I was trying to interpret py2 code with py3 interpreter. That's my understanding of the problem tho. But in case you have a similar problem,try using the -'py3' flag for python3 interpreter.Good Luck

Cannot find PRAW config file when wrapping application with py2app

I'm trying to wrap my Python script into an application using py2app, but when I try to run the app I'm getting this PRAW related error:
Exception: Could not find config file in any of: ['/Users/username/CS/Applicationame/dist/applicationname.app/Contents/Resources/lib/python2.7/site-packages.zip/praw/praw.ini', '/Users/username/.config/praw.ini', 'praw.ini']
The strange thing is I navigated to the first path, unzipped site-packages.zip and found praw.ini inside /praw, so I'm not really sure why I'm getting this error. I've also tried using pyinstaller but I get the same error.
I came across this error today - not in the context of py2app, but after a pip upgrade of praw. In case you still have this problem (unlikely :)) and/or in the interest of posterity, here's how I was able to fix it: I noticed that the error was in reading the praw.ini file, which very much exists on my system. The real problem was the owner of the file was root, and the owner only had read privileges. Changing that to have my account read/execute privileges to everything inside praw fixed the issue.

Python And Py2Exe: "%1 Is Not A Valid Win32 Application"

I'm trying to compile a python project into an executable. To test this, I've got Py2Exe installed, and am trying to do their Hello.py test. Here is hello.py:
print "Hello World!"
Here is my setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
I do the following on the command line:
python setup.py py2exe
And I get it mostly working until it start 'finding dlls needed', at which point we get:
Traceback:
<some trace>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Python version is 2.6.6, and I'm on a 32-bit machine running Windows 7. Any ideas or help most appreciated.
In my experience py2exe is rather difficult to use, a bit hit-and-miss in terms of whether it will work or not, and an absolute nightmare to get working at all with any matplotlib import.
I realise this question is quite old now, but I am not sure why people continue to use py2exe when there are much smoother functioning alternatives available. I have have good results with pyinstaller (which was recommended to me after asking a question here on SO where I was also battling with py2exe). Now every time I have tried it it "just worked", so if you're still interested in packing up python code into executables then try give this app a shot instead.
http://www.pyinstaller.org/
Note: py2exe hasn't been updated for some years, while python and 3rd party modules have, which must be partly why it often doesn't work particularly well these days.
Sounds like step 5 in this tutorial describes what you are experiencing:
http://www.py2exe.org/index.cgi/Tutorial#Step5
I had this same problem, this is what I was able to do Q-A. Basically, I downloaded the updated sqlite dll file from sqlite.org. I replaced the py2exe generated DLL file with this new file. The program worked after that. Do make sure you download the 32-bit DLL, however.

Categories