Closed choies1 closed 3 years ago
What's your python version?
Can you run knitpy with the debug flags and post the output (will be long...) somewhere (dropbox, pastebin)?
knitpy --debug --output-debug=True --kernel-debug=True --to="html " -- ./knitpy_overview1.pymd > debug.log
I use python 3.4.3, IPython 3.2.0, Knitpy 0.1.1.
I made simple pymd file as follows for testing.
//////////////////////////////////////////////////////////////////////////////////////////
'''{python sinus, echo=False} import matplotlib.pyplot as plt line, = plt.plot([1, 2, 3], [1, 2, 3]) ''' (Actually, I used `x3) //////////////////////////////////////////////////////////////////////////////////////////
The HTML result is as follows:
The debug output is as follows:
[KnitpyApp] Config changed:
[KnitpyApp] {'KnitpyApp': {'log_level': 10, 'export_format': 'html'}, 'Knitpy':
{'kernel_debug': True}, 'TemporaryOutputDocument': {'output_debug': True}}
[KnitpyApp] IPYTHONDIR set to: C:\Users\choies\.ipython
[KnitpyApp] Using existing profile dir: 'C:\\Users\\choies\\.ipython\\profile_de
fault'
[KnitpyApp] Searching path ['C:\\Users\\choies\\Downloads\\knitpy-master\\knitpy
-master\\examples', 'C:\\Users\\choies\\.ipython\\profile_default', 'C:\\Program
Data\\ipython'] for config files
[KnitpyApp] Attempting to load config file: ipython_config.py
[KnitpyApp] Attempting to load config file: knitpy_config.py
[KnitpyApp] Converting ./knitpy_overview2.pymd...
[KnitpyApp] Changing to working dir: .
[KnitpyApp] Converting document knitpy_overview2.pymd to html_document
[KnitpyApp] Adding 'text': ['### IPython / Jupyter display framework\n']
[KnitpyApp] Flushing caches in output.
[KnitpyApp] Adding 'text': ['\n']
[KnitpyApp] Starting a new kernel: python
[KnitpyApp] Connecting to: tcp://127.0.0.1:8333
[KnitpyApp] connecting shell channel to tcp://127.0.0.1:8330
[KnitpyApp] Connecting to: tcp://127.0.0.1:8330
[KnitpyApp] connecting iopub channel to tcp://127.0.0.1:8331
[KnitpyApp] Connecting to: tcp://127.0.0.1:8331
[KnitpyApp] connecting stdin channel to tcp://127.0.0.1:8332
[KnitpyApp] Connecting to: tcp://127.0.0.1:8332
[KnitpyApp] connecting heartbeat channel to tcp://127.0.0.1:8334
[KnitpyApp] Executed silent code: # Bad things happen if tracebacks have ansi es
cape sequences
%colors NoColor
[KnitpyApp] Silent code shell reply: {'msg_type': 'execute_reply', 'content': {'
user_expressions': {}, 'status': 'ok', 'payload': [], 'execution_count': 0}, 'ms
g_id': '87d44523-f3d2-4622-a272-f6b619e5590f', 'buffers': [], 'header': {'userna
me': 'username', 'msg_type': 'execute_reply', 'msg_id': '87d44523-f3d2-4622-a272
-f6b619e5590f', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 199436), 'sess
ion': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header'
: {'username': 'username', 'msg_type': 'execute_request', 'msg_id': '090eae4b-15
0d-4fb3-8b63-da865f7ab45b', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 19
4435), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'me
tadata': {'started': '2015-07-11T00:42:27.196435', 'status': 'ok', 'engine': 'e0
10434e-e351-4bd7-8e63-1c31163b3a38', 'dependencies_met': True}}
[KnitpyApp] Silent code iopub msg: {'msg_type': 'status', 'content': {'execution
_state': 'busy'}, 'msg_id': 'e9628fdf-363b-477c-a0e1-0ce7dbb27dfb', 'buffers': [
], 'header': {'username': 'username', 'msg_type': 'status', 'msg_id': 'e9628fdf-
363b-477c-a0e1-0ce7dbb27dfb', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27,
195435), 'session': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, '
parent_header': {'username': 'username', 'msg_type': 'execute_request', 'msg_id'
: '090eae4b-150d-4fb3-8b63-da865f7ab45b', 'date': datetime.datetime(2015, 7, 11,
0, 42, 27, 194435), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version
': '5.0'}, 'metadata': {}}
[KnitpyApp] Silent code iopub msg: {'msg_type': 'status', 'content': {'execution
_state': 'idle'}, 'msg_id': '44a1beb1-c8d1-45a8-b2d3-ea91da63ca33', 'buffers': [
], 'header': {'username': 'username', 'msg_type': 'status', 'msg_id': '44a1beb1-
c8d1-45a8-b2d3-ea91da63ca33', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27,
200436), 'session': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, '
parent_header': {'username': 'username', 'msg_type': 'execute_request', 'msg_id'
: '090eae4b-150d-4fb3-8b63-da865f7ab45b', 'date': datetime.datetime(2015, 7, 11,
0, 42, 27, 194435), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version
': '5.0'}, 'metadata': {}}
[KnitpyApp] Executed kernel startup lines for engine 'python'.
[KnitpyApp] Executed silent code: %matplotlib inline
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png')
[KnitpyApp] Silent code shell reply: {'msg_type': 'execute_reply', 'content': {'
user_expressions': {}, 'status': 'ok', 'payload': [], 'execution_count': 0}, 'ms
g_id': '559e1fce-63eb-4607-b089-7881f97055d9', 'buffers': [], 'header': {'userna
me': 'username', 'msg_type': 'execute_reply', 'msg_id': '559e1fce-63eb-4607-b089
-7881f97055d9', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 799470), 'sess
ion': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header'
: {'username': 'username', 'msg_type': 'execute_request', 'msg_id': 'b0d41990-f8
6c-4acd-bf73-44d7adfad83c', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 31
4442), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'me
tadata': {'started': '2015-07-11T00:42:27.317442', 'status': 'ok', 'engine': 'e0
10434e-e351-4bd7-8e63-1c31163b3a38', 'dependencies_met': True}}
[KnitpyApp] Silent code iopub msg: {'msg_type': 'status', 'content': {'execution
_state': 'busy'}, 'msg_id': '34333bd9-e0cc-4b3b-90dd-fccead25c142', 'buffers': [
], 'header': {'username': 'username', 'msg_type': 'status', 'msg_id': '34333bd9-
e0cc-4b3b-90dd-fccead25c142', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27,
317442), 'session': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, '
parent_header': {'username': 'username', 'msg_type': 'execute_request', 'msg_id'
: 'b0d41990-f86c-4acd-bf73-44d7adfad83c', 'date': datetime.datetime(2015, 7, 11,
0, 42, 27, 314442), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version
': '5.0'}, 'metadata': {}}
[KnitpyApp] Silent code iopub msg: {'msg_type': 'status', 'content': {'execution
_state': 'idle'}, 'msg_id': '3dca00ed-8397-4d1c-ac52-0731d15ed1ca', 'buffers': [
], 'header': {'username': 'username', 'msg_type': 'status', 'msg_id': '3dca00ed-
8397-4d1c-ac52-0731d15ed1ca', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27,
800470), 'session': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, '
parent_header': {'username': 'username', 'msg_type': 'execute_request', 'msg_id'
: 'b0d41990-f86c-4acd-bf73-44d7adfad83c', 'date': datetime.datetime(2015, 7, 11,
0, 42, 27, 314442), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version
': '5.0'}, 'metadata': {}}
[KnitpyApp] Enabled image formats '['png', 'svg']' in engine 'python'.
[KnitpyApp] completion_request: 95439f64-a857-48fc-87b4-edbb036430bc
[KnitpyApp] completion_request: d2719507-3b9d-4daa-ad06-1c330f79536b
[KnitpyApp] Executing lines (msg_id=1cd5198b-1b0f-4533-b443-5478c811ede8):
import matplotlib.pyplot as plt
[KnitpyApp] shell msg: {'msg_type': 'execute_reply', 'content': {'user_expressio
ns': {}, 'status': 'ok', 'payload': [], 'execution_count': 1}, 'msg_id': 'a3099f
95-6f0d-4323-8057-d84bac06d52f', 'buffers': [], 'header': {'username': 'username
', 'msg_type': 'execute_reply', 'msg_id': 'a3099f95-6f0d-4323-8057-d84bac06d52f'
, 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 918477), 'session': 'a0fb42c
f-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header': {'username':
'username', 'msg_type': 'execute_request', 'msg_id': '1cd5198b-1b0f-4533-b443-5
478c811ede8', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 914476), 'sessio
n': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'metadata': {'sta
rted': '2015-07-11T00:42:27.915476', 'status': 'ok', 'engine': 'e010434e-e351-4b
d7-8e63-1c31163b3a38', 'dependencies_met': True}}
[KnitpyApp] iopub msg (execute_input): {'msg_type': 'execute_input', 'content':
{'execution_count': 1, 'code': 'import matplotlib.pyplot as plt\n'}, 'msg_id': '
6347ad78-1c8f-4b62-937b-f7ff7ee9a8a4', 'buffers': [], 'header': {'username': 'us
ername', 'msg_type': 'execute_input', 'msg_id': '6347ad78-1c8f-4b62-937b-f7ff7ee
9a8a4', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 915476), 'session': 'a
0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header': {'user
name': 'username', 'msg_type': 'execute_request', 'msg_id': '1cd5198b-1b0f-4533-
b443-5478c811ede8', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 914476), '
session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'metadata':
{}}
[KnitpyApp] completion_request: c74350c8-5fdf-4d3c-b950-6008b5058f69
[KnitpyApp] Executing lines (msg_id=4f54d0da-40ad-404c-829d-444660f3e658):
line, = plt.plot([1, 2, 3], [1, 2, 3])
[KnitpyApp] shell msg: {'msg_type': 'execute_reply', 'content': {'user_expressio
ns': {}, 'status': 'ok', 'payload': [], 'execution_count': 2}, 'msg_id': 'c99567
2c-dbf6-4288-b0d4-85cb502e83c5', 'buffers': [], 'header': {'username': 'username
', 'msg_type': 'execute_reply', 'msg_id': 'c995672c-dbf6-4288-b0d4-85cb502e83c5'
, 'date': datetime.datetime(2015, 7, 11, 0, 42, 28, 94487), 'session': 'a0fb42cf
-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header': {'username':
'username', 'msg_type': 'execute_request', 'msg_id': '4f54d0da-40ad-404c-829d-44
4660f3e658', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 930477), 'session
': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'metadata': {'star
ted': '2015-07-11T00:42:27.931477', 'status': 'ok', 'engine': 'e010434e-e351-4bd
7-8e63-1c31163b3a38', 'dependencies_met': True}}
[KnitpyApp] iopub msg (execute_input): {'msg_type': 'execute_input', 'content':
{'execution_count': 2, 'code': 'line, = plt.plot([1, 2, 3], [1, 2, 3])\n'}, 'msg
_id': '86579a6e-7bb5-4c3c-995d-bee9931cf19e', 'buffers': [], 'header': {'usernam
e': 'username', 'msg_type': 'execute_input', 'msg_id': '86579a6e-7bb5-4c3c-995d-
bee9931cf19e', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 931477), 'sessi
on': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'version': '5.0'}, 'parent_header':
{'username': 'username', 'msg_type': 'execute_request', 'msg_id': '4f54d0da-40a
d-404c-829d-444660f3e658', 'date': datetime.datetime(2015, 7, 11, 0, 42, 27, 930
477), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84df', 'version': '5.0'}, 'met
adata': {}}
[KnitpyApp] iopub msg (display_data): {'msg_type': 'display_data', 'content': {'
metadata': {}, 'data': {'image/png': 'iVBORw0KGgoAAAANSUhEUgAAAXYAAAEACAYAAACnJV
25AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADvFJREFUeJzt3U+IHOedxvHn
UayQWQwrFoMcWxI+2IZdSLA2wVbs7Lr3\nEFhrQSdDDBnM+rLBxLEJ+GQEErrkkIvxHhwdbEmbhfigCU
ZJZJYQ1CE5RId4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SR+NLurzTAwAMJ8yb3f8oaSHJd1m+5KkI5J2SlJEHI+Is7YP2n5X0ieSnqhzwgCA6UptxQAA
\nuqPST57aftn2ZdtvThnzgu13bF+wvb/K109J0bm0PbB91fZ6dju87Dl2ie29ts/Zftv2W7afnjCO\n
67OEMueTa7Qc25+zfd72hu1N29+dMK78tRkRld0k/ZOk/ZLenPD4QUlns+MHJP26ytdP6VbiXA4k\nnW
l6nl25Sbpd0n3Z8a2Sfifp70fGcH1Wez65Rsufz7/J/nuLpF9L+urI4zNdm5UWe1T4Yaa+K3Eu\npZvf
ZooJIuKDiNjIjj+WdFHSHSPDuD5LKnk+Ja7RUiJiKzv8rKTPSLoyMmSma3PZXwJW+sNMKBSS\nHsz+Wn
bW9j80PaGuyN6+u1/S+ZGHuD7nMOV8co2WZHuH7Q1JlyWdi4jNkSEzXZtNfG1vqQ8zodDr\nkvZGxJbt
RyS9KunehufUerZvlXRa0jNZad40ZOQ+1+cUBeeTa7SkiPirpPts/62k/7E9iIjhyLDS\n1+ayi/19SX
tz9/dkP8OMIuJP1/76FhGvSdpp++8anlar2d4paU3Sf0fEq2OGcH3OoOh8co3OLiKu\nSvqppC+PPDTT
tbnshf2MpMcladqHmVDM9m7bzo7v1/ZbV0f35ZDJztVLkjYj4vkJw7g+SypzPrlG\ny7F9m+1d2fGKpK
9JGv3q85muzUq3YvgwU3WKzqWkRyU9aftTbX8P/mNNzbUjHpK0KukN29d+0zwn\naZ/E9TmHwvMprtGy
Pi/plO0d2o7tH0TEz21/U5rv2uQDSgCQmMb/13gAgGqxsANAYljYASAxLOwA\nkBgWdgBIDAs7ACSGhR
0AEsPCDgCJ+T/wqUs1NuhuIQAAAABJRU5ErkJggg==\n', 'text/plain': '<matplotlib.figure
.Figure at 0x637eef0>'}}, 'msg_id': '1fd43a3c-6809-45e8-8397-d0a97c5cd632', 'buf
fers': [], 'header': {'username': 'username', 'msg_type': 'display_data', 'msg_i
d': '1fd43a3c-6809-45e8-8397-d0a97c5cd632', 'date': datetime.datetime(2015, 7, 1
1, 0, 42, 28, 92487), 'session': 'a0fb42cf-7dc1-4878-b1d8-303dd8546665', 'versio
n': '5.0'}, 'parent_header': {'username': 'username', 'msg_type': 'execute_reque
st', 'msg_id': '4f54d0da-40ad-404c-829d-444660f3e658', 'date': datetime.datetime
(2015, 7, 11, 0, 42, 27, 930477), 'session': '81d31dbf-4984-4088-aa9f-c591af7c84
df', 'version': '5.0'}, 'metadata': {}}
[KnitpyApp] Trying to include image...
[KnitpyApp] ERROR | Could not save a image
Traceback (most recent call last):
File "C:\Anaconda3\lib\base64.py", line 519, in _input_type_check
m = memoryview(s)
TypeError: memoryview: str object does not have the buffer interface
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\knitpy\documents.py", line 259, in add_im
age
mimedata = base64.decodestring(mimedata)
File "C:\Anaconda3\lib\base64.py", line 561, in decodestring
return decodebytes(s)
File "C:\Anaconda3\lib\base64.py", line 553, in decodebytes
_input_type_check(s)
File "C:\Anaconda3\lib\base64.py", line 522, in _input_type_check
raise TypeError(msg) from err
TypeError: expected bytes-like object, not str
[KnitpyApp] Couldn't include image: expected bytes-like object, not str
[KnitpyApp] No image found: image/jpeg
[KnitpyApp] No image found: image/svg+xml
[KnitpyApp] Adding 'output': ['<matplotlib.figure.Figure at 0x637eef0>']
[KnitpyApp] Flushing caches in output.
[KnitpyApp] Adding 'output': ['\n']
[KnitpyApp] completion_request: 8c577383-c27f-4536-9dc3-a05207ad0119
[KnitpyApp] Adding 'text': ['']
[KnitpyApp] Flushing caches in output.
[KnitpyApp] Kernel shutdown: 9aeab561-4d79-4c35-a41a-b7b3ea0db81d
[KnitpyApp] Flushing caches in output.
[KnitpyApp] Written final output: knitpy_overview2.html
huih, I really should add unittests for these classes... The problem is that it seems that the kernelClient returns the message data as a string and not as bytes and the base64 function expects bytes, despite the name... py2 has no problem with it, but py3....
Can you try to replace the following line in C:\Anaconda3\lib\site-packages\knitpy\documents.py", line 259:
- mimedata = base64.decodestring(mimedata)
+ mimedata = base64.decodebytes(mimedata.encode())
and see if that works?
I won't be able to work on this problem until next weekend :-(
Thanks a lot.
It works well after I changed the code in "C:\Anaconda3\lib\site-packages\knitpy\documents.py", line 259:
- mimedata = base64.decodestring(mimedata)
+ mimedata = base64.decodestring(mimedata.encode())
or
+ mimedata = base64.decodebytes(mimedata.encode())
'base64.decodestring(mimedata.encode())' or 'base64.decodebytes(mimedata.encode())' works well for Python3, when I convert pymd file to HTML or docx file
However, it doesn't work for PDF file converting.
Not sure what's happening here: AFAIK pdf / latex can handle PNG just fine. On the other hand, knitpy should also get a pdf version of the plot (at least in latest git -> see knitpy/engines.py) from the kernel but in your case only png is asked for:
KnitpyApp] Executed kernel startup lines for engine 'python'.
[KnitpyApp] Executed silent code: %matplotlib inline
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png')
Can you insert somewhere in your code (as a code chunk!) before the plot
from IPython.display import set_matplotlib_formats
set_matplotlib_formats(['png', 'pdf', 'svg'])
This should get you the plot in the pdf file...
@choies1 can you give me the comandline and the debuglog for the pdf generation?
Thank you for your feedback.
In my test, I added '%matplotlib inline' in chuck code as follows.
# As this all produces no output, it should go into the same input section...
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
y = np.linspace(2, 10)
line, = plt.plot(y, np.sin(y))
I think it (%matplotlib inline) made some troubles.
This is no error message as follows:
command line ==> knitpy --to='pdf' -- ./knitpy_overview1.pymd
[KnitpyApp] Converting ./knitpy_overview1.pymd...
[KnitpyApp] Changing to working dir: .
[KnitpyApp] Converting document knitpy_overview1.pymd to pdf_document
[KnitpyApp] Starting a new kernel: python
[KnitpyApp] Executed kernel startup lines for engine 'python'.
[KnitpyApp] Enabled image formats '['pdf']' in engine 'python'.
[KnitpyApp] Kernel shutdown: b70854be-e1da-4e67-8293-f2dac29cfaef
[KnitpyApp] Written final output: knitpy_overview1.pdf
However, I can't see the plot in pdf file. (docx and html files are OK)
After I remove '%matplotlib inline' in chuck code as follows:
# As this all produces no output, it should go into the same input section...
import numpy as np
import matplotlib.pyplot as plt
y = np.linspace(2, 10)
line, = plt.plot(y, np.sin(y))
The pdf file result is as follows:
Yep, it seems that %matplotlib inline
resets the plotting formas back to png :-( Not sure what knitpy can do about that, maybe look for such lines and warn... I added https://github.com/ipython/ipykernel/issues/29, lets see what the jupyter gods say...
Ok, the problem with calling %matplotlib inline
twice is fixed on the ipython side... I don'T think I want to introduce some special code too look for this...
Todo
When I run following code;
knitpy --to="html " ./knitpy_overview1.pymd
(knitpy_overview1.pymd is clone of knitpy_overview.pymd)
The result is as follows:
'knitpy_overview.html' show as follows. I cannot see '<matplotlib.figure.Figure at 0x6175b90>' message instead of the plot.
If I run the python code of pymd file on IPython (3.2.0). I can see the plot.
Please let me know what should I do.