Search code examples
pythonvisual-studio-codepython-poetrypandasaipandas-ai

Cannot import pandasai with poetry


I am not able to import library - using poetry to install in VSCode, can see that .toml file has pandasai as a dependency, but still when I import it is not finding it. My Python version in mac and in VSCode are the same.

Any ideas what might be wrong?

screenshots below:

import fails, toml file showing pandasai is there


Solution

    1. Did you start virtual environment in your current shell?
    poetry shell
    
    1. Did you install all the dependencies?
    poetry install
    
    1. In VS Code Ctrl+Shift+P to open VS Code commands (top of the screen), then type and select "Python: Select Interpreter". Afterwards from the list of python interpreters either select poetry virtual environment or use "Enter interpreter path" to navigate to python.exe of poetry's virtual environment.
    2. If you added this dependency manually to pyproject.toml, please run
    poetry lock
    

    In the future use

    poetry add <dependency-name>
    

    instead.