Search code examples
pythonsympy

import "Sympy" couldn't be resolved


Line:3 Import "sympy" couldn't be resolved

I have installed sympy using pip in my virtual environment. Why am I getting this error? When I run this code I am am getting the following error:

Traceback (most recent call last):
  File "x:\path\NumericalMethods.py", line 3, in <module>
    import sympy
ModuleNotFoundError: No module named 'sympy'

Here are the modules that are installed:

altgraph==0.17
et-xmlfile==1.1.0
future==0.18.2
mpmath==1.2.1
numpy==1.20.3
openpyxl==3.0.7
panda3d==1.10.9
pandas==1.2.4
pefile==2019.4.18
pyinstaller==4.3
pyinstaller-hooks-contrib==2021.1
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
PyQt5Designer==5.14.1
python-dateutil==2.8.1
pytz==2021.1
pywin32-ctypes==0.2.0
six==1.16.0
sympy==1.8
unit-converter==1.1.0
xlrd==2.0.1

Solution

  • The first step is to check whether you are running the code in the virtual environment, to verify that refer the below image

    VS Code Env

    If you are not in a virtual environment that you have created just click that red box that I have marked in that pic and select the respective virtual environment Interpreter (python.exe).