New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
site.getsitepackages returns also the venv dir #102733
Comments
|
I'll do a bit of digging on this. |
|
Is it adding the current directory, or is it always |
|
@ericvsmith It's always PS> cd c:\projects
PS> .\test\Scripts\python
Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getsitepackages()
['C:\\projects\\test', 'C:\\projects\\test\\lib\\site-packages']
>>> import os
>>> os.getcwd()
'C:\\projects'The same also from other folders, outside |
|
There seems to be a non No Virtual EnvironmentVirtual EnvironmentEnvironment
|
|
@timendum and @ericvsmith, I believe my PR fixes the issue. I think it was just some legacy code added 14 years ago that needed to be removed. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Bug report
On Windows, the method
site.getsitepackages()returns<venv>\lib\site-packageswhich is expected, but also<venv>, which I think is an issue.From the documentation, it should "Return a list containing all global site-packages directories."
I've also checked in a Linux virtualenv environment, and it returns only "site-packages" and "dist-packages" folders.
Demo
Expected:
['C:\\projects\\test\\lib\\site-packages']Environment
Linked PRs
getsitepackagesfunction from returning non site package directories on windows #102986The text was updated successfully, but these errors were encountered: