python-mode / python-mode

Vim python-mode. PyLint, Rope, Pydoc, breakpoints from box.
GNU Lesser General Public License v3.0
5.45k stars 777 forks source link

no module named xx when run code with python-mode #1135

Open Fuyubai opened 3 years ago

Fuyubai commented 3 years ago

Excuse me, when i run simple code with python-mode, it show "no module named pandas", but my enviroment has pandas?

diraol commented 3 years ago

@Fuyubai without more details/configs it can be hard to help, but I'd say you need to take a look at our documentation related to virtualenvironments.

Fuyubai commented 3 years ago

@Fuyubai without more details/configs it can be hard to help, but I'd say you need to take a look at our documentation related to virtualenvironments.

Thanks for your replying, autually I run vim in my base enviroment

But I try to set virtualenv like this

43 " python-mode
 44 let g:pymode_python = 'python3'
 45 let g:pymode_trim_whitespaces = 1
 46 let g:pymode_doc = 1
 47 let g:pymode_doc_bind = 'K'
 48 let g:pymode_rope_goto_definition_bind = "<C-]>"
 49 let g:pymode_lint = 0
 50 let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe', 'pylint']
 51 let g:pymode_options_max_line_length = 120
 52 let g:pymode_options_colorcolumn = 0
 53 " let g:pymode_folding = 0
 54 let g:pymode_virtualenv = 1
 55 let g:pymode_virtualenv_path = '/home/morning/mrc_ner/env/'

In this way, vim can import torch(there is no pandas in this env ) but appear another problem

/home/morning/mrc_ner/env/lib/python3.8/site-packages/torch/__init__.py|207 error| in <module> from torch._C import _initExtension ImportError: canno t import name '_initExtension'

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

smilesun commented 2 years ago
-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2022-10-07 14:48:53 with file /tmp/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Linux
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/bundle/python-mode/debugvimrc.vim
  2: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  3: /usr/share/vim/vim81/plugin/gzip.vim
  4: /usr/share/vim/vim81/plugin/logiPat.vim
  5: /usr/share/vim/vim81/plugin/manpager.vim
  6: /usr/share/vim/vim81/plugin/matchparen.vim
  7: /usr/share/vim/vim81/plugin/netrwPlugin.vim
  8: /usr/share/vim/vim81/plugin/rrhelper.vim
  9: /usr/share/vim/vim81/plugin/spellfile.vim
 10: /usr/share/vim/vim81/plugin/tarPlugin.vim
 11: /usr/share/vim/vim81/plugin/tohtml.vim
 12: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 13: /usr/share/vim/vim81/plugin/zipPlugin.vim
 14: ~/.vim/bundle/python-mode/plugin/pymode.vim
 15: ~/.vim/bundle/python-mode/autoload/pymode.vim
 16: /usr/share/vim/vim81/filetype.vim
 17: /usr/share/vim/vim81/ftplugin.vim
 18: /usr/share/vim/vim81/ftplugin/python.vim
 19: ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/bundle/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/bundle/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', 'pep8', '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_pep8 {'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.13.0
pymode_virtualenv     #1
pymode_virtualenv_enabled  
pymode_virtualenv_path  
pymode_warning        #1
-------------------------------------------------------------------------------
pymode debug msg 5: Git commit: 
85d2cd1a196ac1def79d4599b5be69395ed5b603
-------------------------------------------------------------------------------
pymode debug msg 6: Git submodule status:
 36dda3fc8a5826b19a33a0ff29402b61d6a64fc2 submodules/astroid (36dda3fc)
 32c78a3a07d7ee35500e6f20bfcd621f3132c42e submodules/autopep8 (32c78a3)
 2d4dd9435fcb05aaa89ba0392a84cb1d30a87dc9 submodules/mccabe (2d4dd94)
 930e2cad15df3661306740c30a892a6f1902ef1d submodules/pycodestyle (930e2ca)
 5f59f6eba0d8f0168c6ab45ee97485569b861b77 submodules/pydocstyle (5f59f6e)
 95fe313ba5ca384041472cd171ea60fad910c207 submodules/pyflakes (95fe313)
 f436ccc6b55b33381a295ded753e467953cf4379 submodules/pylama (f436ccc)
 3eb0362dc42642e3e2774d7523a1e73d71394064 submodules/pylint (3eb0362d)
 62af070aa5ed3505a2629a76778003ce7fd383f0 submodules/rope (62af070a)
 404cab3e069cd5c2c891c19404fbd85bd285c021 submodules/snowball_py (heads/develop)
 3f637dba5f68db63d4b30967fedda51c82459471 submodules/toml (0.10.2)
-------------------------------------------------------------------------------
pymode debug msg 7: End of pymode#debug#sysinfo

  4 from sklearn.preprocessing import normalize
-------------------------------------------------------------------------------
pymode debug msg 8: Session history:
      #  cmd history
>     1  q
-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2022-10-07 14:49:22 with file /tmp/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Linux
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/bundle/python-mode/debugvimrc.vim
  2: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  3: /usr/share/vim/vim81/plugin/gzip.vim
  4: /usr/share/vim/vim81/plugin/logiPat.vim
  5: /usr/share/vim/vim81/plugin/manpager.vim
  6: /usr/share/vim/vim81/plugin/matchparen.vim
  7: /usr/share/vim/vim81/plugin/netrwPlugin.vim
  8: /usr/share/vim/vim81/plugin/rrhelper.vim
  9: /usr/share/vim/vim81/plugin/spellfile.vim
 10: /usr/share/vim/vim81/plugin/tarPlugin.vim
 11: /usr/share/vim/vim81/plugin/tohtml.vim
 12: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 13: /usr/share/vim/vim81/plugin/zipPlugin.vim
 14: ~/.vim/bundle/python-mode/plugin/pymode.vim
 15: ~/.vim/bundle/python-mode/autoload/pymode.vim
 16: /usr/share/vim/vim81/filetype.vim
 17: /usr/share/vim/vim81/ftplugin.vim
 18: /usr/share/vim/vim81/ftplugin/python.vim
 19: ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/bundle/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/bundle/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', 'pep8', '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_pep8 {'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
Error detected while processing /home/xudongs/.vim/bundle/python-mode/ftplugin/python/pymode.vim:
line  249:
Interrupted

-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2022-10-07 14:51:19 with file /tmp/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Linux
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/bundle/python-mode/debugvimrc.vim
  2: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  3: /usr/share/vim/vim81/plugin/gzip.vim
  4: /usr/share/vim/vim81/plugin/logiPat.vim
  5: /usr/share/vim/vim81/plugin/manpager.vim
  6: /usr/share/vim/vim81/plugin/matchparen.vim
  7: /usr/share/vim/vim81/plugin/netrwPlugin.vim
  8: /usr/share/vim/vim81/plugin/rrhelper.vim
  9: /usr/share/vim/vim81/plugin/spellfile.vim
 10: /usr/share/vim/vim81/plugin/tarPlugin.vim
 11: /usr/share/vim/vim81/plugin/tohtml.vim
 12: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 13: /usr/share/vim/vim81/plugin/zipPlugin.vim
 14: ~/.vim/bundle/python-mode/plugin/pymode.vim
 15: ~/.vim/bundle/python-mode/autoload/pymode.vim
 16: /usr/share/vim/vim81/filetype.vim
 17: /usr/share/vim/vim81/ftplugin.vim
 18: /usr/share/vim/vim81/ftplugin/python.vim
 19: ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/bundle/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/bundle/python-mode/autoload/pymode/debug.vim
-------------------------------------------------------------------------------
pymode debug msg 1: Starting debug on: 2022-10-07 14:55:39 with file /tmp/pymode_debug_file.txt
-------------------------------------------------------------------------------
pymode debug msg 2: Operating system: Linux
-------------------------------------------------------------------------------
pymode debug msg 3: Scriptnames:
  1: ~/.vim/bundle/python-mode/debugvimrc.vim
  2: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  3: /usr/share/vim/vim81/plugin/gzip.vim
  4: /usr/share/vim/vim81/plugin/logiPat.vim
  5: /usr/share/vim/vim81/plugin/manpager.vim
  6: /usr/share/vim/vim81/plugin/matchparen.vim
  7: /usr/share/vim/vim81/plugin/netrwPlugin.vim
  8: /usr/share/vim/vim81/plugin/rrhelper.vim
  9: /usr/share/vim/vim81/plugin/spellfile.vim
 10: /usr/share/vim/vim81/plugin/tarPlugin.vim
 11: /usr/share/vim/vim81/plugin/tohtml.vim
 12: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 13: /usr/share/vim/vim81/plugin/zipPlugin.vim
 14: ~/.vim/bundle/python-mode/plugin/pymode.vim
 15: ~/.vim/bundle/python-mode/autoload/pymode.vim
 16: /usr/share/vim/vim81/filetype.vim
 17: /usr/share/vim/vim81/ftplugin.vim
 18: /usr/share/vim/vim81/ftplugin/python.vim
 19: ~/.vim/bundle/python-mode/ftplugin/python/pymode.vim
 20: ~/.vim/bundle/python-mode/autoload/pymode/virtualenv.vim
 21: ~/.vim/bundle/python-mode/autoload/pymode/breakpoint.vim
 22: ~/.vim/bundle/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', 'pep8', '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_pep8 {'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.13.0
pymode_virtualenv     #1
pymode_virtualenv_enabled  
pymode_virtualenv_path  
pymode_warning        #1
-------------------------------------------------------------------------------
pymode debug msg 5: Git commit: 
85d2cd1a196ac1def79d4599b5be69395ed5b603
-------------------------------------------------------------------------------
pymode debug msg 6: Git submodule status:
 36dda3fc8a5826b19a33a0ff29402b61d6a64fc2 submodules/astroid (36dda3fc)
 32c78a3a07d7ee35500e6f20bfcd621f3132c42e submodules/autopep8 (32c78a3)
 2d4dd9435fcb05aaa89ba0392a84cb1d30a87dc9 submodules/mccabe (2d4dd94)
 930e2cad15df3661306740c30a892a6f1902ef1d submodules/pycodestyle (930e2ca)
 5f59f6eba0d8f0168c6ab45ee97485569b861b77 submodules/pydocstyle (5f59f6e)
 95fe313ba5ca384041472cd171ea60fad910c207 submodules/pyflakes (95fe313)
 f436ccc6b55b33381a295ded753e467953cf4379 submodules/pylama (f436ccc)
 3eb0362dc42642e3e2774d7523a1e73d71394064 submodules/pylint (3eb0362d)
 62af070aa5ed3505a2629a76778003ce7fd383f0 submodules/rope (62af070a)
 404cab3e069cd5c2c891c19404fbd85bd285c021 submodules/snowball_py (heads/develop)
 3f637dba5f68db63d4b30967fedda51c82459471 submodules/toml (0.10.2)
-------------------------------------------------------------------------------
pymode debug msg 7: End of pymode#debug#sysinfo

  1  
-------------------------------------------------------------------------------
pymode debug msg 8: Session history:
      #  cmd history
>     1  q