I have a problem with exporting my python project. In this project, I am using the NLTK library, but when exporting it using the Pyinstaller tool the error mentioned in the title appears. I've been scouring a solution for weeks and I have not gotten an answer. I tried to use cx_freeze but other errors appear ... could anyone help me?
Tried use cx_freeze, and Pyapp.
'''Unable to find "/usr/nltk_data" when adding binary and data files.
I solved the problems editing the pyinstaller nltk-hook. After much research, I decided to go it alone in the code structure. I solved my problem by commenting on the lines:
datas=[]
'''for p in nltk.data.path:
datas.append((p, "nltk_data"))'''
hiddenimports = ["nltk.chunk.named_entity"]
What's more, you need to rename the file: pyi_rth__nltk.cpython-36.pyc to pyi_rth_nltk.cpython-36.pyc . This file have 1 more underline. Warning with the python version.
try making folder in your project /usr/nltk_data and there paste your nltk data.
do you have space in your username? avoid it.
nltk.download()
check the path there, or change it.
Related
I want to speed up my python code so i tried to translate it in c thanks to cython. I followed the basics tutorials and other youtube videos and i finally could create a functions_cython.c file. But somehow i just can't import it. I tried to import it in my main file, i also tried in another file named 'testing.py' but I always receive errors saying that the module 'functions_cython' does not exist, while it actually is in the file. Do you have any idea why ? (i linked some images if that can help)
The problem was because I was using PyCharm's "community version" and this version (in opposition of the professional one) does not allow to import .c formats. I switched to VS Code.
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
I am building a GUI tkinter python3 application and attempting to compile it with py2app. For some reason when I try to launch the .app bundle in the dist folder it gives me this error:
A main script could not be located in the Resources folder
I was wondering why it is doing this, as it is rather frustrating, and I can not find anything about it anywhere. I copied my .py file into the resources folder (Networking.py). Previous to this error I also found an error in the Info.plist. In the key where it states the runtime executable, I found it was trying to get python2.7, which I have updated and am no longer using. I changed it to my current version, which the path for looks like this:
/Library/Frameworks/Python.framework/Versions/3.6/Python
It may be worth noting that it had a strange path previously, which did not look like a proper path to me. It was #executable_path/../Frameworks/Python.framework/Versions/2.7/PythonI removed this completely... Was this wrong? I have no idea about anything about XML, which is what it seemed to be...
Also when compiling this happened:
error: [Errno 1] Operation not permitted: '/Users/Ember/dist/Networking.app/Contents/MacOS/Networking'
Any help would be highly appreciated! Thanks!
EDIT
I actually figured out: a bit of a stupid mistake, but since I'm using python 3.x I have to type in python3 before doing it.
In your "setup.py" file that you used to create the application, did you remember to list all the modules used in your code. For example, if you used the OS and Glob modules, then you would add this to your setup.py next to "OPTIONS":
OPTIONS = {'argv_emulation': True, 'includes':['glob', 'os']}
Basically, anything that you import into your module, you should include in the setup.py. Let me know if that works.
I actually figured out: a bit of a stupid mistake, but since I'm using python 3.x I have to type in python3 before doing it.
I had the same problem.
python setup.py py2app
I tried
python3 setup.py py2app
and it worked just fine. Hope this helps.
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
Here is my problem:
I have an assignement for uni where we're asked to make an analysis of some problem (not important).
We're given datas on excel files, and we are supposed to use python to code and solve our problem.
I've been through the internet to find out I had to install pip and to install the xlrd and openpyxl libraries (I wasn't sure which one).
I am hoping to be able to eventually use these files through Python and to manipulate the datas just thanks to some simple line commands, and I guess now I've fixed everything except one thing.
On Python Shell, I'm writting the following instructions:
import xlrd
import openpyxl
file_location = C:/Audrey/Desktop/CW/time.xlsx"
workbook = xlrd.open_workbook(file_location)
And then I got the line
"No such file or directory".
Though, I am sure, that I did not any mistake.
I have absolutely no clue what to do.
Did I forget a step ?
Can someone help ?
Forgot a quotation mark I believe:
file_location = "C:/Audrey/Desktop/CW/time.xlsx"