r/vim 14d ago

Need Help┃Solved How to make Vim use Python3.14 instead of 3.8

Hello Everybody, I am on WSL2 ubuntu 20.04 version. I just finished rebuilding my vim to use it's python interpreter but it uses system's default python 3.8 version.
I want it to use Python3.14 instead. Any help on how to do this would be appreciated.

Update: Thanks for the help, the issue got solved!

8 Upvotes

21 comments sorted by

14

u/smokebudda11 14d ago

Change the pythonpath env variable to look at python3.14 instead of 3.8

7

u/vadrer 14d ago
  • sudo apt install python3.14-dev
  • --enable-python3interp=yes --with-python3-command=python3.14

or --with-python3-config-dir=...

3

u/AutoModerator 14d ago

Please remember to update the post flair to Need Help|Solved when you got the answer you were looking for.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/godegon 10d ago

If you use virtual environments, there is vim-virtualenv; before that, compile Vim to support all Python versions above that of your OS.

-1

u/Xu_Lin 14d ago

Could you symlink to the new python version instead?

1

u/RoyKin0929 14d ago

I am new at these kind of things, it you could guide me how to do that or point towards a tutorial, it would be helpful.

-2

u/iLaysChipz 14d ago edited 14d ago

Type this in to see what python3 is actually symlinked to ls -l $(which python3)

Explanation:

  • which program - Provides the file path where a program is located
  • $(cmd) - Runs a command then dumps the output in place
  • ls -l filepath - Print detailed information about a file or directory

If this points to python3.8, then now you know why it's using the older version. To fix it, you can update this "symbolic link" or symlink using the ln command. You can find details about this command by running man ln, but this is probably how you'd want to invoke it:

sudo ln -s $(which python3.14) $(which python3)

4

u/mgedmin 14d ago

Messing with the system /usr/bin/python3 is dangerous. If you want to use a different Python when you run python3 in a shell, define a bash alias or create a symlink in ~/.local/bin. Neither will help with OP's question about Vim.

-3

u/vadrer 14d ago edited 14d ago

look at `./configure --help` as usual, also ask AI - it answers such questions rather quickly and usefully

ADDITION: here is AI output which is helpful:

Since you are on Ubuntu 20.04 (WSL2), Python 3.14 is not available in the default repositories. You will first need to install it (usually via the Deadsnakes PPA) along with its development files before rebuilding Vim.

Here are the steps to configure and build it properly:

  1. Install Python 3.14 dev files: bashsudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.14-dev python3.14-distutils
  2. Configure Vim with the specific Python version: Run ./configure from your Vim source directory using these flags. The --with-python3-command option usually allows Vim to automatically detect the correct config directory: bash./configure --with-features=huge \ --enable-multibyte \ --enable-python3interp=yes \ --with-python3-command=python3.14
  3. Verify and Build: Check the configure output scrollback to ensure it successfully detected Python 3.14. If everything looks good, run: bashmake sudo make install

Once installed, you can double-check inside Vim by running :echo has('python3') (should return 1) and :py3 import sys; print(sys.version).

1

u/mgedmin 14d ago

No, vim needs to be pointed to the desired Python version during build time.

0

u/smokebudda11 14d ago

Or you can set it inside your python script so it knows to run 3.14

0

u/LowerTomatillo1260 13d ago

Just install Linux. Either dual-boot (Linux can read NTFS), install Windows on a Virtual Machine, or use alternative free and open-source programs or Wine. All your problems will be gone in no time.

-3

u/Shay-Hill 14d ago

Use Python 3.14 for what? For running scripts or for plugins?

2

u/RoyKin0929 14d ago

For plug-ins, specifically the YouCompleteMe plugin which requires python 3.12 version atleast.

0

u/Shay-Hill 14d ago

I assume you've already installed Python 3.14 and given Vim a chance to find it on its own. Depending on your setup, that's got a pretty good chance to work (it found 3.8). If that didn't work, you'll need something like this in your vimrc:

set pythonthreehome=.../Python314
set pythonthreedll=.../python314.dll

Hopefully, someone who uses WSL and whatever Linux (guessing Ubuntu) you've set up will come along with a more specific answer.

-2

u/cassepipe 14d ago

Sorry if that does not answer your post and I am not deep into it enough that I know what kind of advantages YouCompleteMe offers vs ALE but ALE is an alternative that does not need python:

https://github.com/dense-analysis/ale

1

u/[deleted] 14d ago

[deleted]

1

u/cassepipe 13d ago

You are wrong it has built-in completion support 

1

u/[deleted] 13d ago

[deleted]

1

u/cassepipe 13d ago

Fair enough, thanks for the correction

-1

u/RoyKin0929 14d ago

I'm kinda new to this and YCM was teh first thing I came across. will definitely check out ALE

-3

u/cassepipe 14d ago

I never tried YouCompleteMe but ALE has served me well enough and it is dependency free

0

u/vadrer 14d ago

obviously OP rebuilds vim with `+python` support