ModuleNotFoundError: No module named 'pandas'

Hi! I realize there are several topics with this issue, but I’ve applied the fixes in them and it still doesn’t seem to have solved my problem. I’m experiencing this issue with the Sea Level Predictor exercise in the Data Analysis with Python course.

Error message:

python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import sea_level_predictor
  File "/home/runner/boilerplate-sea-level-predictor/sea_level_predictor.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
exit status 1

I have:

  • Updated pyproject.toml Python version to 3.8.
  • Updated poetry.lock pandas Python version to “>= 3.8”.
  • Added/verified that pandas, numpy, etc are included my replit.nix file.

When attempting to run the replit project, I also see this error flashed up for a brief moment:

Replit: Updating package configuration

--> python3 -m poetry add matplotlib
Using version ^3.6.0 for matplotlib

  ParseVersionError

  Unable to parse ">=1.17.4".

  at venv/lib/python3.8/site-packages/poetry/core/semver/version.py:211 in parse
      207│         except TypeError:
      208│             match = None
      209│ 
      210│         if match is None:
    → 211│             raise ParseVersionError('Unable to parse "{}".'.format(text))
      212│ 
      213│         text = text.rstrip(".")
      214│ 
      215│         major = int(match.group(1))

I’m not sure if these are related or not, but any assistance would be fantastic. Thanks in advance!

Could you link to your replit?

No problem.

Link

It’s the same issue as the others (the first error), but somehow your poetry.lock was not parsing (the second error). After forking, I deleted poetry.lock, set python = ">=3.8,<3.12" (for scipy), uninstalled and reinstalled pandas, scipy, and matplotlib, and all worked.

That solved it, thanks!