Forums

ModuleNotFoundError

Hi, I'm trying to deploy my app. So I have an error "ModuleNotFoundError: No module named 'seaborn' " Well, no problem I think and install seaborn with a command pip3.6 install --user seaborn. And it's installed, I can import it. But the app doesn't work even after many reloads. It still gives me an error that no module named seaborn. How can I solve it?

Are you using the same Python version for the install and for the app?

Yeah, I checked it. The version is 3.6 for both of them

Are you sure that's the error that you're getting?

Sure. Also it works perfectly on my local server. 2017-11-22 22:08:48,096: Error running WSGI application 2017-11-22 22:08:48,099: ModuleNotFoundError: No module named 'seaborn' 2017-11-22 22:08:48,100: File "./app.py", line 7, in <module> 2017-11-22 22:08:48,100: import seaborn as sns

have you tried the debugging tips here? https://help.pythonanywhere.com/pages/DebuggingImportError

Well, I will try, but why it works on my local machine and does not here? Also I tried to run my app with virtual machine here on the site, but can't install all the libraries (it has 120mb of memory and it says that no space libre).

Your local machine is a different machine with a different environment.

Okay, I have no idea why it doesn't work

2017-11-22 22:08:48,096: Error running WSGI application
2017-11-22 22:08:48,099: ModuleNotFoundError: No module named 'seaborn'
2017-11-22 22:08:48,099:   File "/var/www/hexi_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-11-22 22:08:48,099:     from app import app as application
2017-11-22 22:08:48,100: 
2017-11-22 22:08:48,100:   File "./app.py", line 7, in <module>
2017-11-22 22:08:48,100:     import seaborn as sns
2017-11-22 22:08:48,100: ***************************************************
2017-11-22 22:08:48,100: If you're seeing an import error and don't know why,
2017-11-22 22:08:48,100: we have a dedicated help page to help you debug: 
2017-11-22 22:08:48,100: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-11-22 22:08:48,101: ***************************************************
2017-11-22 22:08:50,504: Error running WSGI application
2017-11-22 22:08:50,505: ModuleNotFoundError: No module named 'seaborn'
2017-11-22 22:08:50,505:   File "/var/www/hexi_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-11-22 22:08:50,505:     from app import app as application
2017-11-22 22:08:50,505: 
2017-11-22 22:08:50,505:   File "./app.py", line 7, in <module>

Those errors are from 5 days ago. What are the errors you're getting now.

Just a note -- the most recent errors are at the bottom of the error log.

You are right, the error is a bit different now:

2017-11-27 13:34:10,925: Error running WSGI application
2017-11-27 13:34:10,930: ModuleNotFoundError: No module named 'app'
2017-11-27 13:34:10,930:   File "/var/www/hexi_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-11-27 13:34:10,930:     from app import app as application
2017-11-27 13:34:10,930: ***************************************************
2017-11-27 13:34:10,931: If you're seeing an import error and don't know why,
2017-11-27 13:34:10,931: we have a dedicated help page to help you debug: 
2017-11-27 13:34:10,931: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-11-27 13:34:10,931: ***************************************************
2017-11-27 13:34:59,391: Error running WSGI application
2017-11-27 13:34:59,391: ModuleNotFoundError: No module named 'app'
2017-11-27 13:34:59,392:   File "/var/www/hexi_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-11-27 13:34:59,392:     from app import app as application
2017-11-27 13:34:59,392: ***************************************************
2017-11-27 13:34:59,392: If you're seeing an import error and don't know why,
2017-11-27 13:34:59,392: we have a dedicated help page to help you debug: 
2017-11-27 13:34:59,392: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-11-27 13:34:59,392: ***************************************************
2017-11-27 13:35:00,317: Error running WSGI application
2017-11-27 13:35:00,317: ModuleNotFoundError: No module named 'app'
2017-11-27 13:35:00,317:   File "/var/www/hexi_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-11-27 13:35:00,317:     from app import app as application
2017-11-27 13:35:00,318: ***************************************************
2017-11-27 13:35:00,318: If you're seeing an import error and don't know why,
2017-11-27 13:35:00,318: we have a dedicated help page to help you debug: 
2017-11-27 13:35:00,318: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-11-27 13:35:00,318: ***************************************************

Have you tried going through the debugging hints and tips on the page mentioned in that error message?

I am getting the same Error ModuleNotFound

Have you tried going through the debugging hints and tips on the page mentioned in that error message? If so, what did you discover?

Got the same problem importing pdfkit.

YES I have checked the debugging tips. YES I have checked Python versions..

Still...

2019-02-13 10:58:31,090: Error running WSGI application
2019-02-13 10:58:31,096: ModuleNotFoundError: No module named 'pdfkit'
2019-02-13 10:58:31,096:   File "/var/www/kkff_pythonanywhere_com_wsgi.py", line 16, in <module>
2019-02-13 10:58:31,096:     from flask_app import app as application  # noqa
2019-02-13 10:58:31,097: 
2019-02-13 10:58:31,097:   File "/home/kkff/mysite/flask_app.py", line 9, in <module>
2019-02-13 10:58:31,097:     from helpers import makeTicket
2019-02-13 10:58:31,097: 
2019-02-13 10:58:31,097:   File "/home/kkff/mysite/helpers.py", line 5, in <module>
2019-02-13 10:58:31,097:     import pdfkit

[edit by admin: formatting]

2019-02-13 10:58:31,090: Error running WSGI application 2019-02-13 10:58:31,096: ModuleNotFoundError: No module named 'pdfkit' 2019-02-13 10:58:31,096: File "/var/www/kkff_pythonanywhere_com_wsgi.py", line 16, in <module> 2019-02-13 10:58:31,096: from flask_app import app as application # noqa 2019-02-13 10:58:31,097: 2019-02-13 10:58:31,097: File "/home/kkff/mysite/flask_app.py", line 9, in <module> 2019-02-13 10:58:31,097: from helpers import makeTicket 2019-02-13 10:58:31,097: 2019-02-13 10:58:31,097: File "/home/kkff/mysite/helpers.py", line 5, in <module> 2019-02-13 10:58:31,097: import pdfkit

pdfkit isn't installed by default (you can see a list of pre-installed packages here) but you can install it for your own account using the techniques on this help page.

  • If you use the virtualenv technique, don't forget to enter the virtualenv name on the "Web" page
  • If you use the pipX.Y install --user technique, then don't forget to use the specific "X.Y" that matches the Python version for your website (which looks like it's currently set up to use Python 3.7).

OK.. that did the trick..

pip3.7 pdfkit --user was the code I had to use... then it worked...

Great!

Same issue ....checked all ...but not a single thing worded ..not debugging tips..or anything else ...it sucks...I thing I should not pay for thiss....such a headache deploying first website

If you're getting an import error or a module not found error for something that you believe is installed, then you've probably installed it into a version of Python or virtualenv that your code is not running in. If it's part of your code that is not being found, then your Python path is not set up so that it sees the module you're trying to import. See https://help.pythonanywhere.com/pages/DebuggingImportError/

Hi,

I am also getting ModelNotFoundError. Home page of my application is running properly. But now I want to run one "models.py" file in python anywhere console. This "models.py" file contains code for creating tables in database. When I run this "models.py" file using command "python models.py" I am getting ModelNotFoundError.

Can you please guide ?

Hi, @vishal0442. Could you shed some light on what you are trying to do? (Generally you're not suppose to run models.py like that to create tables in db in a Django app, so it's a bit confusing.)

This is my folder structure

(directory) ---> (files)

configurations --> config.py

controller --> task_1_controller.py task_2_controller.py main_controller.py

models --> models.py

templates --> home.html task_1.html task_2.html

In config.py file I have created app instance and db instance. In models.py file I am importing db instance from configurations/config.py and creating models. I have written "db.create_all()" in "if name == 'main':" block.

That means when I will run models.py file directly, models has to be created.

but in Python Anywhere console, I am getting Import error for import line of db instance from config.py file

and one more thing, I m deploying Flask app, not Django.

also can you please advise a effective way to add tables to databases ?

Have a look at our help page on how Python finds the modules that you try to import: https://help.pythonanywhere.com/pages/DebuggingImportError/ Although it's primarily about web apps, the "Theory" section at the top applies to all Python code.

Hi Folks... Mahesh Here, I'm also confronting the identical error ModuleNotFoundError for django crispy_forms even though i have installed that using pip command in my machine. It works fine and perfectly while running it locally with the default host id 127.0.0.1:8000 but when i start deploying it, i will be dragged to that itchy error. Pls, help me out.

Did you follow the help page linked above?

1Hii guys i can't solve this error please anyone can help me to solve this Problem..

2021-03-23 19:08:04,353: Error running WSGI application
2021-03-23 19:08:04,355: ModuleNotFoundError: No module named 'HRMSPROJECT-master.settings'

2021-03-23 19:08:04,355:   File "/var/www/dixit11_pythonanywhere_com_wsgi.py", line 19, in <module>
2021-03-23 19:08:04,355:     application = get_wsgi_application()
2021-03-23 19:08:04,356: 
2021-03-23 19:08:04,356:   File "/home/dixit11/.virtualenvs/rock/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2021-03-23 19:08:04,356:     django.setup(set_prefix=False)
2021-03-23 19:08:04,356: 
2021-03-23 19:08:04,356:   File "/home/dixit11/.virtualenvs/rock/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
2021-03-23 19:08:04,356:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2021-03-23 19:08:04,356: 
2021-03-23 19:08:04,356:   File "/home/dixit11/.virtualenvs/rock/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
2021-03-23 19:08:04,356:     self._setup(name)
2021-03-23 19:08:04,356: 
2021-03-23 19:08:04,356:   File "/home/dixit11/.virtualenvs/rock/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
2021-03-23 19:08:04,357:     self._wrapped = Settings(settings_module)
2021-03-23 19:08:04,357: 
2021-03-23 19:08:04,357:   File "/home/dixit11/.virtualenvs/rock/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
2021-03-23 19:08:04,357:     mod = importlib.import_module(self.SETTINGS_MODULE)

[edit by admin: formatting]

That looks like an error in your WSGI file. The DJANGO_SETTINGS_MODULE defined there should be the name of the module that has your settings; HRMSPROJECT-master.settings is unlikely to be correct because module names cannot have dashes in them.

What do you have in your WSGI file? And where is your Django settings file located?

hi Guys,

I am using xlsxwriter module for my python script , and i too am facing the same issue as shown below: import xlsxwriter ImportError: No module named xlsxwriter

I tried running the pip --user command, but no luck.

Can someone please help me with this ?

Thanks in advance !

If you're getting an import error or a module not found error for something that you believe is installed, then you've probably installed it into a version of Python or virtualenv that your code is not running in. If it's part of your code that is not being found, then your Python path is not set up so that it sees the module you're trying to import. See https://help.pythonanywhere.com/pages/DebuggingImportError/

I am getting a module import error I am trying to run a wagtailsite and it has an installed app home. The app is built using python 3.8

f you're seeing an import error and don't know why, 2021-05-12 19:22:38,020: we have a dedicated help page to help you debug: 2021-05-12 19:22:38,020: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2021-05-12 19:22:38,020: ********* 2021-05-12 19:22:44,530:

Error running WSGI application

2021-05-12 19:22:44,530: ModuleNotFoundError: No module named 'home' 2021-05-12 19:22:44,531: File "/var/www/ashwgtpyany_pythonanywhere_com_wsgi.py", line 92, in <module> 2021-05-12 19:22:44,531: application = get_wsgi_application() 2021-05-12 19:22:44,531: 2021-05-12 19:22:44,531: File "/home/ashwgtpyany/.virtualenvs/wagtail-portfolio-try-py38/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application 2021-05-12 19:22:44,531: django.setup(set_prefix=False) 2021-05-12 19:22:44,531: 2021-05-12 19:22:44,531: File "/home/ashwgtpyany/.virtualenvs/wagtail-portfolio-try-py38/lib/python3.8/site-packages/django/init.py", line 24, in setup 2021-05-12 19:22:44,532: apps.populate(settings.INSTALLED_APPS) 2021-05-12 19:22:44,532: 2021-05-12 19:22:44,532: File "/home/ashwgtpyany/.virtualenvs/wagtail-portfolio-try-py38/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate 2021-05-12 19:22:44,532: app_config = AppConfig.create(entry) 2021-05-12 19:22:44,532: 2021-05-12 19:22:44,532: File "/home/ashwgtpyany/.virtualenvs/wagtail-portfolio-try-py38/lib/python3.8/site-packages/django/apps/config.py", line 90, in create 2021-05-12 19:22:44,532: module = import_module

@ashwgtpyany Did you try to debug it with https://help.pythonanywhere.com/pages/DebuggingImportError/ instruction?

why plyer module is not working in pythonanywhere.com ?

How it's not working for you? What are you trying to do with the package?

No module named 'decouple' How to solve it?

Install the module: https://help.pythonanywhere.com/pages/InstallingNewModules/

Error running WSGI application ModuleNotFoundError: No module named 'accsesory' File "/var/www/mostafaarafa_pythonanywhere_com_wsgi.py", line 31, in <module> application = get_wsgi_application()

What is the full error message? And are you sure that the module name accsesory (which is something that must appear in your code somewhere) is not a typo for accessory?