Code Monkey home page Code Monkey logo

Comments (19)

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024 1

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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

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.

Charlie37 avatar Charlie37 commented on May 16, 2024

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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

@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.

Charlie37 avatar Charlie37 commented on May 16, 2024

@miguelgrinberg OK, thanks a lot. We're going to try without the postgres db client.

from microblog.

jcsm1th avatar jcsm1th commented on May 16, 2024

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.

ofsazib avatar ofsazib commented on May 16, 2024

@miguelgrinberg ImportError: No module named migrate.versioning problem in python3 as I have installed all the module What will be the solution?

from microblog.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

@ofsazib what's the output of pip freeze?

from microblog.

ofsazib avatar ofsazib commented on May 16, 2024

@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.

ofsazib avatar ofsazib commented on May 16, 2024

@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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

Did you remember to activate the virtualenv before running pip?

from microblog.

ofsazib avatar ofsazib commented on May 16, 2024

@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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

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.

desmond75 avatar desmond75 commented on May 16, 2024

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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

@desmond75 you don't seem to have the sqlalchemy-migrate project installed in your virtual environment.

from microblog.

desmond75 avatar desmond75 commented on May 16, 2024

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.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

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.

MHUNCHO avatar MHUNCHO commented on May 16, 2024

/

from microblog.

miguelgrinberg avatar miguelgrinberg commented on May 16, 2024

Closing this issue, as it does not apply anymore.

from microblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.