pythonpycharmpython-poetry

Module showing as missing in PyCharm despite installation


An environment is set up using Poetry v2.1.3. The environment is created from a pyproject.toml which has pandas as one of the dependencies:

[project]
name = "pintail-proj"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.12, <4.0"
dependencies = [
    "poetry-core (>=2.0.0,<3.0.0)",
    "pandas (>= 2.3.0)"
]

[tool.poetry]
packages = [{include = "poetry_demo", from = "src"}]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

The environment is successfully created using poetry update from the directory containing the file. Opening PyCharm (PyCharm Community v2025.1.2), the interpreter is set to the Poetry environment. All packages are installed as expected, including pandas, which will be called:

installed packages

However, when attempting to call the pandas package from a script, an error is returned:

No module named 'pandas' 

What is the error in the setup of this environment?


Solution

  • I think that you're using the wrong interpreter. Even though pandas is installed via Poetry, PyCharm may not be pointing to the Poetry-created virtual environment.

    So try to: