Skip to content

Managed Python distribution missing os.getrandom #11811

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

Open
wbilal-c opened this issue Feb 26, 2025 · 1 comment
Open

Managed Python distribution missing os.getrandom #11811

wbilal-c opened this issue Feb 26, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@wbilal-c
Copy link

wbilal-c commented Feb 26, 2025

Summary

My actual system Python is 3.13.2. The Python environment I'm trying to install in my virtual environment is Python 3.12 with uv.

I've followed these steps:

uv python install "python3.12"
uv venv "virtualenv_dir" --python "3.12" --link-mode copy   
source virtualenv_dir/bin/activate 

This is my pyvenv.vfg file:

❯ cat pyvenv.cfg
home = /home/name/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/bin
implementation = CPython
uv = 0.6.2
version_info = 3.12.9
include-system-site-packages = false

Then when trying to see if os.getrandom is working in my activated virtual env:

❯ python
Python 3.12.9 (main, Feb  5 2025, 19:10:45) [Clang 19.1.6 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getrandom(256,1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'os' has no attribute 'getrandom'. Did you mean: 'urandom'?
>>> 

Checking HAVE_GETRANDOM as well:

❯ python
Python 3.12.9 (main, Feb  5 2025, 19:10:45) [Clang 19.1.6 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_vars("HAVE_GETRANDOM")
[0]

Is there a way to enable this option with uv?

Possible similar/related issue: #8429

Platform

6.12.10-arch1-1

Version

uv 0.6.2

Python version

Python 3.13.2

@wbilal-c wbilal-c added the bug Something isn't working label Feb 26, 2025
@zanieb
Copy link
Member

zanieb commented Feb 26, 2025

Looks like a duplicate of astral-sh/python-build-standalone#193

@zanieb zanieb changed the title Creating virtual env with uv on Arch Linux Managed Python distribution missing os.getrandom Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants