0

Trying to use elpy, I cannot get to run neither elpy-config nor pyvenv-workon commands that I get this error message in the minibuffer.

Steps:

  • open a python file
  • M-x pyvenv-workon RET dev RET where dev is the name of my conda virtual environment
  • get status message for a few seconds: Elpy is updating the RPC virtualenv (’c:/Users/c740/OneDrive/org/.emacs.d/elpy/rpc-venv’)
  • end with this message: json-read: JSON readtable error: 80

Same for trying elpy-config. Note that I have either eldoc error: (json-readtable-error 80) or json-read: JSON readtable error 80, launching both commands.

Elpy is updating the RPC virtualenv (’c:/Users/c740/OneDrive/org/.emacs.d/elpy/rpc-venv’)
json-read: JSON readtable error: 80
Elpy is updating the RPC virtualenv (’c:/Users/c740/OneDrive/org/.emacs.d/elpy/rpc-venv’)
eldoc error: (json-readtable-error 80)
Elpy is updating the RPC virtualenv (’c:/Users/c740/OneDrive/org/.emacs.d/elpy/rpc-venv’)
eldoc error: (json-readtable-error 80)
Elpy is updating the RPC virtualenv (’c:/Users/c740/OneDrive/org/.emacs.d/elpy/rpc-venv’)
json-read: JSON readtable error: 80 [2 times]

I did not get any usable hint in the debugger (disclaimer: I am a newbie in emacs). Researching, I understand the problem is in my python config, less likely on emacs config. Any thought on how to further debug and solve? thanks.

Emacs: GNU Emacs 28.1 (build 2, x86_64-w64-mingw32)

Conda virtual environment (trying to select as pyvenv-workon, unsuccesfully):

>> (dev) C:\Program Files\Emacs\emacs-28.1\bin>conda env export --from-history
name: dev
channels:
  - defaults
dependencies:
  - pip
  - pandas
  - ipython
  - jupyter
prefix: C:\Users\c740\miniconda3\envs\dev

Windows specs:

Edition Windows 11 Home
Version 22H2
Installed on    ‎22/‎01/‎2023
OS build    22621.1105
Experience  Windows Feature Experience Pack 1000.22638.1000.0

Resources consulted and somewhat related:

Appendix: complete conda environment packages list:

>> (dev) C:\Program Files\Emacs\emacs-28.1\bin>conda env export
name: dev
channels:
  - defaults
dependencies:
  - anyio=3.5.0=py310haa95532_0
  - argon2-cffi=21.3.0=pyhd3eb1b0_0
  - argon2-cffi-bindings=21.2.0=py310h2bbff1b_0
  - asttokens=2.0.5=pyhd3eb1b0_0
  - attrs=22.1.0=py310haa95532_0
  - babel=2.11.0=py310haa95532_0
  - backcall=0.2.0=pyhd3eb1b0_0
  - beautifulsoup4=4.11.1=py310haa95532_0
  - blas=1.0=mkl
  - bleach=4.1.0=pyhd3eb1b0_0
  - bottleneck=1.3.5=py310h9128911_0
  - brotlipy=0.7.0=py310h2bbff1b_1002
  - bzip2=1.0.8=he774522_0
  - ca-certificates=2023.01.10=haa95532_0
  - certifi=2022.12.7=py310haa95532_0
  - cffi=1.15.1=py310h2bbff1b_3
  - charset-normalizer=2.0.4=pyhd3eb1b0_0
  - colorama=0.4.6=py310haa95532_0
  - comm=0.1.2=py310haa95532_0
  - cryptography=38.0.4=py310h21b164f_0
  - debugpy=1.5.1=py310hd77b12b_0
  - decorator=5.1.1=pyhd3eb1b0_0
  - defusedxml=0.7.1=pyhd3eb1b0_0
  - entrypoints=0.4=py310haa95532_0
  - executing=0.8.3=pyhd3eb1b0_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - glib=2.69.1=h5dc1a3c_2
  - gst-plugins-base=1.18.5=h9e645db_0
  - gstreamer=1.18.5=hd78058f_0
  - icu=58.2=ha925a31_3
  - idna=3.4=py310haa95532_0
  - intel-openmp=2021.4.0=haa95532_3556
  - ipykernel=6.19.2=py310h9909e9c_0
  - ipython=8.7.0=py310haa95532_0
  - ipython_genutils=0.2.0=pyhd3eb1b0_1
  - ipywidgets=7.6.5=pyhd3eb1b0_1
  - jedi=0.18.1=py310haa95532_1
  - jinja2=3.1.2=py310haa95532_0
  - jpeg=9e=h2bbff1b_0
  - json5=0.9.6=pyhd3eb1b0_0
  - jsonschema=4.16.0=py310haa95532_0
  - jupyter=1.0.0=py310haa95532_8
  - jupyter_client=7.4.8=py310haa95532_0
  - jupyter_console=6.4.4=py310haa95532_0
  - jupyter_core=5.1.1=py310haa95532_0
  - jupyter_server=1.23.4=py310haa95532_0
  - jupyterlab=3.5.2=py310haa95532_0
  - jupyterlab_pygments=0.1.2=py_0
  - jupyterlab_server=2.16.5=py310haa95532_0
  - jupyterlab_widgets=1.0.0=pyhd3eb1b0_1
  - libclang=12.0.0=default_h627e005_2
  - libffi=3.4.2=hd77b12b_6
  - libiconv=1.16=h2bbff1b_2
  - libogg=1.3.5=h2bbff1b_1
  - libpng=1.6.37=h2a8f88b_0
  - libsodium=1.0.18=h62dcd97_0
  - libvorbis=1.3.7=he774522_0
  - libwebp=1.2.4=h2bbff1b_0
  - libwebp-base=1.2.4=h2bbff1b_0
  - libxml2=2.9.14=h0ad7f3c_0
  - libxslt=1.1.35=h2bbff1b_0
  - lxml=4.9.1=py310h1985fb9_0
  - lz4-c=1.9.4=h2bbff1b_0
  - markupsafe=2.1.1=py310h2bbff1b_0
  - matplotlib-inline=0.1.6=py310haa95532_0
  - mistune=0.8.4=py310h2bbff1b_1000
  - mkl=2021.4.0=haa95532_640
  - mkl-service=2.4.0=py310h2bbff1b_0
  - mkl_fft=1.3.1=py310ha0764ea_0
  - mkl_random=1.2.2=py310h4ed8f06_0
  - nbclassic=0.4.8=py310haa95532_0
  - nbclient=0.5.13=py310haa95532_0
  - nbconvert=6.5.4=py310haa95532_0
  - nbformat=5.7.0=py310haa95532_0
  - nest-asyncio=1.5.6=py310haa95532_0
  - notebook=6.5.2=py310haa95532_0
  - notebook-shim=0.2.2=py310haa95532_0
  - numexpr=2.8.4=py310hd213c9f_0
  - numpy=1.23.5=py310h60c9a35_0
  - numpy-base=1.23.5=py310h04254f7_0
  - openssl=1.1.1s=h2bbff1b_0
  - packaging=22.0=py310haa95532_0
  - pandas=1.5.2=py310h4ed8f06_0
  - pandocfilters=1.5.0=pyhd3eb1b0_0
  - parso=0.8.3=pyhd3eb1b0_0
  - pcre=8.45=hd77b12b_0
  - pickleshare=0.7.5=pyhd3eb1b0_1003
  - pip=22.3.1=py310haa95532_0
  - platformdirs=2.5.2=py310haa95532_0
  - ply=3.11=py310haa95532_0
  - prometheus_client=0.14.1=py310haa95532_0
  - prompt-toolkit=3.0.36=py310haa95532_0
  - prompt_toolkit=3.0.36=hd3eb1b0_0
  - psutil=5.9.0=py310h2bbff1b_0
  - pure_eval=0.2.2=pyhd3eb1b0_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pygments=2.11.2=pyhd3eb1b0_0
  - pyopenssl=22.0.0=pyhd3eb1b0_0
  - pyqt=5.15.7=py310hd77b12b_0
  - pyqt5-sip=12.11.0=py310hd77b12b_0
  - pyrsistent=0.18.0=py310h2bbff1b_0
  - pysocks=1.7.1=py310haa95532_0
  - python=3.10.9=h966fe2a_0
  - python-dateutil=2.8.2=pyhd3eb1b0_0
  - python-fastjsonschema=2.16.2=py310haa95532_0
  - pytz=2022.7=py310haa95532_0
  - pywin32=305=py310h2bbff1b_0
  - pywinpty=2.0.2=py310h5da7b33_0
  - pyzmq=23.2.0=py310hd77b12b_0
  - qt-main=5.15.2=he8e5bd7_7
  - qt-webengine=5.15.9=hb9a9bb5_5
  - qtpy=2.2.0=py310haa95532_0
  - qtwebkit=5.212=h3ad3cdb_4
  - requests=2.28.1=py310haa95532_0
  - send2trash=1.8.0=pyhd3eb1b0_1
  - setuptools=65.6.3=py310haa95532_0
  - sip=6.6.2=py310hd77b12b_0
  - six=1.16.0=pyhd3eb1b0_1
  - sniffio=1.2.0=py310haa95532_1
  - soupsieve=2.3.2.post1=py310haa95532_0
  - sqlite=3.40.1=h2bbff1b_0
  - stack_data=0.2.0=pyhd3eb1b0_0
  - terminado=0.17.1=py310haa95532_0
  - tinycss2=1.2.1=py310haa95532_0
  - tk=8.6.12=h2bbff1b_0
  - toml=0.10.2=pyhd3eb1b0_0
  - tomli=2.0.1=py310haa95532_0
  - tornado=6.2=py310h2bbff1b_0
  - traitlets=5.7.1=py310haa95532_0
  - typing-extensions=4.4.0=py310haa95532_0
  - typing_extensions=4.4.0=py310haa95532_0
  - tzdata=2022g=h04d1e81_0
  - urllib3=1.26.14=py310haa95532_0
  - vc=14.2=h21ff451_1
  - vs2015_runtime=14.27.29016=h5e58377_2
  - wcwidth=0.2.5=pyhd3eb1b0_0
  - websocket-client=0.58.0=py310haa95532_4
  - wheel=0.37.1=pyhd3eb1b0_0
  - widgetsnbextension=3.5.2=py310haa95532_0
  - win_inet_pton=1.1.0=py310haa95532_0
  - wincertstore=0.2=py310haa95532_2
  - winpty=0.4.3=4
  - xz=5.2.10=h8cc25b3_1
  - zeromq=4.3.4=hd77b12b_0
  - zlib=1.2.13=h8cc25b3_0
  - zstd=1.5.2=h19a0ad4_0
  - pip:
      - bookmarks-parser==0.1.3
      - html5lib==1.1
      - qtconsole==5.4.0
      - webencodings==0.5.1
prefix: C:\Users\c740\miniconda3\envs\dev

Update 2023-02-09: without understanding the problem, the init setup below is creating a usable elpy-config and a working Python IDE. Trying to install jedi and run jedi:install-server still triggers the original error, so I have not done it.

I am now using the virtual environment emacs (created using conda) and using the python installed in that virtual environment. I am not using the Windows-installed Python.

Also, I had to install some modules used by elpy, like flake8, in a terminal, because elpy had permissions issue. elpy was diligent in notifying when such action was required, even generating the full command for the terminal.

(use-package elpy
  :init
  (elpy-enable)
  )
(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "-i --simple-prompt")
(setq elpy-rpc-virtualenv-path "C:/Users/c740/AppData/Roaming/elpy/rpc-venv")
(setq elpy-rpc-python-command "c:/Users/c740/miniconda3/envs/emacs/python.exe")
(pyvenv-activate "c:/Users/c740/miniconda3/envs/emacs")
2
  • unfortunately i have no real advice for you. but i'd make sure all of your emacs packages are up-to-date. id also just start emacs from inside your activated venv, instead of trying to "switch" between them using emacs/elpy
    – nega
    Commented Feb 9, 2023 at 3:15
  • thanks @nega, after some trials&errors I ended up with a working configuration, however without solving or understanding the original problem. I will edit my question with the working setup
    – erpreciso
    Commented Feb 9, 2023 at 12:01

1 Answer 1

0

I had the same problem and found the issue was that pyvenv does not use python-shell-interpreter on windows. It uses pyvenv-virtualenvwrapper-python. This also doesn't let you just specify python, it has to be the full path of your python executable (including the extension). After specifying the full path with unix-style separators this particular problem disappeared (in my case this was "C:/Python311/pythonw.exe").

I was actually encountering this particular issue trying to setup of my elpy rpc environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.