- The first one we come across in many cases should be:
pkg_resources.DistributionNotFound: The [distribution name] distribution was not found
where[distribution name]
is among $\{$google-*-core
,google-cloud-*
$\}$ for various possible*
. The first strategy is reinstallation. To somebody reinstalling the package in trouble will do. To me, I completely reinstall Python from 3.8 to just 3.7.5.
And in order to keep projects' dependency separate enough, the first package I download ispipenv
and installation of the second first package is done in pipenv shell. No module named [sth]
, to me[sth]
's are respectively google and then google.cloud. I have tried to edit.spec
to include these packages ashiddenimports
thenpyinstaller xxx.spec
.
If problem persists, try topip show [missing package]
to get the location of problematic package, then add this location topathex.
In my case reinstalling Python gets rid of all the problems in this bullet point.-
After reinstallation, we have a very clean environment, the only problem left to me is again the
google-cloud-vision
, which is solved by addinghook-google.cloud.py
the followingdata += copy_metadata('google-cloud-vision')
- After we get through all the trouble and successfully build an executable file, we may next encounter :
Error: Exception in 'grpc._cython.cygrpc.ssl ............ pem_root_certs != nullptr
To this we create ahook-grpc.py
and type the following:from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files('grpc')
Sunday, November 24, 2019
Pyinstaller --- executable file with Google API --- obstacles I have:
Saturday, November 23, 2019
Find all required python library inside a project
I was using Python3.8 throughout a project but suddenly one of the required library require Python3.7 to work with, therefore I need to mirgrate everything to another virtual environment.
So I need to know the dependency that I was using in order to do migration, just do the following:
We start off installing
now switch into our virtual environment and pip install them:
So I need to know the dependency that I was using in order to do migration, just do the following:
We start off installing
pip install pipreqsNext cd into working directory and then
[working directory]>pipreqs .which yields a message:
INFO: Successfully saved requirements file in .\requirements.txtthat looks like the following:
now switch into our virtual environment and pip install them:
pipenv shell pip install -r requirements.txtand we are done.
Saturday, November 16, 2019
installation of pytesseract
By pip install tesseract we can install a wrapper of an application based on C++ library. It would not install the tesseract application into our computer. If we run import pytesseract and related API, we will get the following error:
TesseractNotFoundError: tesseract is not installed or it's not in your path
Wednesday, November 13, 2019
Sunday, November 10, 2019
On Logistic Regression
Denote $\sigma(z)$ the sigmoid function defined by $z\mapsto 1/(1+e^{-z})$, for a given feature $X\in \R^n$ the estimator of $\mathbb{P}(y = 1 |X)$ is given by \[\hat y= a =
\sigma(w^TX+b),
\] where $w\in \R^n$ and $b\in \R$.
\sigma(w^TX+b),
\] where $w\in \R^n$ and $b\in \R$.
Subscribe to:
Posts (Atom)