I use pyenv and poetry to keep track of python versions and packages. And I use zsh.
With the 0.45.15 update I’m suddenly getting issues when trying to run python commands. Previously I have just told cursor to run commands using poetry run ...
and everything works.
I get this error:
➜ poetry run pytest -v videostream/tests/
Python path configuration:
PYTHONHOME = '/tmp/.mount_cursorVgV595/usr/'
PYTHONPATH = '/tmp/.mount_cursorVgV595/usr/share/pyshared/:'
program name = '/home/richard/.local/share/pypoetry/venv/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/home/richard/.local/share/pypoetry/venv/bin/python'
sys.base_prefix = '/tmp/.mount_cursorVgV595/usr'
sys.base_exec_prefix = '/tmp/.mount_cursorVgV595/usr'
sys.executable = '/home/richard/.local/share/pypoetry/venv/bin/python'
sys.prefix = '/tmp/.mount_cursorVgV595/usr'
sys.exec_prefix = '/tmp/.mount_cursorVgV595/usr'
sys.path = [
'/tmp/.mount_cursorVgV595/usr/share/pyshared/',
'',
'/tmp/.mount_cursorVgV595/usr/lib/python38.zip',
'/tmp/.mount_cursorVgV595/usr/lib/python3.8',
'/tmp/.mount_cursorVgV595/usr/lib/python3.8/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f662989d740 (most recent call first):
<no Python frame>
I am using python 3.10 in my project and this is probably occuring because it’s using an old version of python (3.8).
I can resolve this by doing this:
unset PYTHONHOME PYTHONPATH && poetry run pytest -v
And everything works like before.
I’m guessing cursor started doing something to try to help the users with python environments?