Skip to content

Trouble getting cst_lsp discoverable with pyenv or homebrew #1

Open
@biblicabeebli

Description

@biblicabeebli

This is on mac os 15.1.1, Intel - but I believe the issue is that I am using pyenv - https://github.com/pyenv/pyenv - for my python environments and virtual environments.

(In case it is unfamiliar, pyenv is a set of tools and shims that A) helps manage compilation of arbitrary versions and variants of Python, B) automates/centralizes virtualenvs on top of those multiple versions of Python that you create.)

In general, Zed identifies the relevant project folder's python environment automatically, or at least uses the default "global" virtual environment that can be set for pyenv.

Error log:

[INFO] attempting to start language server "python-refactoring", path: "/Users/blah/blah/blah", id: 6
[ERROR] Failed to start language server "python-refactoring": cst_lsp must be installed and available in $PATH=/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/zfs/bin:/Users/username/.cargo/bin"

Here is a more legible version of the PATH variable above - it contains some items from homebrew but does not contain the pyenv folders, which default to /Users/username/.pyenv/shims and /Users/username.pyenv/bin).

/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
/Library/Apple/usr/bin
/usr/local/zfs/bin  # I'm not sure how homebrew is injecting this one, it is not even part of my profile.
/Users/username/.cargo/bin

My normal shell environment (bash) sources ~/.profile, which injects the pyenv shim, I can then which for items manually and find them in their slightly odd location.

$ which cst_lsp
/Users/username/pyenv/shims/cst_lsp

So

clearly does not load my user's bash environment.

This setup as required implies that there is a canonical way to get cst_lsp into the automatically loaded path, but that mechanism is not documented.

If the recommendation is to just run pip install cst-lsp to install the package without elaboration, this only succeeds for Python installations in the system path (strongly recommended against) or a user-installed and canonically path'd Python instance, for example via homebrew.

I think the best solution would be to provide a manual command to run cst_lsp.


While I have not tested, I suspect whatever configuration requirements currently exist would also not be compatible with Anaconda, which comparable to pyenv in how it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions