ImportError: No module named 'flask_sqlalchemy' w/ 2 Versions of Python Installed
importerror no module named name
importerror: no module named mac
importerror: no module named linux
importerror: cannot import name
importerror: no module named typing
importerror: no module named hvac
modulenotfounderror: no module named
Tried running a file with the following imports:
from flask_sqlalchemy import sqlalchemy from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker
Received the following error:
ImportError: No module named 'flask_sqlalchemy'
SQLAlchemy is installed. Still, I tried to reinstall into the directory in which it will be used. I got this:
The directory '/Users/_/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/_/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already satisfied: Flask-SQLAlchemy in /Library/Python/2.7/site-packages (2.3.2) Requirement already satisfied: Flask>=0.10 in /Library/Python/2.7/site-packages (from Flask-SQLAlchemy) (1.0.2) Requirement already satisfied: SQLAlchemy>=0.8.0 in /Library/Python/2.7/site-packages (from Flask-SQLAlchemy) (1.2.10) Requirement already satisfied: Jinja2>=2.10 in /Library/Python/2.7/site-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.10) Requirement already satisfied: itsdangerous>=0.24 in /Library/Python/2.7/site-packages (from Flask>=0.10->Flask-SQLAlchemy) (0.24) Requirement already satisfied: Werkzeug>=0.14 in /Library/Python/2.7/site-packages (from Flask>=0.10->Flask-SQLAlchemy) (0.14.1) Requirement already satisfied: click>=5.1 in /Library/Python/2.7/site-packages (from Flask>=0.10->Flask-SQLAlchemy) (6.7) Requirement already satisfied: MarkupSafe>=0.23 in /Library/Python/2.7/site-packages (from Jinja2>=2.10->Flask>=0.10->Flask-SQLAlchemy) (1.0)
The bit about me not owning the directory is incorrect. I'm the only one on this machine. I own everything.
Anyway, I go back to rerun the file and get the same error message. So, it's installed, but not installed or, at the very least, not available to me.
One error message I saw when I commented out one of the import statements read as follows:
I have no clue how to fix this and get SQLAlchemy up and running. I've burned over 1.5 hours on it. The last error listed suggests having 2 versions of python may have something to do with it.
Your thoughts on a remedy would be appreciated.
I think you have a mismatch between your pip and python versions. check your pip version pip --version, if it is pip3 you can try this,
sudo apt-get install python3-sqlalchemy
This should work.
~$ python3 >>import sqlalchemy
ImportError: No module named 'XYZ', ImportError: No module named 'XYZ'. Jupyter notebook cannot find the package you already installed? Let's solve the problem. I'm getting this problem currently. I have no idea why and I've scoured the internet for a solution. It keeps saying ImportError: No module named site no matter how I install python and what I put into my PATHs. I would like to know how python actually loads site.py. Obviously this is a relative/absolute path issue.
Did you install flaskext.sqlalchemy? It looks like you may have only installed the
SQLAlchemy package and NOT the Flask Extension. Try
pip install Flask-SQLAlchemy
Traps for the Unwary in Python's Import System, This has changed in Python 3.3: now any directory on sys.path with a name that "<string>", line 1, in <module> ImportError: No module named example.foo. Registering Spacewalk Client via Rhnreg_ks Fails with "ImportError: No module named rhn.connections" (Doc ID 2681195.1) Last updated on JUNE 22, 2020. Applies to: Linux OS - Version Oracle Linux 6.0 and later Linux x86-64 Symptoms. Registering spacewalk client via Rhnreg_ks fails with "ImportError: No module named rhn.connections"
This works for me.
- If you use virtual environment, firstly you should check whether you are under right environment when you are installing new packages. Since if you use pycharm as IDE and conda as virtual env manager, pycharm won't automatically active the environment of your interpreter in terminal. Example: (base) -> (myenv)
- Use pip3 as package installer. Sometimes problems popped up because of different versions of python in your computer.
pip3 install flask_sqlalchemy
packages installed by pip will be under python2.x/site-packages, while that of pip3 will be under python3.x/site-packages
Python error “ImportError: No module named”, To get rid of this error you just need to create __init__.py in the appropriate directory and everything will work fine. To know more about this you Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Jobs Programming and related technical career opportunities
If you are on mac, try
pip install flask-sqlalchemy
pip3 install flask-sqlalchemy.
It works with some warnings, but was able to succesfully connect to the database and create the tables. "FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning."
ImportError: No module named github · Issue #856 · PyGithub , I'm trying to use PyGitHub and I'm getting "ImportError: No module named github". Setup specs: macOS v10.13.6 Python v3.7.0 Installed with from toolkit.interface import interface ImportError: No module named toolkit.interface I have already checked sys.path and there I have the directory /site-packages . Also, I have the file __init__.py.bin in the toolkit folder to indicate to Python that this is a package.
Possibly it is a pip path issue. If using conda virtual env (with anaconda or miniconda), check
which pip and
which python in linux (find your pip and python path) and make sure they're aligned. Fix your pip path issue or instead of
pip install flask_sqlalchemy do a
<ANACONDA or MINICONDA PATH>/envs/<ENV_NAME>/bin/pip install flask_sqlalchemy
in order to install the package in the correct place.
ImportError: No module named _StGermain · Issue #438, ImportError: No module named _StGermain #438. Closed. FifteenOUC opened this issue on Nov 14, 2019 · 5 comments. Closed ImportError: No module named flask But their solutions aren't helpful. For reference, I do have a folder named flask which one user mentioned may cause issues.
ImportError: No module named product, a traceback that includes the following line: *ImportError: No module named product* I am just starting to work with Odoo/OpenERP so forgive me if the answer yeah , i tried this but i got "No module named http" – Phani varma Jun 27 '14 at 5:20 it'll not work for me and more over i am using python 2.7 ,then how can i overcome this problem – Phani varma Jun 27 '14 at 5:32
[Error] Odoo v11 ImportError: No module named 'models', This is the same question (https://www.odoo.com/forum/help-1/question/error-odoo-v11-importerror-no-module-named-models-125293) But since it was closed, Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Python error “ImportError: No module named”, No module named”. 0 votes. My directory tree looks like this: (local directory)/site-packages/toolkit/interface.py. My code is in here: wanted68 changed the title ImportError: No module named 'jupyterla_dash' ImportError: No module named 'jupyterlab_dash' Jan 21, 2019 Copy link Quote reply LukaPitamic commented Jan 22, 2019
- It's also possible you have a mismatch between your pip and python versions (i.e. you are still pointing to pip for python2, so it thinks flask_sqlalchemy is installed, but then running with python3). Hard to judge without seeing your environment what is going on here
- Can you show the output of
which python(or show which REPL comes up when doing
pythonon your cmd line). And give output of
- Yes, I suspect you're running python3 with pip for python2.7. So the libs aren't installed correctly for Python3. You can either run with python2, or use
pip3and reinstall your libs
- If you can't change which pip you're using, then you need to make sure you're executing with Python2, not Python3. You've installed the libs for Python2 (as far as I can tell).
- Wait, not PYTHONPATH, but just your regular PATH for getting Python2 instead of Python3...PYTHONPATH can only be used to point to Python libs (after you are running python), but it won't tell your OS which Python to start
- doing a
which pipin linux could help you find your pip path and make sure it is in accordance with
- No clue what pycharm is. To the best of my knowledge, don't need it here.
- Oh, I incorrectly assumed that you were using pycharm as your IDE, my bad.