Skip to content

Improve documentation, for systems where python3 points to python<3.7 #19701

@pfbuxton

Description

@pfbuxton

rust-analyzer version: rust-analyzer version: 0.3.2433-standalone

rustc version: 1.86.0 (05f9846f8 2025-03-31)

editor or extension: VSCode

relevant settings: rust-analyzer.server.extraEnv, PYO3_CROSS_LIB_DIR

I am working on a project which uses PyO3, which requires Python>=3.7

The problem I had was that on my linux machine, the python3 command points to Python 3.6 which is not supported by PyO3. I also found that the shell VSCode uses for rust-analyser did not use my .bashrc profile. The workaround was to add the following to VSCode's settings.json:

{
    "rust-analyzer.server.extraEnv": {
        "PYO3_CROSS_LIB_DIR": "/home/peter.buxton/.local/share/uv/python/cpython-3.13.2-linux-x86_64-gnu/lib"
    }
}

To find what PYO3_CROSS_LIB_DIR should be you can do:
python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"

I know that this is an issues which is quite a specific to my set-up, but it did take several hours to fix. So perhaps this can help someone else out.

Thanks,
Peter

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions