joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.55k stars 36 forks source link

Dependencies #7

Closed davidbrochart closed 3 years ago

davidbrochart commented 3 years ago

I was wondering why numpy, pandas, pillow, scikit-image and sklearn are required?

joouha commented 3 years ago

Pillow is required to determine the dimensions of images for image rendering.

The others are not supposed to be installed by default - they are pulled in by img2unicode, which I meant to make an optional dependency, but I messed up my pyproject.toml file!

zygm0nt commented 3 years ago

So, a follow up question - why n2 dependency? What does ANN search has to do with viewing jupyter notebooks?

Also main reason behind this question is that I can't install n2 on Mac OS X - have problems compiling it.

bjodah commented 3 years ago

Not sure if this error belongs here, but maybe a markdown lexer might be needed too?

    raise ClassNotFound('no lexer for alias %r found' % _alias)

Exception no lexer for alias 'markdown' found
Unhandled exception in event loop:
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/eventloop/utils.py", line 72, in schedule
    func()
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 480, in redraw
    self._redraw()
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 552, in _redraw
    self.context.copy().run(run_in_context)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 535, in run_in_context
    self.renderer.render(self, self.layout)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 672, in render
    layout.container.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 809, in write_to_screen
    self.content.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 809, in write_to_screen
    self.content.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 399, in write_to_screen
    c.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 399, in write_to_screen
    c.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 716, in write_to_screen
    c.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 399, in write_to_screen
    c.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 716, in write_to_screen
    c.write_to_screen(
  File "/home/bjorn/.local/lib/python3.8/site-packages/euporie/scroll.py", line 116, in write_to_screen
    self.to_draw = self.arrange_children(write_position)
  File "/home/bjorn/.local/lib/python3.8/site-packages/euporie/scroll.py", line 414, in arrange_children
    size = self.get_child_size(i, refresh=True)
  File "/home/bjorn/.local/lib/python3.8/site-packages/euporie/scroll.py", line 380, in get_child_size
    size = container.preferred_height(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 795, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 325, in preferred_height
    dimensions = [
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 326, in 
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 2625, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 577, in preferred_height
    dimensions = [
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 578, in 
    c.preferred_height(s, max_available_height)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 325, in preferred_height
    dimensions = [
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 326, in 
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1623, in preferred_height
    return self._merge_dimensions(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1651, in _merge_dimensions
    preferred = get_preferred()
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/containers.py", line 1616, in preferred_content_height
    return self.content.preferred_height(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 647, in preferred_height
    content = self.create_content(width, height=1)  # Pass a dummy '1' as height.
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 779, in create_content
    get_processed_line = self._create_get_processed_line_func(
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 730, in _create_get_processed_line_func
    return create_func()
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 717, in create_func
    get_line = self._get_formatted_text_for_line_func(document)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 678, in _get_formatted_text_for_line_func
    return self._fragment_cache.get(key, get_formatted_text_for_line)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/cache.py", line 41, in get
    value = getter_func()
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/layout/controls.py", line 675, in get_formatted_text_for_line
    return self.lexer.lex_document(document)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/lexers/base.py", line 78, in lex_document
    return lexer.lex_document(document)
  File "/home/bjorn/.local/lib/python3.8/site-packages/prompt_toolkit/lexers/base.py", line 77, in lex_document
    lexer = self.get_lexer() or self._dummy
  File "/home/bjorn/.local/lib/python3.8/site-packages/euporie/cell.py", line 235, in 
    get_lexer_by_name(self.language).__class__,
  File "/home/bjorn/.local/lib/python3.8/site-packages/pygments/lexers/__init__.py", line 119, in get_lexer_by_name
    raise ClassNotFound('no lexer for alias %r found' % _alias)

Exception no lexer for alias 'markdown' found
Press ENTER to continue...
joouha commented 3 years ago

@zygm0nt img2unicode was supposed to be an optional dependency - it brings in a lot of things which euporie does not actaully require (including n2).

I've fixed this in master, but was wanted to resolve https://github.com/joouha/euporie/issues/2 before creating a new release to prevent euporie potentially breaking other tools which depend on jupyter-client.

@bjodah Which version of pygments do you have installed? pygments==2.9.0 has 'markdown' as an alias for MarkdownLexar (see here), so I wonder if you have an old version...?

bjodah commented 3 years ago

I did. I had 2.7.x (can't remember) manually upgrading pygments seem to have solved the issue. Thanks.

joouha commented 3 years ago

The original issue is fixed by 5dad165960bf45c6a689a4accbd46594cb24f977, and the fix is in the v0.1.4 release

simurgh9 commented 2 years ago

I was also getting a ClassNotFound: no lexer for alias 'markdown' found when I tried to edit a markdown cell. Had to run the pip3 install pygments -U to solve the issue.