I am trying to set up pyright with pyvenv. This is what I am doing:

I am running on fedora 35 with python 3.10 and emacs 27.2.

I install emacs with sudo dnf install emacs. Then I paste this into the .emacs file:

(require 'package)(add-to-list 'package-archives'("melpa-stable" . "https://stable.melpa.org/packages/"))

Then I install elpy and pyvenv (I don't think elpy is necessary) with M-x package-install RET elpy RET ,then I create a virtual environment with M-x pyvenv-create that I activate and work on, which is literally M-x pyvenv-activate and M-x pyvenv-workon I also install use-package with M-x package-install RET use-package RET . Finally I install lsp-mode using: M-x package install RET lsp-mode RET Then I include this to the .emacs file:

(use-package lsp-pyright:ensure t:hook (python-mode . (lambda()(require 'lsp-pyright)(lsp))))

But when I eval the buffer, I get the error:

Error (use-package): Failed to install lsp-pyright: Package 'lsp-pyright' is unavailable

Error (use-package): Cannot load lsp-pyright

I am not sure why I get that error or what I am doing wrong. Could it be because I am using python 3.10? I had some issues with elpy because I was using python 3.10. And more importantly, how to resolve that? I'd appreciate if anyone has a tutorial on this.

Edit: The code formatting looks awful. Sorry about that. In the .emacs file that formatting (indexing) is fine.

submitted by /u/carlml
[link] [comments]