Skip to content

trouble with venv #1197

@o-dawgie

Description

@o-dawgie

My system python version is 3.14.3, and in order to rule out the unsupported python version as a cause for another bug (which I will report in a separate issue, probably after ironing out this one) I am trying to run pymode in a python 3.13 venv. I created the venv with python3.13 -m venv .venv and after activating it via source .venv/bin/activate I confirmed that python --version returns Python 3.13.12. I created a file test.py with the contents:

import sys
print(sys.version)

and running that with python test.py returns 3.13.12 (main, Mar 19 2026, 16:13:46) [GCC 15.2.1 20260209] as expected. When I open the file in vim with pymode enabled, there's a message at the bottom that reads [Pymode] Activate virtualenv /path/to/workingDirectory/.venv which seems to imply the venv is being successfully detected and activated, however running the code via the default \r shortcut produces the output 3.14.3 (main, Feb 13 2026, 15:31:44) [GCC 15.2.1 20260209] (my system python version) rather than the version from the virtual environment. I am pretty much a complete noob with python so it's possible I'm simply misunderstanding how this is meant to work, but I would expect the code to be run using the version of python included in the active venv.

output of vim --version:

VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Feb 16 2026 19:44:28)
Included patches: 1-10
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl                 +jumplist            -sodium
+arabic              +keymap              -sound
+autocmd             +lambda              +spell
+autochdir           +langmap             +startuptime
-autoservername      +libcall             +statusline
-balloon_eval        +linebreak           -sun_workshop
+balloon_eval_term   +lispindent          +syntax
-browse              +listcmds            +tabpanel
++builtin_terms      +localmap            +tag_binary
+byte_offset         +lua/dyn             -tag_old_static
+channel             +menu                -tag_any_white
+cindent             +mksession           +tcl/dyn
+clientserver        +modify_fname        +termguicolors
-clipboard           +mouse               +terminal
+clipboard_provider  -mouseshape          +terminfo
+cmdline_compl       +mouse_dec           +termresponse
+cmdline_hist        +mouse_gpm           +textobjects
+cmdline_info        -mouse_jsbterm       +textprop
+comments            +mouse_netterm       +timers
+conceal             +mouse_sgr           +title
+cryptv              -mouse_sysmouse      -toolbar
+cscope              +mouse_urxvt         +user_commands
+cursorbind          +mouse_xterm         +vartabs
+cursorshape         +multi_byte          +vertsplit
+dialog_con          +multi_lang          +vim9script
+diff                -mzscheme            +viminfo
+digraphs            +netbeans_intg       +virtualedit
-dnd                 +num64               +visual
-ebcdic              +packages            +visualextra
+emacs_tags          +path_extra          +vreplace
+eval                +perl/dyn            -wayland
+ex_extra            +persistent_undo     -wayland_clipboard
+extra_search        +popupwin            -wayland_focus_steal
-farsi               +postscript          +wildignore
+file_in_path        +printer             +wildmenu
+find_in_path        +profile             +windows
+float               -python              +writebackup
+folding             +python3/dyn         -X11
-footer              +quickfix            +xattr
+fork()              +reltime             -xfontset
+gettext             +rightleft           -xim
-hangul_input        +ruby/dyn            -xpm
+iconv               +scrollbind          -xsmp
+insert_expand       +signs               -xterm_clipboard
+ipv6                +smartindent         -xterm_save
+job                 +socketserver        
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "~/.config/vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.42/core_perl/CORE -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -L/usr/local/lib -o vim -lm -ltinfo -lacl -lattr -lgpm -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

output of git status in my python-mode directory:

On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

contents of pymode_debug_file.txt as generated using the instructions from the readme:

-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2026-03-19 14:28:48 with file /tmp/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Linux
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/pack/python-mode/start/python-mode/debugvimrc.vim
  2: /usr/share/vim/vimfiles/plugin/black.vim
  3: /usr/share/vim/vim92/plugin/getscriptPlugin.vim
  4: /usr/share/vim/vim92/plugin/gzip.vim
  5: /usr/share/vim/vim92/plugin/logiPat.vim
  6: /usr/share/vim/vim92/plugin/manpager.vim
  7: /usr/share/vim/vim92/plugin/matchparen.vim
  8: /usr/share/vim/vim92/plugin/netrwPlugin.vim
  9: /usr/share/vim/vim92/pack/dist/opt/netrw/plugin/netrwPlugin.vim
 10: /usr/share/vim/vim92/plugin/openPlugin.vim
 11 A: /usr/share/vim/vim92/autoload/dist/vim9.vim
 12: /usr/share/vim/vim92/plugin/rrhelper.vim
 13: /usr/share/vim/vim92/plugin/spellfile.vim
 14: /usr/share/vim/vim92/plugin/tarPlugin.vim
 15: /usr/share/vim/vim92/plugin/tohtml.vim
 16: /usr/share/vim/vim92/plugin/tutor.vim
 17: /usr/share/vim/vim92/plugin/vimballPlugin.vim
 18: /usr/share/vim/vim92/plugin/zipPlugin.vim
 19: ~/.vim/pack/python-mode/start/python-mode/plugin/pymode.vim
 20: ~/.vim/pack/python-mode/start/python-mode/autoload/pymode.vim
 21: /usr/share/vim/vim92/filetype.vim
 22: /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim
 23: /usr/share/vim/vimfiles/ftdetect/SRCINFO.vim
 24: /usr/share/vim/vimfiles/ftdetect/meson.vim
 25: /usr/share/vim/vim92/ftplugin.vim
 26: /usr/share/vim/vim92/autoload/dist/ft.vim
 27: /usr/share/vim/vim92/ftplugin/python.vim
 28: ~/.vim/pack/python-mode/start/python-mode/ftplugin/python/pymode.vim
 29: ~/.vim/pack/python-mode/start/python-mode/autoload/pymode/virtualenv.vim
 30: ~/.vim/pack/python-mode/start/python-mode/autoload/pymode/breakpoint.vim
 31: ~/.vim/pack/python-mode/start/python-mode/autoload/pymode/debug.vim
-------------------------------------------------------------------------------
pymode debug msg 4: Pymode variables:
pymode                #1
pymode_breakpoint     #1
pymode_breakpoint_bind  <leader>b
pymode_breakpoint_cmd  breakpoint()
pymode_debug          #1
pymode_debug_counter  #3
pymode_debug_tempfile  /tmp/pymode_debug_file.txt
pymode_doc            #1
pymode_doc_bind        K
pymode_doc_vertical   #0
pymode_folding        #0
pymode_folding_nest_limit #1000
pymode_folding_regex   ^\s*\%(class\|def\|async\s\+def\) .\+\(:\s\+\w\)\@!
pymode_indent         #1
pymode_indent_hanging_width #-1
pymode_init           #1
pymode_lint           #1
pymode_lint_async     #1
pymode_lint_async_updatetime #1000
pymode_lint_checkers  ['pyflakes', 'pycodestyle', 'mccabe']
pymode_lint_comment_symbol  CC
pymode_lint_cwindow   #1
pymode_lint_docs_symbol  DD
pymode_lint_error_symbol  EE
pymode_lint_ignore    []
pymode_lint_info_symbol  II
pymode_lint_message   #1
pymode_lint_on_fly    #0
pymode_lint_on_write  #1
pymode_lint_options_mccabe {'complexity': 12}
pymode_lint_options_pep257 {}
pymode_lint_options_pycodestyle {'max_line_length': 79}
pymode_lint_options_pyflakes {'builtins': '_'}
pymode_lint_options_pylint {'max-line-length': 79}
pymode_lint_pyflakes_symbol  FF
pymode_lint_select    []
pymode_lint_signs     #1
pymode_lint_sort      []
pymode_lint_todo_symbol  WW
pymode_lint_unmodified #0
pymode_lint_visual_symbol  RR
pymode_motion         #1
pymode_options        #1
pymode_options_colorcolumn #1
pymode_options_max_line_length #79
pymode_paths          []
pymode_preview_height #12
pymode_preview_position  botright
pymode_python          python3
pymode_quickfix_maxheight #6
pymode_quickfix_minheight #3
pymode_rope           #0
pymode_rope_prefix     <C-c>
pymode_run            #1
pymode_run_bind        <leader>r
pymode_trim_whitespaces #1
pymode_version         0.14.0
pymode_virtualenv     #1
pymode_virtualenv_enabled  /home/odawgie/scripts/python-playground/.venv
pymode_virtualenv_path  /home/odawgie/scripts/python-playground/.venv
pymode_warning        #1
-------------------------------------------------------------------------------
pymode debug msg 5: Git commit: 
7dd171f1340ac60dd18efe393014289072cbb814
-------------------------------------------------------------------------------
pymode debug msg 6: Git submodule status:
 193a2cbba58cce2542882fcedd0e49f6763672ed submodules/appdirs (1.4.0-99-g193a2cb)
 a3623682a5e1e07f4f331b6b0a5f77e257d81b96 submodules/astroid (v3.3.10)
 4046ad49e25b7fa1db275bf66b1b7d60600ac391 submodules/autopep8 (v2.3.2)
 835a5400881b7460998be51d871fd36f836db3c9 submodules/mccabe (0.7.0)
 814a0d1259444a21ed318e64edaf6a530c2aeeb8 submodules/pycodestyle (2.14.0)
 07f6707e2c5612960347f7c00125620457f490a7 submodules/pydocstyle (6.3.0)
 59ec4593efd4c69ce00fdb13c40fcf5f3212ab10 submodules/pyflakes (3.4.0)
 53ad214de0aa9534e59bcd5f97d9d723d16cfdb8 submodules/pylama (8.4.1)
 f798a4a3508bcbb8ad0773ae14bf32d28dcfdcbe submodules/pylint (v3.3.7)
 68410edb910891659c3a65d58b641b26c62914ad submodules/pytoolconfig (v1.3.1)
 5409da0556f0aed2a892e5ca876824b22e69c915 submodules/rope (1.13.0)
 404cab3e069cd5c2c891c19404fbd85bd285c021 submodules/snowball_py (heads/develop)
 3f637dba5f68db63d4b30967fedda51c82459471 submodules/toml (0.10.2)
 73c3d102eb81fe0d2b87f905df4f740f8878d8da submodules/tomli (2.2.1)
-------------------------------------------------------------------------------
pymode debug msg 7: End of pymode#debug#sysinfo

[Pymode] Code running ...
1773944946 let l:traceback = [] []
1773944946 let l:output = ["3.14.3 (main, Feb 13 2026, 15:31:44) [GCC 15.2.1 20260209]", "test"] []
"__run__" [New]

[Pymode] Virtualenv /home/odawgie/scripts/python-playground/.venv already enabled.

  1 import sys
-------------------------------------------------------------------------------
pymode debug msg 8: Session history:
      #  cmd history
      1  PymodeVirtualenv '.venv'
>     2  q

if there's any relevant system information missing from this issue let me know and I shall try to correct it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions