0.46.0 cannot correctly recognize my python venv

Thanks for reporting a bug you have found in Cursor!
Please add the following info to help us diagnose your issue:

I am using

me@my_box:~/somewhere$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

After upgrading to 0.46.0, cursor has a hard time to recognizing my venv, which leads to several issues:

(1) I need to exit my venv and reactivate it in the terminal, otherwise I get:

(my_venv) me@my_box:somewhere$ python
Python path configuration:
  PYTHONHOME = '/tmp/.mount_cursorEnASkE/usr/'
  PYTHONPATH = '/tmp/.mount_cursorEnASkE/usr/share/pyshared/:'
  program name = 'python'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/tmp/.mount_cursorEnASkE/usr/lib/python3.12'
  sys._base_executable = '/home/yeeef/Desktop/workspace/polymarket/backtest/.venv/bin/python'
  sys.base_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.base_exec_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.platlibdir = 'lib'
  sys.executable = '/home/yeeef/Desktop/workspace/polymarket/backtest/.venv/bin/python'
  sys.prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.exec_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.path = [
    '/tmp/.mount_cursorEnASkE/usr/share/pyshared',
    '/home/yeeef/Desktop/workspace/polymarket/backtest',
    '/tmp/.mount_cursorEnASkE/usr/lib/python312.zip',
    '/tmp/.mount_cursorEnASkE/usr/lib/python3.12',
    '/tmp/.mount_cursorEnASkE/usr/lib/python3.12/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 0x00007045f97a9740 (most recent call first):
  <no Python frame>

(2) python related extensions are nearly all broken, due to similar reason

(backtest) yeeef@byeeefy:~/Desktop/workspace/polymarket/backtest$ python
Python path configuration:
  PYTHONHOME = '/tmp/.mount_cursorEnASkE/usr/'
  PYTHONPATH = '/tmp/.mount_cursorEnASkE/usr/share/pyshared/:'
  program name = 'python'
  isolated = 0
  environment = 1
  user site = 1
  safe_path = 0
  import site = 1
  is in build tree = 0
  stdlib dir = '/tmp/.mount_cursorEnASkE/usr/lib/python3.12'
  sys._base_executable = '/home/yeeef/Desktop/workspace/polymarket/backtest/.venv/bin/python'
  sys.base_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.base_exec_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.platlibdir = 'lib'
  sys.executable = '/home/yeeef/Desktop/workspace/polymarket/backtest/.venv/bin/python'
  sys.prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.exec_prefix = '/tmp/.mount_cursorEnASkE/usr/'
  sys.path = [
    '/tmp/.mount_cursorEnASkE/usr/share/pyshared',
    '/home/yeeef/Desktop/workspace/polymarket/backtest',
    '/tmp/.mount_cursorEnASkE/usr/lib/python312.zip',
    '/tmp/.mount_cursorEnASkE/usr/lib/python3.12',
    '/tmp/.mount_cursorEnASkE/usr/lib/python3.12/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 0x00007045f97a9740 (most recent call first):
  <no Python frame>

Downgrade to 0.45.0 could solve the problem.

3 Likes

same!

same issue. Don’t know how to fix.

For details see Cursor 0.46.0 adds $PYTHONHOME to env with wrong value - #9 by serghei

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.