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!