Search code examples
pythonvisual-studio-codepipenv

VSCode not picking up ipykernel


I'm trying to use vscode with jupyter via the python extension. My pipfile looks like this:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
opencv-python = "*"

[requires]
python_version = "3.6"

[dev-packages]
ipykernel = "*"
ipython = "*"
jupyter = "*"

To start the ipython interpreter i follow these steps:

  • $ pipenv install
  • $ pipenv shell
  • $ code .
  • using the Python: Select interpreter, i select the pipenv environment
  • run code

when i got to the code block by pressing shift + enter, i see the errors:

enter image description here

Code block:

#%%
import cv2

I have also tried using all dependencies in the [packages] section, reinstalling my pipenv from scratch, and repeating the above process.

Always the same error, what am i missing?

$ code -v
1.41.1
26076a4de974ead31f97692a0d32f90d735645c0
x64


Solution

  • I had the same issue do the following

    1- remove python and fresh install new python the latest version has pip in it

    2- open terminal as administrator and run the following command:

      pip install ipykernel --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org