SharmikaNCFC
SharmikaNCFC3w ago

Trying to import Python package but Windmill doesn't recognise it

Hi there, I've been trying to use the package https://pypi.org/project/CurrencyConverter/ in my script, but when I try import it per what the package docs say, I keep getting a module not found error. I've checked the script's lockfile and it is in there with the correct version too, but I can't import and use it. This is part of the error message I'm getting: from currency_converter import CurrencyConverter ModuleNotFoundError: No module named 'currency_converter' Thanks in advance!
PyPI
CurrencyConverter
A currency converter using the European Central Bank data.
3 Replies
Pyra
Pyra3w ago
@SharmikaNCFC Hello. Could you try running this sample?
#requirements:
#currencyconverter

from currency_converter import CurrencyConverter

def main():
pass
#requirements:
#currencyconverter

from currency_converter import CurrencyConverter

def main():
pass
Otherwise windmill will install currency_converter -> currency.converter (https://pypi.org/project/currency.converter/), which is different package. The one you want has no underscore and you need to specify it explicitly. Let me know if it works 😁
SharmikaNCFC
SharmikaNCFCOP3w ago
Hi @Pyra , that worked 😄 ! However, very strangely 'import wmill' is causing me errors now- ModuleNotFoundError: No module named 'wmill' Ah never mind, I forgot to add it to the requirements list at the top 😭 thank you again!
Pyra
Pyra3w ago
When you use #requirements: it prevents windmill from inferring other imports. If you want to have part of dependencies specified explicitly and part inferred from imports use #extra_dependencies: https://www.windmill.dev/docs/advanced/dependencies_in_python#pinning-dependencies-and-requirements No worries