Comments (19)
are you using a virtualenv? If not, is there any chance you are using pip
to install packages, but then using python3
to run your application? In some OSes, you have to use pip3
for Python3.
from microblog.
Yes, the pip install -r requirements.txt should have included sqlalchemy-migrate. You may want to look at the output of the pip command to see why this package was not installed.
from microblog.
Hello, and thanks for your awesome tutorial.
Sorry to reiterate, but we're having the same issue here, with a slight variation:
python3 db_create.py
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "db_create.py", line 2, in <module>
from migrate.versioning import api
ImportError: No module named 'migrate.versioning'; 'migrate' is not a package
The requirements.txt does contain sqlalchemy-migrate. The pip install -r requirements.txt ends with:
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-rdesxume/psycopg2
Storing debug log for failure in /home/goyave/.pip/pip.log
from microblog.
@Charlie37 it looks like package psycopg2 failed to install. This is the postgres database client. If you don't need it, you can just comment that line out. Or else, you may need to install postgres on your machine so that the Python client can install.
from microblog.
@miguelgrinberg OK, thanks a lot. We're going to try without the postgres db client.
from microblog.
I ran into a similar problem with the migrate.versioning from api not being found. did a pip install sqlalchemy-migrate and all is good now.
from microblog.
@miguelgrinberg ImportError: No module named migrate.versioning problem in python3 as I have installed all the module What will be the solution?
from microblog.
@ofsazib what's the output of pip freeze
?
from microblog.
@miguelgrinberg
Babel==2.3.4
blinker==1.4
click==6.7
coverage==4.3.4
decorator==4.0.11
defusedxml==0.4.1
Flask==0.12
Flask-Babel==0.11.1
Flask-Login==0.4.0
Flask-Mail==0.9.1
Flask-OpenID==1.2.5
Flask-SQLAlchemy==2.1
Flask-WhooshAlchemy==0.56
Flask-WTF==0.14.2
flipflop==1.0
guess-language==0.2
itsdangerous==0.24
Jinja2==2.9.4
MarkupSafe==0.23
pbr==1.10.0
pkg-resources==0.0.0
python3-openid==3.0.10
pytz==2016.10
six==1.10.0
SQLAlchemy==1.1.5
sqlalchemy-migrate==0.10.0
sqlparse==0.2.2
Tempita==0.5.2
Werkzeug==0.11.15
Whoosh==2.7.4
WTForms==2.1
from microblog.
@miguelgrinberg Yes i am using a virtualenv. I have used pip to install pakage.Now what is your suggestion to to.Should I reinstall all the pakages using pip3?Note that I am using Ubuntu 16.04.
from microblog.
Did you remember to activate the virtualenv before running pip
?
from microblog.
@miguelgrinberg yes, I did.Now I am using python3 script.py instead of ./script.py and it runs well as there is some warning.
from microblog.
If ./script.py
does not work, you have to check the first line in the script, which is likely a shebang line that specifies what Python interpreter to use. If you change that to something like:
#!/usr/bin/env python
Then the problem should be fixed.
from microblog.
Hi Miguel nice tutorial i have problem with database migration i get this error as i run the the code i am on windows using python 2.7
Traceback (most recent call last):
File "db_create.py", line 2, in
from migrate.versioning import api
ImportError: No module named migrate.versioning
from microblog.
@desmond75 you don't seem to have the sqlalchemy-migrate project installed in your virtual environment.
from microblog.
This is the path install it to with my vitualenv activated C:\project\microblog\flask\Scripts>
this my output of pip freeze
(flask) C:\project\microblog\flask\Scripts>pip
Babel==2.4.0
blinker==1.4
click==6.7
coverage==4.4.1
decorator==4.0.11
Flask==0.12.2
Flask-Babel==0.11.2
Flask-Login==0.4.0
Flask-Mail==0.9.1
Flask-OpenID==1.2.5
Flask-SQLAlchemy==2.2
Flask-WhooshAlchemy==0.56
Flask-WTF==0.14.2
flipflop==1.0
guess-language==0.2
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pbr==3.0.1
python-openid==2.2.5
pytz==2017.2
six==1.10.0
SQLAlchemy==1.1.10
sqlalchemy-migrate==0.11.0
sqlparse==0.2.3
Tempita==0.5.2
Werkzeug==0.12.2
Whoosh==2.7.4
WTForms==2.1
(flask) C:\project\microblog\flask\Scripts>
from microblog.
With your virtualenv activated, try running python db_create.py
instead of ./db_create.py
(Assuming that is what you were doing). Any difference?
from microblog.
/
from microblog.
Closing this issue, as it does not apply anymore.
from microblog.
Related Issues (20)
- Member redis is unknown HOT 2
- Chapter 14 Translations fail unless the destination language is explicitly specified
- Chapter 22 Export task stuck at 0% HOT 5
- elastic_transport.ConnectionError when post is submitted? HOT 6
- Language inconsistency during poedit translation process? HOT 7
- Using JinJa2 filter function truncate to implement 'Read more'? HOT 21
- Bug in lesson 5 due to werkzeug.urls - url parsing removed HOT 4
- Lesson 6, FLASK_ENV is removed from Flask 2.3.0 HOT 2
- Unable to load celery application. 'str' object has no attribute 'level' when Integrating Celery with Flask? HOT 17
- Unable to import 'url_parse' from 'werkzeug.urls' in flask shell execution HOT 15
- login error was reported during deployment? HOT 7
- Github links in chapters start with wrong tag (one-off) HOT 2
- Dead link to flask-babel docs HOT 1
- flask_moment error when trying to format HOT 4
- Multidict Package Problematic in python:slim HOT 1
- next HOT 3
- Error: Cannot import name 'app' from 'app' HOT 2
- Exporting a huge number of database records HOT 3
- ImportError...circular import HOT 3
- Chp 4 udemy course: Video 27 Time 1 min: db.sessions.add(u) Generates Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microblog.