Skip to content
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

buildzig.py's sysconfig.get_config_var("LDLIBRARY") fails on Windows #185

Open
shakfu opened this issue Oct 5, 2023 · 5 comments
Open

Comments

@shakfu
Copy link
Contributor

shakfu commented Oct 5, 2023

FYI,

I just happened to be testing pydust on a windows on a windows11 machine and sysconfig.get_config_var("LDLIBRARY") returns None even if Python3.11 is installed in the standard system-wide location: C:\Program Files\Python3.11

@shakfu
Copy link
Contributor Author

shakfu commented Oct 5, 2023

As per this stack overflow post the windows equivalent is os.path.join(sys.prefix, "libs") which on my windows machine gives:

>>> os.path.join(sys.prefix, "libs")
'C:\\Program Files\\Python311\\libs'

@isFakeAccount
Copy link
Contributor

isFakeAccount commented Feb 25, 2024

import sysconfig; print(sysconfig.get_config_var('LIBDIR'), end='') will also return None on windows.

@isFakeAccount
Copy link
Contributor

isFakeAccount commented Feb 29, 2024

os.path.join(sys.prefix, "libs") won't work if venv is active. sys.prefix returns venv path which does not contain libs directory.

I would recommend return os.path.join(get_config_var("installed_base"), "libs")

@gatesn
Copy link
Contributor

gatesn commented Feb 29, 2024

I suspect we can borrow a lot from how Maturin locates these directories? Although it looks like it has a big directory full of somewhat hard-coded sysconfigs?

@isFakeAccount
Copy link
Contributor

isFakeAccount commented Mar 1, 2024

I suspect we can borrow a lot from how Maturin locates these directories? Although it looks like it has a big directory full of somewhat hard-coded sysconfigs?

I assume you are talking about this https://github.com/PyO3/maturin/tree/main/sysconfig

which is most likely generated using this

https://github.com/python/cpython/blob/339c8e1c13adc299a0e2e49c93067e7817692380/Lib/sysconfig/__init__.py#L27

and you can see that they are using installed_base to setup a lot of paths. Not sure exactly why maturin hardcoded everything. Hardcoding also means increasing the package size unnecessarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants