Tesseract 4.1.1 error eng.traineddata not found in google colab - ocr

I am trying to install tesseract 4.1.1 in google colab. I have installed tesseract and I can check the version using !tesseract --version. After that I have download eng.traineddata and org.traineddata in the /usr/local/share/tessdata/ folder
Now when trying to use it from python it's giving me the following error
TesseractError: (1, 'Error opening data file /usr/local/share/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'eng\' Tesseract couldn\'t load any languages!)
I have tried to check the file exist or not using this
if os.path.isfile('/usr/local/share/tessdata/eng.traineddata'):
print ("File exist")
which prints File exist. Any help regarding that will be appreciated. Thanks

Try this command
export TESSDATA_PREFIX=/usr/local/share/

Related

Converting ipynb to html from Colab not work properly

I am using Colab to write a notebook using plotly. Within the notebook everything is fine and I can see the pie, but after converting the notebook into a html I don't see it.
this is the code:
import matplotlib.pyplot as plt
import plotly.express as px
Labels=['No', 'Ex-fumatore', 'Fumatore']
values=[1838, 1293, 574]
fig=px.pie(values = values,names = Labels,hole=.5,title = "Tipologie fumatori In Percentuale")
fig.show()
!jupyter nbconvert --to html /content/pie.ipynb
can somebody help me?
Thanks
There could be various reasons why converting an ipynb file to HTML from Colab is not working properly. Here are some possible solutions you could try:
1. Make sure that you have installed the required libraries in Colab that are needed for conversion. To install nbconvert, run the following command in a new cell:
!pip install nbconvert
2. If the nbconvert library is already installed, try uninstalling and reinstalling it to ensure that you have the latest version. You can uninstall it by running the following command:
!pip uninstall nbconvert
And then reinstall it by running:
!pip install nbconvert
3. Check that your notebook is properly saved and there are no unsaved changes. If there are unsaved changes, try saving the notebook and then converting it again.
4. Check the output of the conversion process for any error messages or warnings. These can help you identify the source of the problem.
5. Try converting the notebook to HTML using a different method. For example, you could download the notebook file to your local machine and then use a local installation of Jupyter Notebook to convert it to HTML.

Cython link.exe' failed with exit status 1104 when updating .pyx file

I have created a .pxy file with functions in it and it runs with no problem, I can import it from .py and all with no trouble, however, when I modify it and try to compile it again with the setup.py way, it appears the error in the title. I have tried copying the rc.exe and rcdll.dll files from the Windows Kits to Microsoft Visual and it doesnt work.
Do you have an idea of what is happening?
I have also tried the "import pyximport; pyximport.install()" but it doesnt update the imported .pxy
This is the error:
LINK : fatal error LNK1104: cannot open file 'C:\direction\test_cython.cp37-win_amd64.pyd'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\link.exe' failed with exit status 1104
Thank you!
EDIT
I realize the setup.py thing works when I close spyder, however, i still wonder if there is a way to update the pyd (ie the import file) without having to restart spyder

Configure SonarQube (Node.JS) to download binaries from an internal server

What we are trying to do is to get SonarQube to analyze our Typescript (Node.JS) project on a Docker image, but we are running into an error. If it helps, we are trying to use the sonarqube-scanner module from Node.JS.
The error is as encountered below:
[17:57:23] Starting analysis...
[17:57:24] Getting info from "package.json" file
[17:57:24] Checking if executable exists: /root/.sonar/native-sonar-scanner/sonar-scanner-4.5.0.2216-linux/bin/sonar-scanner
[17:57:24] Could not find executable in "/root/.sonar/native-sonar-scanner".
[17:57:24] Proceed with download of the platform binaries for SonarScanner...
[17:57:24] Creating /root/.sonar/native-sonar-scanner
[17:57:24] Downloading from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.5.0.2216-linux.zip
[17:57:24] (executable will be saved in cache folder: /root/.sonar/native-sonar-scanner)
[91m[18:03:53] [0m[91mERROR: impossible to download and extract binary: connect ETIMEDOUT 91.134.125.245:443
[0m[91m[18:03:53] [0m[91m SonarScanner binaries probably don't exist for your OS (linux).
[0m[91m[18:03:53] In such situation, the best solution is to install the standard SonarScanner (requires a JVM).
[0m[91m[18:03:53] Check it out at https://redirect.sonarsource.com/doc/install-configure-scanner.html
Now if you notice from the error, the binaries server encounters an ETIMEDOUT error, and this is because the server that accesses it comes from an internal network that cannot access external sites.
Would it be possible to configure SonarQube to pull from an internal server? And if so how would we go about configurating this?
Many thanks in advance!
I was able to find documentation through the SonarQube Javascript module here (https://www.npmjs.com/package/sonarqube-scanner)
By default, the scanner binaries are downloaded from https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/. To use a custom mirror, set $SONAR_SCANNER_MIRROR. Or download precise version with $SONAR_SCANNER_VERSION
Example:
export SONAR_SCANNER_MIRROR=https://npm.taobao.org/mirrors/sonar-scanner/
export SONAR_SCANNER_VERSION=3.2.0.1227

Can't create pdf using python PDFKIT Error : “ OSError: No wkhtmltopdf executable found: "b''": ”

I'm trying to get a PDF file from my HTML template using pdfkit library and wkhtmltopdf but I get an error and I don't find any solutions on Stackoverflow.
my code sample is along the lines of
ren = render_template('demo.html',name=name,loc=loc)
pdf = pdfkit.from_string(ren,False)
the error :
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
I have already installed wkhtmltopdf and changed directories
The solution that worked for me for pdfkit is -
first verify if wkhtmltopdf binary exists, by running
ls /usr/bin/wkhtmltopdf
if doesn't exist, create it using
touch /usr/bin/wkhtmltopdf
then after that run the below command which downloads and install wkhtmltopdf
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz && tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz && cp wkhtmltox/bin/wk* /usr/bin/
suit your version for download

APE Install Missing File

After installing from the RPM and then trying the Binary versions of APE (AJAX Push Engine) I am getting this error (on both versions) when I try to run the APE server:
[Module] Failed to load ../modules/libmod_spidermonkey.so [Invalid library] (libmysqlclient_r.so.15: cannot open shared object file: No such file or directory)
I am using Fedora Linux, with MySql and apache installed. How can I get this libmysqlclient file? I have found this RPM: http://rpm.pbone.net/index.php3/stat/4/idpl/12471829/dir/fedora_4/com/mysqlclient15-5.0.67-1.fc4.remi.i386.rpm.html
And it says it includes this file, so I downloaded it to the box, attempted to install and tells me that it's already installed.
Any advice would help thanks!
Inside the ape.conf there's a module working directory which must be altered.