-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export as pdf masks errors when it fails #710
Comments
Hi @djbhalodiya, thanks for the bug report! Just to be sure I understand, did the extension report a successful export attempt even though the exported PDF was empty? What did the notebook that you were exporting look like? |
Even with the most simple of notebooks, e.g. helloworld, I'm also getting what looks like a successful PDF export but file size is 0 bytes. Stable VSCode 1.48, latest Python extension, Windows 10 and Tex is installed. |
Hi all, I'm getting the same problem. I am trying to export my *.ipynb (Jupyter Notebook) but the PDF exported with 0(zero) file size. There is no export errors from VSCode, it looks like it's exporting successfully. Also VSCode 1.48, Microsoft Python Extension v2020.8.101144, Windows 10 Pro v19041.450. |
Same issue. Exporting a *.ipynb to a PDF results in a 0 byte file that cannot be opened. No errors from VSCode. VSCode 1.48, Microsoft Python Extension v2020.8.101144, Windows 10 |
Same issue faced for both html and PDF export. Both output is 0 byte file. VSCode 1.48.2, Microsoft Python Extension v2020.8.103604, Windows 10 |
Experiencing the same problem: PDF export of notebook appears successful but the result is a 0 byte file that will not open. VSCode 1.48.2, Microsoft Python Extension v2020.8.105045, Mac OS Catalina |
Can somebody try this on the failing notebook? It should show why the PDF export is failing.
It looks like we only assume a failure (and show stderr) when the pdf is not created. If it's created with zero length we're likely masking the error. |
Here's the output from [NbConvertApp] Writing 20848 bytes to .\notebook.tex |
Sorry for the trouble here. While we can't fix this issue as it's not in our codebase, we'll investigate providing more discoverable error information in an upcoming release. As a workaround, please consider exporting to html, then via Chrome or Edge (or probably other browsers) you can print the page to PDF. |
I ran the code in terminal and it works, the output of jupyter nbconvert pdf works as expected, like running the code in my cmd.
The problem here is the export function. It still outputs 0kb file. edit: Also, VSC does not prompt for the user to install TeX, causing the error the other user faced above. |
I have same issue here. Even though HTML format works well, the pdf format failed |
It happens because to convert a jupyter notebook to pdf it needs pandadoc and latex installed in the system, so vs code should notify about the required dependencies. |
I do have both installed. Like i mentioned, VSCode DOES NOT notify when they arent installed. And the error of output to 0kb still occurs when using the export to function. When using nbconvert directly in terminal, it works as expected. |
Note: We're not going to search for PDF dependencies. The fix here will simply be to list out the error when we get a zero byte PDF file. |
Same here. Neither conversion to Python Script, HTML or PDF works. exporting to Python Script produces no code, and exporting to HTML and PDF returns empty files. The command |
If this command is working:
Then I would guess you're not using the same environment we're using. Your best bet to reproduce the problem with the command line is to:
Under the covers, our 'Export to pdf' is running that exact command. |
Even when i do that, it still works.
The plotly figures are gone, but i suspect that's something that requires a more sophisticated converter. |
If you install this build: https://github.com/microsoft/vscode-python/suites/1180411345/artifacts/17273285 it should at least show you the error we're getting. |
I don't know how to install this and if installing this will screw up even more or change my configurations. |
That's a vsix file. You can install it through the extensions tab by clicking on the three dots and picking 'Install from VSIX'. It's how VS code packages extensions. It's an internal build so it could be buggy with other things but it won't change any config settings. Once you're done trying it, you can uninstall it and reinstall the general release of the python extension again through the extensions tab. |
Okay. Exporting as Python Script gives no error and the output is empty. Exporting to HTML or PDF now gives an error
(yes, it writes export failed twice) and i can see something in the python console. Which is a lot of stuff, but essentially boils down to: It looks like it is using the wrong environment.
|
It sounds like an environment issue if it works with the terminal. Does the terminal use that .venv too? |
It's definitely the wrong environment. The terminal uses a different environment. |
Ah okay. Looks like there's a bug with picking the interpreter to use. It's this code here: protected async getExecutionService(source: Uri): Promise<IPythonExecutionService | undefined> {
const interpreter = await this.jupyterService.getSelectedInterpreter(); <-- This should be something different.
if (!interpreter) {
return;
}
return this.pythonExecutionFactory.createActivatedEnvironment({
resource: source,
interpreter,
allowEnvironmentFetchExceptions: false,
bypassCondaExecution: true
});
} Thanks for trying that out. We should be able to fix this for more people now. |
If it works with the terminal (like it does for @JanHomann ) you might be able to work around this by running 'Python : Select interpreter to start Jupyter' and picking the python interpreter you're using for your notebook. That line of code I marked as incorrect is using the 'jupyter interpreter' when it should be using the matching interpreter. |
I can confirm that when i pick that particular environment then
gives exactly the same Traceback. |
That fixed it! |
The above solved my issues, im able to output to pdf now. But the normal python extension will still masks certain errors, like having images in the notebook and export to a 0kb PDF file. Expected:
Also apparently you have the above error message
I assume this is your prompt to install TeX according to the documentation? |
Also, it seems that when using the export to pdf function in VSCode, it uses the temporary path of the file, which causes issues if there is markdown which contains images/paths like
Below is the path file used when running in terminal directly and outputs the pdf with images fine.
|
Anyone got this to work? |
I'm facing the same problem |
@WenukaB your jupyter output tab should show you what the failure is. Generally for export to PDF you have to install extra software. See this: |
Issue Type: Bug
PDF exported but with 0(zero) file size
Extension version: 2020.7.96456
VS Code version: Code - Insiders 1.48.0-insider (15ada625f20086007e2c4aa0d760234360cd648f, 2020-07-30T14:43:12.691Z)
OS version: Windows_NT x64 10.0.19041
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: