Jupyter Notebook print to PDF prints unexpected text - html

I have been having issue downloading a Jupyter Notebook to PDF. My original error was
Solving "500: Internal Server Error, nbconvert failed: xelatex not found in PATH".
For this I ran from Anaconda Prompt:
conda install -c conda-forge miktex
To solve this I ran from Python Command Prompt:
jupyter nbconvert --to pdf C:\Users\myProfile\myFile.ipynb
I then got an error about Pandoc missing and so to solve this I ran from Anaconda Prompt:
conda install -c conda-forge pandoc
I'm now able to create a pdf but it has one page of gibberish and the actual text is not formatted.
The following in a markdown cell:
<h1>Test Presentation</h1>
<h2>Today's Date</h2>
<h3>Author</h3>
produces:
I also have MikTex and Pandoc installed on my computer and have added their paths to my System Properties Environment Variables. I get no error messages but this gibberish of a PDF.

try the following steps:
from your command prompt install notebook-as-pdf (here are snyk and deps scurity analysis*)
pip install -U notebook-as-pdf
you also need an additional setup for chromium (performs HTML to PDF conversion - snyk, deps)
pyppeteer-install
open the notebook you wish to convernt, click on file -> Download As -> PDF via HTML,
if you prefer you can run it from your command prompt:
jupyter-nbconvert --to PDFviaHTML example.ipynb
note that it has a mid-low score because the last commit was on april, on the other hand it has no dependencies so from that angle you are good

Related

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

html extra works in cli, but not in Jenkins

when running this in cli, it generates the report. but when I use the same command in Jenkins, no report is generated.
newman run "C:\WORK\getMix-REST.postman_collection.json" --reporters htmlextra --reporter-htmlextra-export "C:\Jenkins\workspace\getMix_report.html"
This is the message shown in Jenkins.
newman: could not find "htmlextra" reporter
ensure that the reporter is installed in the same directory as newman
please install reporter using npm
I have verified that newman and html extra are installed in the correct directories
newman installation:
I'm stuck. please help. Thanks
**Update: when I use just newman-reporter-html instead of newman-reporter-htmlextra, it works fine and report is generated. both reporters are installed on the same level, not sure why html extra doesn't work??
The solution was as follows:
1.- Look for the folder: C: \ Program Files (x86) \ Jenkins \ tools \ jenkins.plugins.nodejs.tools.NodeJSInstallation \ Node3 \ node_modules
** Node3 may vary the name you assigned in Jenkins.
2.- Copy and paste newman and newman-reporter-htmlextra on the folder and try again.

Koala with "sass-json-vars": CLI works, but GUI gets "Cannot load such file sass-json-vars"

I have C:\Program Files (x86)\Koala\ruby\lib\ruby\bin added to the PATH environment variable.
When I install this gem with gem install sass-json-vars, it's installed to C:\Program Files (x86)\Koala\ruby\lib\ruby\gems\2.0.0\gems
When I run the command sass core.scss core.css -r sass-json-vars --trace, it works fine.
But if I open koala-config.json in my project-root and add "customOptions": ["-r sass-json-vars"],, each attempt by the GUI, or the GUI's 'watcher', to compile gives me the error "Cannot load such file -- sass-json-vars".
If I remove the command, and the attempt to import json, the GUI works fine.
The solution was running the following command:
gem install -i "C:\Program Files (x86)\Koala\rubygems" sass-json-vars, or similar syntax for any other gem if anyone should encounter this problem.

Using Tcl with Jupyter notebook

I downloaded Anaconda, and have been using Jupyter notebook. Now I would like to use it with Tcl. I followed the instructions at https://github.com/rpep/tcl_kernel, (which is to pip3 install tcl_kernel).
It has installed in AppData\Local\Programs\Python\Python36-32.
However, Tcl does not appear as an option for a new notebook.
Can anyone advise?
Thankyou.
Installing Tcl on Jupyter Notebook: intel offers a package to be used on Jupyter Notebook, where you can develop your projects and view the result of the codes.
To perform the installation (linux), type the following command in the terminal:
conda install -c intel tcl
pip3 install tcl_kernel
python3 -m tcl_kernel.install
conda update conda
Link of the pages so that you can search for the equivalent packages on Win / Mac:
https://anaconda.org/intel/tcl
https://github.com/rpep/tcl_kernel
Ready! When accessing Jupyter Notebook, select the Tcl option in the 'New' section.
There are versions for various Operating Systems. I chose Linux because it is the only one on computers here at home.
I don't see that kernel listed under 'new' -- but if I open another notebook and try the 'kernel' menu, there is a 'change kernel' item that does the job.

How to installing Pygame for Python 3.5 via pip?

I'm trying to install Pygame for python 3.5 32bit. I have learned that I can open the .whl files provided on the site by using the pip command. The problem is I've tried multiple ways doing this but with constant error.
python -m pip install pygame-1.9.2a0-cp35-none-win32.whl
'python' is not recognized as an internal or external command,
operable program or batch file.
The file I'm trying to install: pygame-1.9.2a0-cp35-none-win32.whl
My python program is located in my programs folder and everything else works fine.
You need to add python.exe to your Windows PATH variable.
The is the system variable that the operating system uses to locate the needed executables from the command line or Terminal windows. [1]
Actually there are many methods to set the PATH variable on windows. One way is to type
set PATH=%PATH%;location path of Python.exe
into the windows command-line interpreter (cmd):
set PATH=%PATH%;C:\Python35-32
Now -- before running the pip command -- you need to make sure that either
your working directory is set to the same folder where your pygame-1. ... in32.whl file is located
or
you supply the full absolute or relative path to the pip command.
Now you should be able to run your python -m pip command after restarting the cmd.exe.
if you get trouble when install pygame error about missing visual studio 10+. I have the answer: the problem is not about have or not have visual studio, because I try many version but it not work. The problem is file: between tar.gz and .whl so, this is the solution:
1) download file:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame go here and download your pygame version, notice about x64 or x86 and python version. my system is x64 and python is 3.4 so I choose: pygame-1.9.2a0-cp34-none-win_amd64.whl
2) put it in some where to install:
I put it in "C:", so open cmd: and type: cd C:\ (this changes the location to C:)
3) install
pip install C:\pygame-1.9.2a0-cp34-none-win_amd64.whl
done !