reddit / emacs

Emacs and python

chandaliergalaxy · 2022-08-05 23:11
Hi everyone, looking to use Anaconda Python in Emacs again. Several years ago I was using elpy and it was pretty simple to set up. Now following [these](https://discourse.matplotlib.org/t/solved-figures-from-ipython-within-emacs-on-windows/20167) instructions, I include in my .emacs file: (setq-custom python-shell-interpreter "C:/ProgramData/Anaconda3/Scripts/jupyter.exe") (setq-custom python-shell-interpreter-args "console --simple-prompt") (setq python-shell-completion-native-enable nil) but then I get Error executing Jupyter command 'console': [WinError 5] Access is denied So I run Emacs in Administrator mode, but then I can't work with matplotlib.pyplot interactively because I think it's using a temporary graphics directory that is not anticipated by the Administrator account. Anyone know how to fix it, or have it working another way? Or I wonder if switching to eglot or lsp-mode is better. According to [this](https://news.ycombinator.com/item?id=20829308) post, it's better to stick with language modes in Emacs if they exist and use the language server only for those that don't. **Edit** in case this isn't the case with everyone, using a regular python or ipython shell causes python to freeze when I generate plots wit the matplotlib.pyplot library.
janoc · 2022-08-06 10:05
This has nothing to do with emacs or python even. There is some sort of an issue with your Jupyter/Python installation - that error means you don't have permissions to execute the `console` command. You would get the same error even if you tried to execute the command from `cmd.exe` (command line). Did you install Python/Jupyter as administrator instead of unprivileged user? If so, remove it and install it again as normal user. >According to this post, it's better to stick with language modes in Emacs if they exist and use the language server only for those that don't. That post is 3 years old and long obsolete and, even worse, Elpy is unmaintained. So you will want to switch to using a lsp server at some point. But that has nothing to do with your problem above.
chandaliergalaxy · 2022-08-06 10:15
I would have had to be administrator to install it in C:/ProgramData/Anaconda3 so I don't know that this could be the issue. Didn't know elpy was unmaintained though, I suppose it's time to look into lsp.The reason why I post to Emacs is that this installation works fine in VS Code.
janoc · 2022-08-06 10:20
You don't have to install Anaconda into C:/ProgramData/ (did you mean "Program Files"?) I don't know how you have VSCode installed or how are you running it. But when you get an error that "[WinError 5] Access is denied" then it is a permission issue. See: https://answers.microsoft.com/en-us/windows/forum/all/how-to-fix-error-5-access-is-denied-in-windows-10/8a4069ea-4b0e-4517-9d7a-62c44b4d6e7d