pkg_resources.DistributionNotFound for cvlib library - python

I have written a python script that uses cvlib library, when i run the code as a python scrept it works fine, however; when i converted the code into an exe file, everything seems to work fine, apart from importing cvlib library.
The error shows up like the follwoing:
pkg_resources.DistributionNotFound: The 'cvlib' distribution was not found and is required by the application
The detailed Error
Has anyone face this problem before ? if so, could you please provide me the proper way of fixing it as i think there are some dependencies issue.

I figured out finally what the problem was, Pyinstaller sometimes is not able to include some libraries that we import in our (.py) file. So, When Pyinstaller creates the (.exe) file, it agnores some imports, so the solution is to copy the folder of these imports, For example, cvlib forlder and paste it as it is in the same location as your (.exe) file.

Related

No module named 'pygame.base'

I've been having a lot of trouble converting one of my python projects into an executable with the use of pyinstaller. Upon launching the .exe, it gives this rather simple error that I just can't get my head around. The script works as intended in the editor (pycharm in this case).
In pyinstaller there is a single warning message displayed, "Hidden import "pygame._view" not found!"
I've tried using 32 and 64 bit versions of pygame, reinstalled several times and purged pip cache history.
I'm aware images aren't liked around here, but the .exe only remains open for one frame, I simply don't have enough time to copy the actual text.
Full error message
If the code works fine in pycharm, then it might just be an issue with importing the module in the script. At least that's what the error emssage seems to be saying. Do you specifically import pygame.base or the like in the __init__.py script?

Sklearn missing dll file

So I imported the sklearn module into my python script, which runs fine when executing from the terminal; but I wanted to turn it into an executable using PyInstaller, to which I used the following command: pyinstaller.exe --onefile MainApp.py. Now when I try to run my executable I get a missing dll file error; Note that this worked fine before I imported sklearn, which makes me think this is a problem with sklearn module.
I uninstalled and reinstalled said module but it did not work.
It is also interesting to note that the _MEI57882 folder does not exist in my my Temp folder
Update
I've also run across instances of other people facing the same problem: https://github.com/scikit-learn/scikit-learn/issues/15899, but it sounded like they were trying to fix the problem with the install, back in 2019. I have the latest sklearn module to date so I'm still running into the problem.
Bigger Update
After talking with some contributes of scikit-sklearn, this error appears to be on the side of py-installer; not the module itself.

Incompatibility pyinstaller and sklearn

I'm trying to create a .exe file com a .py file using auto-py-to-exe, that uses pyinstaller for creating the file.
The problem is, on codes that I import the sklearn lib, I get the following error on opening the output exe file:
enter image description here
I have already tried including hidden imports from sklearn, cx-freeze, sklearn.neighbors.typedefs','sklearn.neighbors.quad_tree','sklearn.tree._utils' and sklearn.utils._cython_blas.
Also tried one file and one directory, both with same problem.
Also tried directly using pyinstaller, with same error. It works fine on codes without sklearn. Tried on python versions 3.6, 3.7 and 3.8.
Does anyone have a glue on how to solve this problem?
Thank you.

python, unable to make executable from script when I use scipy

I have a python application and I want to extract the executable. I have used py2exe with no problem in other scripts. But in this one I get errors that I think have to do with the fact that I import and use scipy.
My code runs fine in eclipse. Trying to make the procedure with scipy at first I got 3 dlls missing ("libmmd.dll","MSVCP90.dll","libifcoremd.dll"). At first I exluded these from setup.py and the .exe file was made but it did not run. After that I downloaded the dll files (also deleted the exclusion of setup.py) and added them in "C:\Python27\DLLs" and also "C:\Windows\System32" and "C:\Windows\SysWOW64" (I have 64 bit windows7). Again the exe is created in the folder dist, but trying to run it I get this:
http://imageshack.us/photo/my-images/145/py2exe.png/
Then I tried to do it with cx_Freeze. Again the .exe file was created but I get this error:
http://img521.imageshack.us/img521/3843/cxfreeze.png
So I suppose it has nothing to do with py2exe or cx_Freeze, but with the fact that scipy needs some dependencies that for some reason work in eclipse, but not when I make the executable.
Has anybody faced this problem? Any ideas on what I should do?
Thank you in advance!
EDIT: I did it with pyinstaller-2.0. It did not run at first. Then I added the DLLs to the folder, after that I added numpy and scipy to the folder and finally after an error message I added kdtree.py to the folder. I was thrilled to see that it runned! But then dissapointed again cause it runs ONLY in my pc (some useful .exe there)! I added the folder it to a dropbox folder, from where it runs in me with no problem but not for others. The error in other machines I tried is:
importError: DLL load failed: %1 is not a valid Win32 application
You could try putting the DLL files directly next to your executable. Also my py2exe gives some information about possible binary files that you might need to distribute with your application:
*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.
//Snip list of paths to dlls

Pyinstaller no module named 'pyfiglet.fonts ' pyinstaller '

Hey i want to export my Python Selenium Projekt with Pyinstaller but every time when im trying to do this it wotrks but when i start the exe file i became this error:
ModuleNotFoundError: no module named 'pyfiglet.fonts'
to start pyinstaller i used this command:
pyinstaller --onefile SickoAIO.py
Without a little more information, it's hard to tell what's wrong. However, I'm going to assume some things you haven't stated and provide some ideas:
Assuming SickoAIO.py works fine before you try to use pyinstaller, sometimes if in your Python code you only imported the more general module:
import pyfiglet
but need to use pyfiglet.fonts, a "hack" for it to work in pyinstaller could be to make the import more specific:
import pyfiglet.fonts
I've not used pyfiglet, but this hack worked for me with the numpy module, for example.
Another thing that has helped me troubleshoot a similar issue with numpy, scipy, etc. is updating the versions of the module and/or pyinstaller
It's possible you may need to use hooks, especially since it seems like pyfiglet may not play well with pyinstaller. This is explained specifically for pyfiglet here:
https://hugomartins.io/essays/2019/06/pyinstaller-pyfiglet-trouble/
I didn't try it, and it looks like you may need to click on more links in that webpage as well as learn more about how hooks work in pyinstaller (https://pyinstaller.readthedocs.io/en/stable/hooks.html?highlight=hook) to understand the full issue.

Categories

Resources