Code Monkey home page Code Monkey logo

magma-nvim's People

Contributors

beyarkay avatar dccsillag avatar gallavee avatar loipesmas avatar meatballs avatar mrbober avatar tbung avatar tzachar avatar usmcamp0811 avatar whiteblackgoose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magma-nvim's Issues

[Bug] MagmaLoad fails if a cell didn't finish executing

I got this error while attempting to do a MagmaLoad:

Error detected while processing function Jupyter[8]..remote#define#CommandBootstrap[5]..remote#define#request: line    2:
[Magma] Error while doing Magma IO: Incorrect type for key 'execution_count': expected int, got NoneType

After checking the corresponding json, there was effectively a 'execution_count': null, and I managed to fix the issue by adding manually an unused number.
My guess is that this was caused because I did a MagmaSave while a cell hadn't finished running, but I feel like this should not cause an error, and magma should be able to load information about a partially executed cell and display it as such.

REQUEST: Add a way to to choose which python interpreter to launch as the kernel

Currently it seems to use g.python3_host_prog. Which i feel is okay/good for the plugin itself (I setup a venv for neovim to run plugins inside). But for the kernel it should use the virtual environment activated when python was launched or add a command that chooses which python interpreter to use (similar to vscode)

Internal functionality is currently exposed as commands

They need to be somehow accessible through vimscript; however, this is probably best done with vimscript functions with "internal" (or similar) in their name.

The relevant commands are:

  • MagmaClearInterface
  • MagmaOnBufferUnload
  • MagmaOnExitPre
  • MagmaTick
  • MagmaUpdateInterface
  • MagmaEvaluateFromOperator

[Feature Request] Add vimdocs

Is your feature request related to a problem? Please describe.
Add documentation in vimdocs format so it can be accessed via :h magma.

Describe the solution you'd like
Ideally there is a way to transpile markdown to vimdocs, so the README can be reused. I'd have to look into that.

Describe alternatives you've considered
Always opening the README, this is non-ideal.

Additional context
I found these two transpilers with a quick google search, but I'd have to look into the a bit more, if this feature is something you would like in the project.
https://github.com/kdheepak/panvimdoc
https://github.com/FooSoft/md2vim

[Bug] MagmaInit fails when Ueberzug is not installed

Thanks very much to the project maintainers, this looks very promising!

Unfortunately I cannot use this as I use MacOS and ueberzug does not work on MacOS (see #15). However, I was wondering if it would be possible to still use magma-nvim without ueberzug, with the caveat that images cannot be displayed?
As it stands, I can't even try out the plugin because :MagmaInit complains that ueberzug is not installed.
Or maybe I underestimated how much the project relies on ueberzug?

Thanks in advance for the consideration.

Commands do not appear

Hello and thank you for the project!

I followed the instructions and none of the commands showed whatsoever.

Checking the health shows that everything is installed correctly.
image

Does anyone have an idea of why this is the case? Thank you!

Request - Persistent window and cell delimiters

Interesting plugin! I've been using nvim-ipy with the Jupyter QT console for some time, but having everything in one window sounds a lot nicer.
Anyway back to my requests:

  • Would it be possible to have a persistent output window below the executed cell that doesn't cover the code? Something like in this other plugin that reads .ipynb files.

  • Would it be possible to have manual cell delimeters? Something like:

    ##
    cell here
    ##
    

Edit: Sorry for the mess with the empty issue.

Add GIF demo to README

GIF demos will be added to this issue so that we have an URL to insert in Markdown which does not pollute the repository.

[Bug] unable to run UpdateRemotePlugins

Describe the bug
whenever i run :UpdateRemotePlugins` i got this error

Encountered ImportError loading plugin at /home/user/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin
/python3/magma: libffi.so.6: cannot open shared object file: No such file or directory                             
Traceback (most recent call last):                                                                                 
  File "/home/user/.local/lib/python3.9/site-packages/pynvim/plugin/host.py", line 165, in _load                
    module = imp.load_module(name, file, pathname, descr)                                                          
  File "/home/user/.config/pyenv/versions/3.9.12/lib/python3.9/imp.py", line 244, in load_module                
    return load_package(name, filename)                                                                            
  File "/home/user/.config/pyenv/versions/3.9.12/lib/python3.9/imp.py", line 216, in load_package               
    return _load(spec)                                                                                             
  File "<frozen importlib._bootstrap>", line 711, in _load                                                         
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked                                                
ImportError: libffi.so.6: cannot open shared object file: No such file or directory                                
remote/host: python3 host registered plugins []                                                                    
remote/host: generated rplugin manifest: /home/user/.local/share/nvim/rplugin.vim  

Desktop (please complete the following information):

  • OS: Linux Fedora 36
  • Browser Firefox, ungoogled chromium
  • Python Version 3.9.12
  • neovim version 0.7.0

Additional context
I'm using pyenv and i have vim.g['python3_host_prog'] = '~/.config/pyenv/shims/python3' set in my config file . Note that i have all the dependencies up and running well with no problems
If i use my system's python then i will have another problem with ueberzug since it dosen't seem to work under python 3.10

[Feature Request] Adding option of HideOutput

I wonder is it possible to add an option to hide the output. I think letting the output be automatically shown but some outputs contain many warnings, in which case, an cmd that one can hide the output would be nice.

[Bug] MagmaInit fails after choosing kernel

Describe the bug
Thanks for your work on this exciting plugin!

When initializing :MagmaInit and choosing the kernel (python3) I immediately receive the following error:

Error detected while processing function MagmaUpdateInterface[1]..remote#define#request:
line    2:
Error invoking '/root/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma:function:MagmaUpdateInterface' on channel 11 (python3-rplugin-host):
ch 11 was closed by the client

The actual value of the channel changes between runs, but the error is the same. Once I press enter it starts repeating this message everytime I try to do anything:

Error detected while processing function MagmaTick[1]..remote#define#request:
line    2:
Error invoking '/root/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma:function:MagmaTick' on channel 11 (python3-rplugin-host):
Invalid channel: 11

which renders my nvim instance useless.

FWIW :checkhealth reports that everything is fine (before the init, of course).

Desktop (please complete the following information):

  • OS: Ubuntu 18.04 [inside a docker container)
  • Version: latest

Wraping long output

Hi, I found while running long text the output is impossible to read. Maybe there are some settings to fix it, or plan to extend it?
!
Screenshot-Sep23::14-15-04

REQUEST: support plotly

Is it possible to support plotly figures out of the box?
The mimetype used is 'application/vnd.plotly.v1+json

[Feature Request] image display on remote desktop through ssh

Is your feature request related to a problem? Please describe.
I'm always frustrated when working with images in Vim, this is an awesome plugin, but I tried on a remote desktop through ssh -X or ssh -Y but the image cannot display

Describe the solution you'd like
The plugin can output the display in nvim on a remote desktop

MagmaInit and MagmaLoad clash

Im trying to set up a workflow, where I automatically load magma for *.jupyter files, and get consistent behavior between opening new files and reopening old files. Something like this:

function! MyMagmaInit()                                       
        setlocal filetype=python                              
        set syntax=python                                     
        MagmaInit python3                                     
        MagmaLoad                                             
endfunction                                                   
                                                              
augroup magma                                                 
  au! BufRead,BufNewFile *.jupyter call MyMagmaInit()         
  au! BufWrite *.jupyter MagmaSave                            
augroup end                                                   

However, Im getting a clash between MagmaInit and MagmaLoad when reopening a file, as MagmaLoad tries to init a second time:

Error detected while processing function MyMagmaInit[4]..remote#define#CommandBootstrap[5]..remote#define#request:                                                    
line    2:                                                                                                                                                            
[Magma] Magma is already initialized; MagmaLoad initializes Magma.                   

Also, when opening a new file, the MagmaLoad fails gloriously.
Any ideas how to solve this? Can we add a way of checking if a file has saved state, reload it id it exists and if not init magma?
Maybe a new command, something like:

MagmaLoadInit('python3')

[Bug] Error when invoking MagmaDelete

Describe the bug
Error when invoking MagmaDelete

Error detected while processing function remote#define#CommandBootstrap[5]..remote#define#request:              
line    2:                                                                                                      
Error invoking '/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma:command:MagmaDelete' on chann
el 3 (python3-rplugin-host):                                                                                    
error caught in request handler '/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma:command:Magm
aDelete []':                                                                                                    
Traceback (most recent call last):                                                                              
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/utils.py", line 14, in inner         
    func(self, *args, **kwargs)                                                                                 
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/__init__.py", line 265, in command_de
lete                                                                                                            
    magma.delete_cell()                                                                                         
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 171, in delete_
cell                                                                                                            
    self.update_interface()                                                                                     
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 179, in update_
interface                                                                                                       
    self.clear_interface()                                                                                      
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 151, in clear_i
nterface                                                                                                        
    self.outputs[self.selected_cell].clear_interface()                                                          
KeyError: <magma.utils.Span object at 0x7ff90094fa30> 

To Reproduce
Steps to reproduce the behavior:

  1. Select range and invoke MagmaEvaluateVisual OR invoke MagmaEvaluateLine
  2. Invoke MagmaDelete while cell is selected
  3. See error

Expected behavior
Delete the cell

Screenshots
image
image
image

Desktop
NVIM v0.8.0-dev-888-g7ff283b1b
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

[Bug] Cannot start MagmaInit

Hello, this is not a bug but I cannot use the plugin at all.
Installation went smoothly and :checkhealth appears fine but I simply cannot fire the plugin using :MagmaInit, it is like the plugin was not installed.
I am probably doing something very stupid

:checkhealth
image

:version
image

~/.init.vim is empty
image

Describe the bug
E492: Not an editor command: Magma

To Reproduce
Simply type :MagmaInit

Screenshots
image

Desktop (please complete the following information):

  • OS: Fedora 34
  • Browser Firefox 95

[Bug] Plot doesn't show up

Describe the bug
When I ran :MagmaEvaluateLine, a popup showed up with message Out[5]: ✓ Done but a plot didn't show up. I had run :checkhealth and all was ok.

To Reproduce
Steps to reproduce the behavior:

  1. I wrote this code:
import numpy as np
import matplotlib.pyplot as plt

 x = np.linspace(-10, 10, 1000)
y = np.sin(x**2)

plt.plot(x, y);
  1. I ran :MagmaInit then chose python3.
  2. I ran all the line using :MagmaEvaluateLine.

Expected behavior
The line plt.plot(x,y); should show a plot, but it only shows Out[5]: ✓ Done

Screenshots
Screenshot 2022-04-25 061445

Desktop (please complete the following information):

  • OS: [wsl (windows subsystem for Linux) windows 10]

[Bug] Border isn't aligned when showing an image

Describe the bug
Plotting an image misaligns the window's border.

To Reproduce

  1. Enable borders (I think it's the default);
  2. Try to plot an image.

Expected behavior
The border is displayed around the image.

Screenshots
image

Desktop

  • OS: Linux, using kitty as an image provider (on Wayland, so I can't test Ueberzug)
  • Version:
NVIM v0.8.0-dev-994-g5ff2ea6687
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

bug: Some error related to switching/opening buffers

error caught in async handler '/home/amedhi/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/pyth
on3/magma.py:autocmd:BufUnload:* []'                                                                      
Traceback (most recent call last):                                                                        
  File "/home/amedhi/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 47,
 in inner                                                                                                 
    func(self, *args, **kwargs)                                                                           
  File "/home/amedhi/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 990
, in autocmd_bufunload                                                                                    
    magma = self.buffers.get(int(self.nvim.funcs.expand('<abuf>')))                                       
ValueError: invalid literal for int() with base 10: ''                        

I can't seem to nail down exactly when it happens but one reliable way is to hit <leader>, wait for which-key.nvim to show up then hit <ESC>

I see it is something to do with the BufUnload autocommand so I guess it's to do with leaving the buffer

Also doing a LSP search for references leads to this happening many times

Any way to run a lua function on MagmaInit

I want to make some buffer local bindings when I initialize magma inside the buffer. Right now I do it by defining my own command that calls MagmaInit and sets up the keybindings, but that needs me to remember to run my command and not MagmaInit.

Maybe a user event for autocommands would be good?

[Feature Request] Add a command to reevaluate all cells

Currently, when I load a magma save, I have to manually reevaluate all cells in order to get my python environment back to where it was. I think it would be convenient to have a command MagmaReevaluateAll that would loop through all cells, most likely in document order (or perharps, as an option, in execution_count order, and reevaluate each one, waiting for it to be finished before going to the next one.

Also, it feels related, but it would be nice to have a way to jump to the next cell, or even to cell number n

[Bug] execution_count is missing

Describe the bug

This is what I get on save:

Error detected while processing BufWritePre Autocommands for "*.jupyter":                                                        Error executing lua callback: /home/tzachar/.config/nvim/lua/au.lua:74: Vim(let):Error invoking '/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma:command:MagmaSave' on channel 4 (python3-rplugin-host):                  error caught in request handler '/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma:command:MagmaSave [[]]':                                                                                                                 Traceback (most recent call last):                                                                                                 File "/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma/utils.py", line 14, in inner         func(self, *args, **kwargs)                                                                                                    File "/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma/__init__.py", line 296, in command_save                                                                                                                               json.dump(save(magma), file)                                                                                                   File "/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma/io.py", line 92, in save             "cells": [                                                                                                                     File "/home/tzachar/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma/io.py", line 98, in <listcomp>       "execution_count": output.execution_count,                                                                                   AttributeError: 'OutputBuffer' object has no attribute 'execution_count'                                                         stack traceback:                                                                                                                         [C]: in function 'cmd'               

To Reproduce
Steps to reproduce the behavior:
Start magma, execute a cell and try to save the buffer

Expected behavior
no bug...

Massively slows down startup

When my computer is under a moderate load, this plugin appears to be massively slowing down opening time: 1 more second!

Here's the start of the output of :StartupTime:

       startup: 1949.6
event                  time percent plot
BufEnter autocommand 954.79   48.97 ██████████████████████████
packer_compiled.lua  194.39    9.97 █████▎
expanding arguments  155.69    7.99 ████▎
python3.vim          149.25    7.66 ████▏
init.lua             112.73    5.78 ███▏
csillag.vim           56.51    2.90 █▌
filetype.vim          44.51    2.28 █▎
loading packages      43.17    2.21 █▏
opening buffers       39.72    2.04 █▏
loading plugins       32.92    1.69 ▉
syntax.vim            18.02    0.92 ▌
synload.vim           17.45    0.90 ▌
csillag.vim           16.87    0.87 ▌
rplugin.vim           14.79    0.76 ▍
rplugin.vim           14.11    0.72 ▍
indent_blankline.vim  13.74    0.70 ▍
reading ShaDa         12.14    0.62 ▍
tcomment.vim          11.61    0.60 ▍
TabularMaps.vim        9.48    0.49 ▎
wordmotion.vim         8.41    0.43 ▎
entire.vim             8.13    0.42 ▎
first screen update    7.63    0.39 ▎

[Feature Request] Define cells manually

Is your feature request related to a problem? Please describe.
Not precisely a problem but it would be great to have the option of defining cells manually (e.g using # %%) so that everything is in the same file and there's no need to save and load another file whenever editing code.

Describe the solution you'd like
Add an option that either lets you use a predefined "marker" to define a new cell or lets you define your own marker.

Describe alternatives you've considered
Using visual selection and running the code to create a cell. However, if I forget to save or load the json file it will start throwing errors and I lose all the cells. I would prefer if I can define the cells myself using # %%.

[Feature Request] Scrolling pop-up windows or opening them in new buffers

Is your feature request related to a problem? Please describe.
It's sometimes useful to be able to read the whole output from a cell and in that case the limited space that a pop-up offers is not enough.

Describe the solution you'd like
Perhaps some way or scrolling the pop-ups or to request opening the output in a new buffer where you can read it and then close it.

Image display without Ueberzug

This plugin is literally all I ever wanted. Can't tell you how pumped I am. However, I'm, like so many, running Mac so this doesn't work right now.
(Not telling you anything new here probably but ueberzug isn't available on Mac)
Looks like #14 is a very good possible solution.

[Bug] Matplotlib showing very large images

Describe the bug
When I run code to show a matplotlib plot, the output image becomes larger after I do zt (to move the code up)

Expected behavior
In the GIF (given in the readme of the repository) , the output plot appears to be the same in size when scrolling, Is this some option that I set in my config?

Screenshots
If applicable, add screenshots to help explain your problem.

Before scrolling up:
image
After scrolling up:
image
Checkhealth:
image
neovim version/ build:
image

[Feature Request] Kernel Interrupt and Kernel Restart functions

Is your feature request related to a problem? Please describe.
Sometimes I might start long running cells and notice a mistake in the code while it's running, interrupting the kernel saves me from deinitializing and reinitializing magma. Similarly, sometimes the kernel gets into a failure state regarding one cell or one might get rid of memory-heavy variables that the kernel has loaded, in that case restarting the kernel might be necessary.

Describe the solution you'd like
Two commands, MagmaInterrupt and MagmaRestart, that do the afforementioned things.

Describe alternatives you've considered
The only alternative I can think of is to use MagmaDeinit and MagmaInit to get a fresh kernel.
Another thing worth considering is to add MagmaStart and MagmaStop functions that (re)start or stop a kernel, also a flag or separate command for restarting and clearing all output together might be a nice addition (this could even be nice default behaviour for MagmaRestart.

Additional context
I have already implemented this feature in my fork, have verified that it works, and will open a pull request.

Thanks for this great project!

Love this project

This project so needs into the community! I hope that you will be maintaining this project!

[Feature Request] Performance improvements

Is your feature request related to a problem? Please describe.
Having magma enabled makes scrolling slow, especially in larger cells and files.

Describe the solution you'd like
I didn't have time to look into it in more depth, but MagmaUpdateInterface should be made as performant as possible, maybe caching and only moving certain elements, or not be called on every curser move event. Doing slow computations asynchronous might also be possible.

Describe alternatives you've considered
Simply disable the autocmd.

Additional context
I'll probably be able to look into it a little at the end of next week.

[Feature Request] Can `inputlist` in `_ask_for_choice` be replaced with `vim.ui.select`?

Is your feature request related to a problem? Please describe.
vim.ui.select is a lua function that is overridable by the user for so that the user can create alternate uis

Describe the solution you'd like
Call the lua function vim.ui.select instead of the viml function inputlist. I guess the main problem is I don't know if lua can be called from python.

A related would be to include a Telescope extension so we can search for the kernel we want to init. This might be more convenient for users, especially if they have a lot of virtual environments with different kernels

[Feature Request] Handling of virtual environments

Is your feature request related to a problem? Please describe.
I would mostly like to understand, how you handle virtual environments, since I have not been able to fully grasp this.
Consider the following:

  • I have a hard-coded g:python3_host_prog=~/Installations/pynvim/venv/bin/python as suggested in :help python-virtualenv
  • I use virtual environments in all of my local projects
  • when starting a kernel via :MagmaInit, I would like that it starts the kernel using the active virtual environment

Describe the solution you'd like
As said above, I would like the kernel started by Magma to use the currently active virtual environment, from the shell in which Neovim was started.

Describe alternatives you've considered
I would like to avoid having to install all the Neovim-related python packages in every environment and remove the python3_host_prog setting, but I assume that this would be an alternative.

Additional context
Years ago, I implemented a similar project, deuterium, but it has less features than yours and is currently so out-of-date, that I was looking at alternatives before trying to revive it. I found your plugin to basically do everything I want, except the handling of virtual environments.

Error on UpdateRemotePlugins

First of all, amazing work! I've been hoping for a hydrogen-like plugin for neovim for quite a while now, and this is looking to be a great implementation.

Now to the issue, when running UpdateRemotePlugins the following error is thrown:

Encountered TypeError loading plugin at /home/user/.local/share/nvim/site/pack/packer/start/magma-nvim/rplugin/python3/magma.py: 'type' object is not s
ubscriptable
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/nvim-env/lib/python3.8/site-packages/pynvim/plugin/host.py", line 165, in _load
    module = imp.load_module(name, file, pathname, descr)
  File "/usr/lib/python3.8/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.8/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
TypeError: 'type' object is not subscriptable

It seems like pynvim isn't recognizing the type annotation syntax from the source file. Removing all indexing from type annotations makes the error go away.

Not sure if this is an error on my end or if it's a common problem.

Design Questions

Hi there.

Im trying to understand some of the design choices, as Im having trouble with some of the current behaviour. To be more precise, why are you calling MagmaBuffer.clear_interface on every CursorMoved? I would expect this to only be called when the cursor exited a cell / entered a different cell. This causes an excess of ui redraws, and also make it difficult to properly place images using Kitty.

Install script still refers to "master" branch

Describe the bug
When attempting to install using vim-plug the following error occurs:

fatal: invalid reference: master

To Reproduce
Steps to reproduce the behavior:

Install the plugin per the instructions for vim-plug, i.e.:

Plug 'dccsillag/magma-nvim', { 'do': ':UpdateRemotePlugins' }

Expected behavior
Vim-plug confirms the plugin installed properly

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2022-08-10 at 12 34 44

Desktop (please complete the following information):

  • OS: MacOS 12.5
  • Browser: N/A

Can you edit .ipynb files?

This seems like a silly question, but how do you get started using this plugin? I had supposed that I would just open a .ipynb file but nvim shows it as an unparsed text file with all the delimiters etc. visible. Are you supposed to start with a blank file and then work from there?

Sorry if I'm being an idiot!

Bug: error when trying to show image

For the following code:

import numpy as np                                                
import matplotlib.pyplot as plt                                   
                                                                                                                
x = np.random.rand(10000)                                         
plt.hist(x)                                                    

I get the following error:

Error detected while processing function remote#define#request:                                                                                                       
line    2:                                                                                                                                                            
Error invoking '/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py:autocmd:CursorMoved:*' on channel 7 (python3-rplugin-host):  
error caught in request handler '/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py:autocmd:CursorMoved:* []':                  
Traceback (most recent call last):                                                                                                                                    
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 47, in inner                                                  
    func(self, *args, **kwargs)                                                                                                                                       
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 965, in autocmd_cursormoved                                   
    self._update_interface()                                                                                                                                          
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 824, in _update_interface                                     
    magma.update_interface()                                                                                                                                          
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 694, in update_interface                                      
    self._show_selected(self.selected_cell)                                                                                                                           
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 737, in _show_selected                                        
    self._show_outputs(self.outputs[span], span.end)                                                                                                                  
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 611, in _show_outputs                                         
    chunktext = chunk.place(lineno, shape, self.canvas)                                                                                                               
  File "/home/tzachar/.local/share/nvim/site/pack/packer/opt/magma-nvim/rplugin/python3/magma.py", line 264, in place                                                 
    if ((self.img_width/xpixels)/(self.img_height/ypixels))*max_nlines <= w:                                                                                          
ZeroDivisionError: division by zero                                                                                                 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.