10 to 1 you named your own script wikipedia.py
.
The line import wikipedia
then imports the script itself, not the package you installed from PyPI. You can see this in the dir()
output, the imported module has the name wikipedia
in the namespace; the self-reference.
You can confirm this, or find what other module masked your import, with:
import wikipedia
print wikipedia.__file__
Rename that file to stop it from masking the library.