Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python SQLAlchemy Basics Introduction to SQLAlchemy What is SQLAlchemy?

Alexander Cordes
PLUS
Alexander Cordes
Courses Plus Student 12,628 Points

Can't import sqlachemy in REPL

So i'm in my venv and I installed sqlalchemy. I can import it in my models.py file but not in the REPL even though it shows up when I enter pip list. What am I missing?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 Points

Perhaps

  • the pip generating the list is not the same as the pip in the venv. Try python -m pip freeze to see if things differ.
  • the REPL python might not be the python from the venv.
  • try python --version both inside and outside the venv to see if there's difference

3 Answers

Alexander Cordes
PLUS
Alexander Cordes
Courses Plus Student 12,628 Points

I switched terminal from powershell to cmd and that seems to work. Still doesn't work in powershell. Also, even though it gave me no errors importing it into my file, when I ran the .py file in powershell it said module not found.

Alexander Cordes
PLUS
Alexander Cordes
Courses Plus Student 12,628 Points

I assume by honoring you mean that the name of the venv shows up in front of the path in the terminal? It does. I'll check out the link and use cmd for now because that works fine. Thanks for the help.