Forums

Module Import Error

Hi, I have a problem with Importing modules into my code, and while the pip version that I have downloaded the module with is correct (pip3.8), the import command still can't seem to find the correct package

* LOGS ***

Error running WSGI application

2022-06-30 06:02:56,326: ModuleNotFoundError: No module named 'latextable'

Error running WSGI application
2022-06-30 06:02:56,326: ModuleNotFoundError: No module named 'latextable'

I know that a lot of people have already asked this, but I can't seem to resolve my problem by referencing other similar forums. Can you help me resolve this issue

Make sure that your web app is running using Python 3.8 and, if you are using a virtualenv in your web app, then you need to install the module into that virtualenv.

So if I am not using a virtualenv and my web app is running on Python 3.8, then what should I do because it is still not working

Your web app is using a virtualenv. Install the module into the virtualenv.

Okay, I have now created a virtualenv and downloaded all of the necessary packages onto it. However, it still cannot find the necessary packages from the virtualenv. Do I need to update my WSGI file for this to work (I am using Flask if that helps)?

I think you might have the wrong version of wtforms installed. The error is

ImportError: cannot import name 'TextField' from 'wtforms'

That suggests that the version that you have installed puts the TextField class somewhere different to what you expect. If you check which version of wtforms you have installed in the environment where you wrote your code, and then make sure that you have the same version installed on PythonAnywhere, then it should work.