neutrino
neutrino

Reputation: 924

cannot import flask-marshmallow, but requirement already satisfied

I created a virtual environment and pip added a bunch of libraries. They are all working fine, except for Marshmallow.

Im just bringing in some imports, and setting some variables :

from flask import Flask
from flask_marshmallow import Marshmallow

app = Flask(__name__)
ma = Marshmallow(app)

unfortunately, Marshmallow isnt recognized :

Import "flask_marshmallow" could not be resolved

i've pip installed flask_marshmallow; if i install again, i get :

Requirement already satisfied: flask-marshmallow in ./env/lib/python3.9/site-packages (0.14.0)

It is installed to the same place i have flask-sqlalchemy installed, which is working fine.

flask-sqlalchemy in ./env/lib/python3.9/site-packages (0.14.0)

Not sure what else to try!

Upvotes: 0

Views: 775

Answers (1)

elsholz
elsholz

Reputation: 46

This combination of errors hints at a version mismatch. You're likely installing modules with the wrong pip version or in the wrong environment (e.g. if you're using virtual environments).

If you have two different Python versions (say 2.x and 3.x) and run the code with python3, be sure to use pip3 for installing the module.

Can you try this method and post an update? :)

Upvotes: 1

Related Questions