Forums

Can't import a module

so I'm building a Django app, when I run the app I got this error

ModuleNotFoundError at /

No module named 'profile.models'; 'profile' is not a package

I followed https://help.pythonanywhere.com/pages/DebuggingImportError and still didn't fix it

profile is a folder and its path is /home/nutpattara/sec1_V-Solution/backend/profile and there is a __ init __.py file in the folder, other folders at the same level seems to be working fine.

here's my python path
['/var/www', '.', '', '/var/www', '/home/nutpattara/.virtualenvs/django/lib/python36.zip', '/home/nutpattara/.virtualenvs/django/lib/python3.6', '/home/nutpattara/.virtualenvs/django/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/nutpattara/.virtualenvs/django/lib/python3.6/site-packages', '/home/nutpattara/sec1_V-Solution/backend']

profile is the name of a standard Python module, so your profile name is colliding with it: https://docs.python.org/3.6/library/profile.html. Either rename your app to something that does not collide, or change the layout of your code so that you're importing your profile module from one level up: from backend.profile.models import TheModel

hi Admin, I m

hi Admin, I am trying to install this module called kbbi: https://pypi.org/project/kbbi/ I have tried using the bash console and run the following: pip3.7 install --user kbbi but still I am getting module not found error, any idea why? Thank you in advance!

The most likely cause is that you are not running your code with Python 3.7. Make sure that you are using the version of Python that you installed the module into.

hi Admin, thank you for your quick response. I am actually using 3.7. I just checked my logs and I noticed that the module is doing request to "https://kbbi.kemdikbud.go.id" to extract definition of Indonesian words from dictionary. I was wondering if it is possible to whitelist the given url? Thank you!

Send us a link to the API documentation for the site kbbi.kemdikbud.go.id and we'll consider it for the whitelist.

hi Admin, unfortunately there is no API documentation for it. The module itself (i.e. the module which access the site) simply scraps pages from the site with licensing mentioned under "Lisensi" at the bottom of the module page: https://pypi.org/project/kbbi/.

If this does not satisfy requirement for whitelisting, I can try finding some other alternatives. Thank you!

That's not something we can add to the list.

how can I install library like tensorflow to work in the console

https://help.pythonanywhere.com/pages/InstallingNewModules but you probably won't be able to do it on a free account.