Comments (23)
Interesting. Feels like we're getting closer!
The kitty graphics protocol allows you to do more complex things with images then sixel graphics, such as hide & show, duplicate, and move images. Currently I'm not making full use of it's capabilities - I'm just clearing all images from a notebook and re-drawing them every time the display is drawn.
I'm already aware of some issues with with the way I implemented this (one is that images are cleared per notebook, which means that if you have multiple notebooks, only the images from one notebook will be displayed). I suspect the problem you are having may be related.
Rewriting the euporie's kitty graphics code so images are shown, hidden, and moved without re-drawing them is on my to-do list.
from euporie.
The "colinear!" text you are seeing is OS-level standard error output from the kernel (reportlab
prints directly to stderr
in it's c-extensions - see here).
The same thing happens with JupyterLab - output is printed to the terminal where the kernel was started rather than being displayed in the notebook:
There is an old IPython issue about this I remember from years ago: ipython/ipython#1230
The issue mentions a nice IPython extension wurlitzer
you can use to work around this:
from euporie.
For what it's worth: just tried to run using a direct install from master (0.1.11
), didn't work either
from euporie.
This doesn't seem to be matplotlib related, the following causes the same error (works well in ipython)
from prompt_toolkit import print_formatted_text, HTML
print_formatted_text(HTML('<b>This is bold</b>'))
from euporie.
Hi,
I'm a bit surprised you were still experiencing this with 0.1.11
, as after 76d7831 TextArea
is no longer used to display any outputs. Do you mind checking again you were actually using 0.1.11
or newer?
I've been working on fixing the display of ansi output containing carriage returns (which includes print_formatted_text
output). A tentative fix for this is in 1d4884e.
The two code snippets you posted look currently give the following output with master
in kitty terminal:
from euporie.
Yeah I mean I showed you the pip install output directly copy pasted so unless something with poetry is wonky it should've been 0.1.11.
I just tried to reinstall it (I have no experience with poetry, just doing poetry install
), however I'm running into this:
I tried uninstalling poetry, and deleting the git project and reinstalling everything twice but to no avail so unfortunately I can help debug because I can't install euporie anymore and pip is still at 0.1.9.
from euporie.
Forgive me if I'm telling you what you already know.
It appears you might still have 0.1.9
installed on your main python distribution. To upgrade euporie to the latest version, you can run:
pip install --upgrade euporie
This should update euporie
to 0.1.11
or later.
If you want to run euporie from master, you'll need to run something like:
git clone https://github.com/joouha/euporie.git
cd euporie
poetry install
poetry run euporie
Running poetry install
from the cloned repo makes poetry install euporie
as a development install (along with its dependencies) into a virtual environment, which is isolated from your system python installation. Running euporie
without activating the virtual environment first will still run the version installed installed on your system distribution with pip.
You can run euporie
from this virtual environment using poetry run euporie
, or you can launch a shell with the virtual environment activated using poetry shell
, and run euporie from there.
from euporie.
thanks a ton for the help with debugging here! We're making progress:
so installing the new 0.1.11 from pip got rid of the error messages (I did however make sure that there is no 0.1.9 pip install in any of my envs before, however at time of my previous writing pip installs still installed 0.1.9 even for fresh installs, so now it's pulling correctly)
Now I'm not getting any errors, but also no outputs for the plotting
If you want to run euporie from master, you'll need to run something like:
git clone https://github.com/joouha/euporie.git cd euporie poetry install poetry run euporie
Running
poetry install
from the cloned repo makes poetry installeuporie
as a development install (along with its dependencies) into a virtual environment, which is isolated from your system python installation. Runningeuporie
without activating the virtual environment first will still run the version installed installed on your system distribution with pip.You can run
euporie
from this virtual environment usingpoetry run euporie
, or you can launch a shell with the virtual environment activated usingpoetry shell
, and run euporie from there.
Thanks this is very helpful! However, unfortunately, like the issue I've linked, I can't run any poetry commands right now, even after wiping it from my system/fresh install. The linked issue mentiones potential to delete the cache folder fixing it, however, this cache isn't created on my machine (no ~/.cache/pypoetry
or similar). There is osx specific caches in ~/Library/caches/pypoetry
and I did try deleting that but to no avail). So unfortunately any poetry command (poetry show, poetry install
right now results in
❯ poetry install
TypeError
expected string or bytes-like object
at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/utils/helpers.py:27 in canonicalize_name
23│ _canonicalize_regex = re.compile(r"[-_]+")
24│
25│
26│ def canonicalize_name(name): # type: (str) -> str
→ 27│ return _canonicalize_regex.sub("-", name).lower()
28│
29│
30│ def module_name(name): # type: (str) -> str
31│ return canonicalize_name(name).replace(".", "_").replace("-", "_")
❯ pwd
/Users/yingzhu_/euporie
from euporie.
If you install timg
do you get ansi images when you try plotting?
You can install it as an optional dependency of euporie with:
pip install --upgrade euporie[images-timg]
Have you tried upgrading poetry? You appear to be running 1.10.0b
or similar.
from euporie.
poetry is/was on 1.16 according to it's CLI. timg doesn't seem to help
from euporie.
I solved the poetry issue (was a package installed somehow with invalid metadata file). However, on the master branch's version of 0.1.12 the display issues still persist
from euporie.
I'm a bit perplexed!
This could be a bug with kitty image rendering. I know the way I have implemented kitty image rendering needs work. What version of kitty are you using? (Unfortunately I do not have access to a Mac).
If you create a cell with an image output then scroll so the cell is partially off-screen, do you see the image rendered as text?
Are you able to get text-mode image output in another terminal?
from euporie.
Using kitty 0.19.3
both timg and the matplotlib kitty backend work well
Again thanks a lot for helping debugging this.
wrt to Mac: I know a lot of co's use https://www.macstadium.com/ for their CI to test things.
from euporie.
Just noticed something odd - if I open a notebook that contains images, the images are displayed correctly.
and indeed, when i scroll it half off the page, they become text like
from euporie.
Yes I had realized that this actually occurs in other frontends as well (which is why I had deleted the comment). Thanks a lot this is super helpful though
from euporie.
@joouha I think this isn't a png specific issue btw - also occurs for svg's - just no output created when printing them.
from euporie.
The reason this occurs with SVGs is because euporie converts them to PNG format to render them.
Could you try upgrading to 0.1.14
and printing a notebook with the --dump
command line flag? I'd be interested to see if you get image output.
from euporie.
from euporie.
Also just updated kitty to 0.20.3
, didn't help either :/
from euporie.
FYI @joouha - i finally had time to dig deeper here and now see where the opening of another NB with image works vs local fails. Appears to have something todo with the kernel's response. Here is the msg
returned when executing a command
message {'header': {'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_9', 'msg_type': 'status', 'username': 'yingzhu', 'session': '7fb602e6-758acaed5578b6bb8bb27ea9', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 446180, tzinfo=tzutc()), 'version': '5.3'}, 'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_9', 'msg_type': 'status', 'parent_header': {'msg_id': 'db07f97c-9ee867c0ccc2844ddf569eaa_1', 'msg_type': 'execute_request', 'username': 'yingzhu', 'session': 'db07f97c-9ee867c0ccc2844ddf569eaa', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 413123, tzinfo=tzutc()), 'version': '5.3'}, 'metadata': {}, 'content': {'execution_state': 'busy'}, 'buffers': []}
message {'header': {'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_10', 'msg_type': 'execute_input', 'username': 'yingzhu', 'session': '7fb602e6-758acaed5578b6bb8bb27ea9', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 446630, tzinfo=tzutc()), 'version': '5.3'}, 'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_10', 'msg_type': 'execute_input', 'parent_header': {'msg_id': 'db07f97c-9ee867c0ccc2844ddf569eaa_1', 'msg_type': 'execute_request', 'username': 'yingzhu', 'session': 'db07f97c-9ee867c0ccc2844ddf569eaa', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 413123, tzinfo=tzutc()), 'version': '5.3'}, 'metadata': {}, 'content': {'code': "%matplotlib inline\nimport matplotlib.pyplot as plt\nplt.plot([1, 2, 3, 4])\nplt.ylabel('some numbers')\nplt.show()", 'execution_count': 2}, 'buffers': []}
message {'header': {'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_12', 'msg_type': 'status', 'username': 'yingzhu', 'session': '7fb602e6-758acaed5578b6bb8bb27ea9', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 491437, tzinfo=tzutc()), 'version': '5.3'}, 'msg_id': '7fb602e6-758acaed5578b6bb8bb27ea9_12', 'msg_type': 'status', 'parent_header': {'msg_id': 'db07f97c-9ee867c0ccc2844ddf569eaa_1', 'msg_type': 'execute_request', 'username': 'yingzhu', 'session': 'db07f97c-9ee867c0ccc2844ddf569eaa', 'date': datetime.datetime(2021, 6, 20, 4, 14, 13, 413123, tzinfo=tzutc()), 'version': '5.3'}, 'metadata': {}, 'content': {'execution_state': 'idle'}, 'buffers': []}
You can see that
elif msg_type == "stream":
elif msg_type in ("error", "display_data", "execute_result"):
are never hit so it'll never render.
I'm not too familiar w/ the jupyter message protocol but will debug further
from euporie.
poetry made this extra difficult to debug as it had a lot of issues I never encountered with normal pip repos, ran into a lot of open issues on the repo, just my 2cents, you might want to consider to switch to pip (I appreciate the design decision of poetry and the problem it tries to solve, but in practice it didn't solve it for me while the conda/pip combo with pinned versions in requirements works good enough).
from euporie.
Awesome - I'm so pleased you fixed this!
What actually was the problem in the end?
from euporie.
from euporie.
Related Issues (20)
- ImportError: cannot import name '_PosixFlavour' from 'pathlib' HOT 2
- Unable to display Latex on foot terminal HOT 7
- Autoformat is not working HOT 2
- Graphics rendering bugs HOT 1
- Latex printing from sympy shows `\displaystyle` and doesn't print using graphics HOT 1
- Custom keybindings for `euporie.notebook.tabs.notebook.Notebook` are not detected
- Scrolling through outputs with keyboard? HOT 3
- euproie makes ptpython not runnable due to an AssertionError HOT 2
- Euporie crashes upon loading notebook HOT 1
- "command" to go to a specific cell (by cell number and line number) HOT 3
- Not detecting kitty image support on Mac, falls back to ANSI HOT 2
- markdonw-it-py version conflict HOT 2
- Love this but it's not working
- Scrolling past top in vim normal mode replaces text HOT 2
- Hover widget displays filenames twice HOT 1
- Installation issues HOT 3
- Non-default color schemes obscure terminal graphics (e.g., Matplotlib plots) in Notebook HOT 3
- Doesn't start HOT 9
- Running `^[` in the console prints a `KeyError` HOT 1
- Error in console HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from euporie.