python.envFile not being used

Describe the Bug

In VSCode you could use python.envFile to point to an .env file that contains the PYTHONPATH for external imports. This is useful for monorepo setups that builds granularly.

I suspect since the move to cursorpyright that this feature is now lost in Cursor, rendering the entire development environment broken, as all external imports will no longer be picked up. This means that the agentic features are largely broken because the linting will never be able to be correctly resolved due to missing import errors.

Steps to Reproduce

Have python.envFile in settings. Note that external imports are no longer recognized in editor and module not found type checks occur.

Expected Behavior

Same as VSCode.

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.4.2 (user setup)
VSCode Version: 1.99.3
Commit: 07aa3b4519da4feab4761c58da3eeedd253a1670
Date: 2025-08-06T19:23:39.081Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

1 Like

this stopped working for me recently as well

This is now an opt in feature for VS Code, as detailed here:

.env file no longer being applied · Issue #25294 · microsoft/vscode-python

However, I can’t get this working in Cursor.

Update:

Fixed in Windows by adding:

{“terminal.integrated.env.windows”: {“PYTHONPATH”: “${workspaceFolder}”}

to settings.json

Not working for me, or at least not for my use case, sadly. The “terminal.integrated.env” seems to allow environment variables to be set to the terminal, but it is unclear if that carries over to the in-editor linting environment via language servers.

My current workaround is to manually add lines to the “cursorpyright.analysis.extraPaths” setting, which is a pretty terrible solution considering the hundreds of external packages that might need to be resolved in a codebase.

Hi all, as a workaround, you can try customizing the node executable that runs the language server, and inject env variables either directly or via a wrapper script. Please see the settings cursorpyright.nodeEnvVars and cursorpyright.nodeExecutable.

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