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?

Allison Welch
Allison Welch
3,178 Points

pip freeze > requirements.txt adds all globally installed packages to requirements.txt

Hi, I'm a new user of PyCharm. I created a project for this course in PyCharm and it created the virtual environment to go along with the project automatically. When I went to create the requirements.txt file for this virtual environment, it listed a lot of packages—I'm assuming they were all the packages installed globally on my machine. It may also be relevant to note that when I went to install sqlalchemy in this virtual environment, it said it was already installed.

I deleted the virtual environment created by PyCharm and created a new one, installed sqlalchemy with pip, and then pip freeze > requirements.txt only shows sqlalchemy and typing_extensions (don't know what that is but assuming maybe a dependency of sqlalchemy?), so that seems to have solved the problem of including all my global packages.

I'm just wondering if anyone here knows what was going on and how I can avoid that in the future if I want to be able to use the virtual environments that PyCharm creates with the projects?

1 Answer

Allison Welch
Allison Welch
3,178 Points

Oh I think it happened because I changed the name of the virtual environment (from .venv to venv), so I won't do that in the future!