Comments (7)
The problem appears to be that applangdetect is trying to find some file called messages.properties. Correct?
Since this is not a Python file and not brought in by an import in the source code, there is no way for PyInstaller to know it should be included. That is why pyinstaller/pyinstaller#1842 referred the user to the part of the manual that tells how to include data files. The manual is no longer at that URL, it is here: http://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle
You need to figure out what non-Python files applangdetect will need at run-time and modify the .spec file to tell PyInstaller to include them. If you need help in that, you can use the PyInstaller mailing list at https://groups.google.com/forum/#!forum/pyinstaller .
A PyInstaller "hook" is a file that builds this information into the PyInstaller distribution so others who use applangdetect will not need to modify the spec file. Perhaps when you work this out you can contribute a hook file for it.
from pyinstaller-hooks-contrib.
I had the same issue. However I used some hooks for this as it was easier in my opinion
Solution guide
- In your project root directory (where you execute pyinstaller), create a subdirectory for the hooks. In this case I' ll name it
app-hooks/
- Generate a file in that folder
app-hooks/hook-langdetect.py
:
from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all('langdetect')
- Generate the .spec file by running Pyinstaller at least once.
- Modify it to include the hook:
# Leave it unchanged
# ...
a = Analysis(
# Leave it unchanged
# ...
hiddenimports=['langdetect'], # <--- just to be sure. It should work without it too.
hookspath=['./app-hooks/'], # <---- make it point to that hook folder
# Leave it unchanged
# ...
)
# Leave it unchanged
# ...
- Now rebuild your app using the spec.file
pyinstaller --onedir your_file_name.spec --clean
Now the issue is fixed and you can run your app.
from pyinstaller-hooks-contrib.
This worked for me:
a = Analysis(
# your other stuff here...
datas=[
('langdetect/utils', 'langdetect/utils'), # for messages.properties file
('langdetect/profiles', 'langdetect/profiles'), # don't forget if you load langdetect as a submodule of your app, change the second string to the relative path from your parent module. The first argument is the relative path inside the pyinstaller bundle.
]
# the rest of your analysis spec...
)
from pyinstaller-hooks-contrib.
You may want to provide a hook for this.
from pyinstaller-hooks-contrib.
Did you fix it ? I have the same problem and when I followed the previous answer I didn't got the required hooks:
114 INFO: Determining a mapping of distributions to packages...
14033 WARNING: Unable to find package for requirement six from package langdetect.
14034 INFO: Packages required by langdetect:
[]
from pyinstaller-hooks-contrib.
If your PyInstaller version is reasonably recent, you should now be able to use:
pyinstaller --collect-datas=langdetect your-code.py
from pyinstaller-hooks-contrib.
Thank you so much that's solved my problem
from pyinstaller-hooks-contrib.
Related Issues (20)
- Pydantic.compiled Depreciated
- Pydantic V2 no longer containers a compile flag which results in an error during build HOT 1
- jsonschema hook is broken for jsonschema >= 4.18
- hook-rtree.py: libspatialindex is either not installed ... HOT 2
- ModuleNotFoundError: No module named 'dbus_fast._private.marshaller' HOT 1
- for python3 it is no need `prettytable` hooks HOT 2
- Missing imports during packaging with PyInstaller 5.13 and pyinstaller-hooks-contrib 2023.12 HOT 2
- ImportError: cannot import name '_pylon' from 'pypylon' after pyinstaller 6.3.0 HOT 2
- OpenCV missing data files in /cv2/data directory HOT 1
- sklearn dropped neighbors._typedef in version 1.0.2 HOT 1
- Add PyInstaller in 'I want to help' section HOT 2
- Falcon hook
- PyInstaller: Unable to find '/usr/sbin/neato' when adding binary and data files HOT 8
- hook-transformers fails to run due to partially initialized huggingface_hub HOT 4
- cryptography with OpenSSL 3.x HOT 18
- `gcloud-aio-*` (and probably also `gcloud-rest-*`) trigger `gcloud` hook, which fails because `gcloud` is not installed. HOT 1
- 2024.5 issue importing cryptography hook during build HOT 15
- pyarrow HOT 8
- Trying to import "isolated" from "PyInstaller" when pyinstaller version is lower than 5 HOT 1
- A problem converting a grib2 file to a netCDF file using cfgrib and xarray HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyinstaller-hooks-contrib.