Error Importing io and experience swatpy user

Hi everyone. am a beginner in python and trying to run script called “swatpy” but this error occurs. pls how can this issue be resolved? and I will appreciate anyone with experience using the swatpy package.

ImportError Traceback (most recent call last)
Input In [1], in <cell line: 4>()
2 import pandas as pd
3 import swatpy
----> 4 from swatpy import io

ImportError: cannot import name ‘io’ from ‘swatpy’ (/home/eoafrica/.local/lib/python3.8/site-packages/swatpy/

The error means that swatpy does not have a variable called io.
Check the docs or read the code of swatpy to find out what is defined.

You’ve named your own script but then tried to import swatpy inside it. Due to the way that Python imports work, that means you’re importing your own script rather than the library you intended to import. I recommend renaming your own script and then removing any swatpy files from the __pycache__ directory nearby, and then trying again.

1 Like

That was my first guess, too, but it really the case here? The traceback suggests that Python is looking in the right place:

ImportError: cannot import name ‘io’ from ‘swatpy’ (/home/eoafrica/.local/lib/python3.8/site-packages/swatpy/

Either way, the swatpy package does not have an io object, so from swatpy import io will not work no matter what you name your own script.