11

I wonder how to reload Python package after pip install in Visual Studio Code?

  1. pip install package-A
  2. pip list
  3. package-A does not exist
  4. Restart 'Visual Studio Code'

Is the only way to restart?

informatik01
  • 16,038
  • 10
  • 74
  • 104
Bourne
  • 113
  • 1
  • 1
  • 6
  • 6
    does `Developer: Reload Window` solve the problem? Maybe Python language server caches the current available modules. – rioV8 Feb 17 '21 at 16:00

6 Answers6

9

The best answer I've found is to use Developer: Reload Window in the command palette like @rioV8 suggested. You can either use the command palette or you can change the key mappings as described here.

There's already a Ctrl + R key mapping for reloading the window, but it's got a 'when' condition attached to it so I changed that to true. I also had to delete key mappings for other extensions so there was no overlap.

informatik01
  • 16,038
  • 10
  • 74
  • 104
bbnt
  • 128
  • 1
  • 8
3

ctrl+shift+p and choose "Developer: Reload with extentions disabled"

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
0

You can do that using the Refresh Explorer (The reload button) right next to the directory/workspace that you opened up in the File Explorer.

You might have to hover for a while next to the workspace/directory name on the file explorer once it's expanded to have it in view.

enter image description here

DhakkanCoder
  • 794
  • 3
  • 15
0

You mean upgrade or re-install ?

pip install --upgrade --force-reinstall <package>

OR

pip install -I <package>
pip install --ignore-installed <package>

Try these commands

champion-runner
  • 1,489
  • 1
  • 13
  • 26
0

On MacOS, use command + shift + p and then choose "Developer: Reload Window". It is helpful to bind this to command + r. For Windows users, replace command with CTRL.

eatsfood
  • 950
  • 2
  • 21
  • 31
-1

Are you sure this is a vscode issue? What happens when you run pip install from a normal command prompt? I suspect you will have the same issue, if that proves true, I would entirely uninstall python and re-install python, then install/upgrade pip to latest.

python -m pip install –upgrade pip

apinostomberry
  • 139
  • 1
  • 11