Forums

No module named 'flask_marshmallow'

I am using python 3.8 and I implemented all libraries by

pip3.8 install flask-sqlalchemy
pip3.8 install flask-marshmallow
pip3.8 install marshmallow-sqlalchemy
pip3.8 install mysql-connector-python-r

When I tried to implement Marshmallow by

from flask_marshmallow import Marshmallow

it shows error

  File "/home/PLCMRG/mysite/flask_app.py", line 4, in <module>
    from flask_marshmallow import Marshmallow
ModuleNotFoundError: No module named 'flask_marshmallow'

Is there any way to solve it so i can use that library?

[edit by admin: formatting]

Where are you seeing that error? I can't see it in the log files that are accessible to us as admins.

As an error i ment that i just cannot import that lib and all it shows is the messege

Traceback (most recent call last):

File "/home/PLCMRG/mysite/flask_app.py", line 4, in <module>

from flask_marshmallow import Marshmallow

ModuleNotFoundError: No module named 'flask_marshmallow'

It shows every time i try to run flask app.

Also when I try to instal it again it says

Requirement already satisfied: marshmallow in /home/PLCMRG/.virtualenvs/myvirtualenv/lib/python3.8/site- 
packages (3.12.1)

Might it be problem that it instals itself in wrong directory?

Where exactly do you see the error? Is it in a console, or the logs for a scheduled task, or something else?

When i run the program, on the bottom a black console shows and it is right there. Right when I try to run it

You don't normally need to run your website from the editor; that's designed for interactive scripts that use the "input" command and "print" to print things out. For a website, once you've set it up on the "Web" page, it's automatically started up when it received requests. Any errors are put into the website's error log, which is accessible from the "Web" page and has the most recent error at the bottom of the file.

If there's a specific reason for you to run your website's code from the editor, then you would need to tell it to use the virtualenv that you've specified for the website -- see this help page -- but, again, you normally would not need to do that.

I am still new in programing an I make a lot of misstakes so I always want to try to run it from editor so I know if the code is right and I have no misstakes

As Giles mentioned above, you have an error log to see if your code is correct.