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

Installation of URL dependencies can fail on the latest virtualenv version, in certain environments ('free_threaded' AttributeError) #10056

Closed
sirosen opened this issue Jan 15, 2025 · 11 comments

Comments

@sirosen
Copy link

sirosen commented Jan 15, 2025

In order to avoid new issues being created for this error message, if you are here searching for the error message please see #10056 (comment) for resolution.

This issue was caused because of the following;

  1. Poetry was installed to the same environment that it was managing.
  2. The managed project depends on a different version of virtualenv that what was already installed in the active virtualenv.

This is not a Poetry issue, but rather an issue caused by attempting to install Poetry in the same environment as it is managing. This is not recommended.


Description

I don't have a full reproducer yet, unfortunately. I have this bug in a closed-source context and haven't yet been able to recreate it.

Under the latest version of virtualenv, a new attribute was added to the PythonInfo class, free_threaded.
In my org's usage, we're seeing an invocation of virtualenv.cli_run which passes a PythonInfo object where free_threaded is not defined, causing an AttributeError from within virtualenv itself.

The conditions I have right now which cause this:

  • poetry 2.x
  • virtualenv==20.29.0
  • a URL dependency
    • that dependency points at an sdist containing a setup.py, not pyproject.toml
  • poetry 1.x metadata declaration (not yet upgraded)

However, trying to repro this in a fully open-source repo, I can't get the bug to trigger. So there may be important state I haven't captured.

Note

Without full info, this might not be possible to diagnose or resolve.
If the maintainers feel it would be best to close this as invalid, I'll continue to work on a reproducer so that I can open a fresh bug report with better detail.

I would understand that course of action and consider it reasonable if necessary, but hope that with the partial info in this report there's enough detail to find the cause.

Workarounds

  • pinning the project to poetry==1.8.5
  • pinning virtualenv in our build system to <20.29.0

Poetry Installation Method

pip

Operating System

Debian (docker, python3.10-slim-bookworm)

Poetry Version

4.0.1

Poetry Configuration

cache-dir = "/home/sirosen/.cache/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
repositories.test-pypi.url = "https://test.pypi.org/legacy/"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/sirosen/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

(NB: this is a local run; in the build system we expect a different home, etc.)

Python Sysconfig

sysconfig.log
Platform: "linux-x86_64"
Python version: "3.10"
Current installation scheme: "posix_prefix"

Paths:
  data = "/usr/local"
  include = "/usr/local/include/python3.10"
  platinclude = "/usr/local/include/python3.10"
  platlib = "/usr/local/lib/python3.10/site-packages"
  platstdlib = "/usr/local/lib/python3.10"
  purelib = "/usr/local/lib/python3.10/site-packages"
  scripts = "/usr/local/bin"
  stdlib = "/usr/local/lib/python3.10"

Variables:
  ABIFLAGS = ""
  AC_APPLE_UNIVERSAL_BUILD = "0"
  AIX_BUILDDATE = "0"
  AIX_GENUINE_CPLUSPLUS = "0"
  ALIGNOF_LONG = "8"
  ALIGNOF_SIZE_T = "8"
  ALT_SOABI = "0"
  ANDROID_API_LEVEL = "0"
  AR = "ar"
  ARFLAGS = "rcs"
  BASECFLAGS = "-Wno-unused-result -Wsign-compare"
  BASECPPFLAGS = ""
  BASEMODLIBS = ""
  BINDIR = "/usr/local/bin"
  BINLIBDEST = "/usr/local/lib/python3.10"
  BLDLIBRARY = "-L. -lpython3.10"
  BLDSHARED = "gcc -shared"
  BUILDEXE = ""
  BUILDPYTHON = "python"
  BUILD_GNU_TYPE = "x86_64-pc-linux-gnu"
  BYTESTR_DEPS = "\"
  CC = "gcc"
  CCSHARED = "-fPIC"
  CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall"
  CFLAGSFORSHARED = "-fPIC"
  CFLAGS_ALIASING = ""
  CFLAGS_NODIST = ""
  CONFIGFILES = "configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
  CONFIGURE_CFLAGS = ""
  CONFIGURE_CFLAGS_NODIST = "-fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden"
  CONFIGURE_CPPFLAGS = ""
  CONFIGURE_LDFLAGS = ""
  CONFIGURE_LDFLAGS_NODIST = "-fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g"
  CONFIG_ARGS = "'--build=x86_64-linux-gnu' '--enable-loadable-sqlite-extensions' '--enable-optimizations' '--enable-option-checking=fatal' '--enable-shared' '--with-lto' '--with-ensurepip' 'build_alias=x86_64-linux-gnu'"
  CONFINCLUDEDIR = "/usr/local/include"
  CONFINCLUDEPY = "/usr/local/include/python3.10"
  COREPYTHONPATH = ""
  COVERAGE_INFO = "/usr/src/python/coverage.info"
  COVERAGE_REPORT = "/usr/src/python/lcov-report"
  COVERAGE_REPORT_OPTIONS = "--no-branch-coverage --title "CPython lcov report""
  CPPFLAGS = "-I. -I./Include"
  CXX = "g++"
  DESTDIRS = "/usr/local /usr/local/lib /usr/local/lib/python3.10 /usr/local/lib/python3.10/lib-dynload"
  DESTLIB = "/usr/local/lib/python3.10"
  DESTPATH = ""
  DESTSHARED = "/usr/local/lib/python3.10/lib-dynload"
  DFLAGS = ""
  DIRMODE = "755"
  DIST = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummy"
  DISTDIRS = "Include Lib Misc Ext-dummy"
  DISTFILES = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
  DLINCLDIR = "."
  DLLLIBRARY = ""
  DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 = "0"
  DOUBLE_IS_BIG_ENDIAN_IEEE754 = "0"
  DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = "1"
  DTRACE = ""
  DTRACE_DEPS = "\"
  DTRACE_HEADERS = ""
  DTRACE_OBJS = ""
  DYNLOADFILE = "dynload_shlib.o"
  ENABLE_IPV6 = "1"
  ENSUREPIP = "upgrade"
  EXE = ""
  EXEMODE = "755"
  EXPERIMENTAL_ISOLATED_SUBINTERPRETERS = "0"
  EXPORTSFROM = ""
  EXPORTSYMS = ""
  EXTRATESTOPTS = ""
  EXTRA_CFLAGS = ""
  EXT_SUFFIX = ".cpython-310-x86_64-linux-gnu.so"
  FILEMODE = "644"
  FLOAT_WORDS_BIGENDIAN = "0"
  FLOCK_NEEDS_LIBBSD = "0"
  GETPGRP_HAVE_ARG = "0"
  GITBRANCH = ""
  GITTAG = ""
  GITVERSION = ""
  GNULD = "yes"
  HAVE_ACCEPT4 = "1"
  HAVE_ACOSH = "1"
  HAVE_ADDRINFO = "1"
  HAVE_ALARM = "1"
  HAVE_ALIGNED_REQUIRED = "0"
  HAVE_ALLOCA_H = "1"
  HAVE_ALTZONE = "0"
  HAVE_ASINH = "1"
  HAVE_ASM_TYPES_H = "1"
  HAVE_ATANH = "1"
  HAVE_BIND_TEXTDOMAIN_CODESET = "1"
  HAVE_BLUETOOTH_BLUETOOTH_H = "1"
  HAVE_BLUETOOTH_H = "0"
  HAVE_BROKEN_MBSTOWCS = "0"
  HAVE_BROKEN_NICE = "0"
  HAVE_BROKEN_PIPE_BUF = "0"
  HAVE_BROKEN_POLL = "0"
  HAVE_BROKEN_POSIX_SEMAPHORES = "0"
  HAVE_BROKEN_PTHREAD_SIGMASK = "0"
  HAVE_BROKEN_SEM_GETVALUE = "0"
  HAVE_BROKEN_UNSETENV = "0"
  HAVE_BUILTIN_ATOMIC = "1"
  HAVE_CHFLAGS = "0"
  HAVE_CHOWN = "1"
  HAVE_CHROOT = "1"
  HAVE_CLOCK = "1"
  HAVE_CLOCK_GETRES = "1"
  HAVE_CLOCK_GETTIME = "1"
  HAVE_CLOCK_SETTIME = "1"
  HAVE_CLOSE_RANGE = "1"
  HAVE_COMPUTED_GOTOS = "1"
  HAVE_CONFSTR = "1"
  HAVE_CONIO_H = "0"
  HAVE_COPYSIGN = "1"
  HAVE_COPY_FILE_RANGE = "1"
  HAVE_CRYPT_H = "1"
  HAVE_CRYPT_R = "1"
  HAVE_CTERMID = "1"
  HAVE_CTERMID_R = "0"
  HAVE_CURSES_FILTER = "1"
  HAVE_CURSES_H = "1"
  HAVE_CURSES_HAS_KEY = "1"
  HAVE_CURSES_IMMEDOK = "1"
  HAVE_CURSES_IS_PAD = "1"
  HAVE_CURSES_IS_TERM_RESIZED = "1"
  HAVE_CURSES_RESIZETERM = "1"
  HAVE_CURSES_RESIZE_TERM = "1"
  HAVE_CURSES_SYNCOK = "1"
  HAVE_CURSES_TYPEAHEAD = "1"
  HAVE_CURSES_USE_ENV = "1"
  HAVE_CURSES_WCHGAT = "1"
  HAVE_DECL_ISFINITE = "1"
  HAVE_DECL_ISINF = "1"
  HAVE_DECL_ISNAN = "1"
  HAVE_DECL_RTLD_DEEPBIND = "1"
  HAVE_DECL_RTLD_GLOBAL = "1"
  HAVE_DECL_RTLD_LAZY = "1"
  HAVE_DECL_RTLD_LOCAL = "1"
  HAVE_DECL_RTLD_MEMBER = "0"
  HAVE_DECL_RTLD_NODELETE = "1"
  HAVE_DECL_RTLD_NOLOAD = "1"
  HAVE_DECL_RTLD_NOW = "1"
  HAVE_DECL_TZNAME = "0"
  HAVE_DEVICE_MACROS = "1"
  HAVE_DEV_PTC = "0"
  HAVE_DEV_PTMX = "1"
  HAVE_DIRECT_H = "0"
  HAVE_DIRENT_D_TYPE = "1"
  HAVE_DIRENT_H = "1"
  HAVE_DIRFD = "1"
  HAVE_DLFCN_H = "1"
  HAVE_DLOPEN = "1"
  HAVE_DUP2 = "1"
  HAVE_DUP3 = "1"
  HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH = "0"
  HAVE_DYNAMIC_LOADING = "1"
  HAVE_ENDIAN_H = "1"
  HAVE_EPOLL = "1"
  HAVE_EPOLL_CREATE1 = "1"
  HAVE_ERF = "1"
  HAVE_ERFC = "1"
  HAVE_ERRNO_H = "1"
  HAVE_EVENTFD = "1"
  HAVE_EXECV = "1"
  HAVE_EXPLICIT_BZERO = "1"
  HAVE_EXPLICIT_MEMSET = "0"
  HAVE_EXPM1 = "1"
  HAVE_FACCESSAT = "1"
  HAVE_FCHDIR = "1"
  HAVE_FCHMOD = "1"
  HAVE_FCHMODAT = "1"
  HAVE_FCHOWN = "1"
  HAVE_FCHOWNAT = "1"
  HAVE_FCNTL_H = "1"
  HAVE_FDATASYNC = "1"
  HAVE_FDOPENDIR = "1"
  HAVE_FDWALK = "0"
  HAVE_FEXECVE = "1"
  HAVE_FINITE = "1"
  HAVE_FLOCK = "1"
  HAVE_FORK = "1"
  HAVE_FORKPTY = "1"
  HAVE_FPATHCONF = "1"
  HAVE_FSEEK64 = "0"
  HAVE_FSEEKO = "1"
  HAVE_FSTATAT = "1"
  HAVE_FSTATVFS = "1"
  HAVE_FSYNC = "1"
  HAVE_FTELL64 = "0"
  HAVE_FTELLO = "1"
  HAVE_FTIME = "1"
  HAVE_FTRUNCATE = "1"
  HAVE_FUTIMENS = "1"
  HAVE_FUTIMES = "1"
  HAVE_FUTIMESAT = "1"
  HAVE_GAI_STRERROR = "1"
  HAVE_GAMMA = "1"
  HAVE_GCC_ASM_FOR_MC68881 = "0"
  HAVE_GCC_ASM_FOR_X64 = "1"
  HAVE_GCC_ASM_FOR_X87 = "1"
  HAVE_GCC_UINT128_T = "1"
  HAVE_GETADDRINFO = "1"
  HAVE_GETC_UNLOCKED = "1"
  HAVE_GETENTROPY = "1"
  HAVE_GETGRGID_R = "1"
  HAVE_GETGRNAM_R = "1"
  HAVE_GETGROUPLIST = "1"
  HAVE_GETGROUPS = "1"
  HAVE_GETHOSTBYNAME = "0"
  HAVE_GETHOSTBYNAME_R = "1"
  HAVE_GETHOSTBYNAME_R_3_ARG = "0"
  HAVE_GETHOSTBYNAME_R_5_ARG = "0"
  HAVE_GETHOSTBYNAME_R_6_ARG = "1"
  HAVE_GETITIMER = "1"
  HAVE_GETLOADAVG = "1"
  HAVE_GETLOGIN = "1"
  HAVE_GETNAMEINFO = "1"
  HAVE_GETPAGESIZE = "1"
  HAVE_GETPEERNAME = "1"
  HAVE_GETPGID = "1"
  HAVE_GETPGRP = "1"
  HAVE_GETPID = "1"
  HAVE_GETPRIORITY = "1"
  HAVE_GETPWENT = "1"
  HAVE_GETPWNAM_R = "1"
  HAVE_GETPWUID_R = "1"
  HAVE_GETRANDOM = "1"
  HAVE_GETRANDOM_SYSCALL = "1"
  HAVE_GETRESGID = "1"
  HAVE_GETRESUID = "1"
  HAVE_GETSID = "1"
  HAVE_GETSPENT = "1"
  HAVE_GETSPNAM = "1"
  HAVE_GETWD = "1"
  HAVE_GLIBC_MEMMOVE_BUG = "0"
  HAVE_GRP_H = "1"
  HAVE_HSTRERROR = "1"
  HAVE_HTOLE64 = "1"
  HAVE_HYPOT = "1"
  HAVE_IEEEFP_H = "0"
  HAVE_IF_NAMEINDEX = "1"
  HAVE_INET_ATON = "1"
  HAVE_INET_PTON = "1"
  HAVE_INITGROUPS = "1"
  HAVE_INTTYPES_H = "1"
  HAVE_IO_H = "0"
  HAVE_IPA_PURE_CONST_BUG = "0"
  HAVE_KILL = "1"
  HAVE_KILLPG = "1"
  HAVE_KQUEUE = "0"
  HAVE_LANGINFO_H = "1"
  HAVE_LARGEFILE_SUPPORT = "0"
  HAVE_LCHFLAGS = "0"
  HAVE_LCHMOD = "0"
  HAVE_LCHOWN = "1"
  HAVE_LGAMMA = "1"
  HAVE_LIBDL = "1"
  HAVE_LIBDLD = "0"
  HAVE_LIBIEEE = "0"
  HAVE_LIBINTL_H = "1"
  HAVE_LIBREADLINE = "1"
  HAVE_LIBRESOLV = "0"
  HAVE_LIBSENDFILE = "0"
  HAVE_LIBUTIL_H = "0"
  HAVE_LIBUUID = "1"
  HAVE_LINK = "1"
  HAVE_LINKAT = "1"
  HAVE_LINUX_AUXVEC_H = "1"
  HAVE_LINUX_CAN_BCM_H = "1"
  HAVE_LINUX_CAN_H = "1"
  HAVE_LINUX_CAN_J1939_H = "1"
  HAVE_LINUX_CAN_RAW_FD_FRAMES = "1"
  HAVE_LINUX_CAN_RAW_H = "1"
  HAVE_LINUX_CAN_RAW_JOIN_FILTERS = "1"
  HAVE_LINUX_MEMFD_H = "1"
  HAVE_LINUX_NETLINK_H = "1"
  HAVE_LINUX_QRTR_H = "1"
  HAVE_LINUX_RANDOM_H = "1"
  HAVE_LINUX_TIPC_H = "1"
  HAVE_LINUX_VM_SOCKETS_H = "1"
  HAVE_LINUX_WAIT_H = "1"
  HAVE_LOCKF = "1"
  HAVE_LOG1P = "1"
  HAVE_LOG2 = "1"
  HAVE_LONG_DOUBLE = "1"
  HAVE_LSTAT = "1"
  HAVE_LUTIMES = "1"
  HAVE_MADVISE = "1"
  HAVE_MAKEDEV = "1"
  HAVE_MBRTOWC = "1"
  HAVE_MEMFD_CREATE = "1"
  HAVE_MEMORY_H = "1"
  HAVE_MEMRCHR = "1"
  HAVE_MKDIRAT = "1"
  HAVE_MKFIFO = "1"
  HAVE_MKFIFOAT = "1"
  HAVE_MKNOD = "1"
  HAVE_MKNODAT = "1"
  HAVE_MKTIME = "1"
  HAVE_MMAP = "1"
  HAVE_MREMAP = "1"
  HAVE_NCURSES_H = "1"
  HAVE_NDIR_H = "0"
  HAVE_NETPACKET_PACKET_H = "1"
  HAVE_NET_IF_H = "1"
  HAVE_NICE = "1"
  HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION = "0"
  HAVE_OPENAT = "1"
  HAVE_OPENPTY = "1"
  HAVE_PATHCONF = "1"
  HAVE_PAUSE = "1"
  HAVE_PIPE2 = "1"
  HAVE_PLOCK = "0"
  HAVE_POLL = "1"
  HAVE_POLL_H = "1"
  HAVE_POSIX_FADVISE = "1"
  HAVE_POSIX_FALLOCATE = "1"
  HAVE_POSIX_SPAWN = "1"
  HAVE_POSIX_SPAWNP = "1"
  HAVE_PREAD = "1"
  HAVE_PREADV = "1"
  HAVE_PREADV2 = "1"
  HAVE_PRLIMIT = "1"
  HAVE_PROCESS_H = "0"
  HAVE_PROTOTYPES = "1"
  HAVE_PTHREAD_CONDATTR_SETCLOCK = "1"
  HAVE_PTHREAD_DESTRUCTOR = "0"
  HAVE_PTHREAD_GETCPUCLOCKID = "1"
  HAVE_PTHREAD_H = "1"
  HAVE_PTHREAD_INIT = "0"
  HAVE_PTHREAD_KILL = "1"
  HAVE_PTHREAD_SIGMASK = "1"
  HAVE_PTY_H = "1"
  HAVE_PWRITE = "1"
  HAVE_PWRITEV = "1"
  HAVE_PWRITEV2 = "1"
  HAVE_READLINK = "1"
  HAVE_READLINKAT = "1"
  HAVE_READV = "1"
  HAVE_REALPATH = "1"
  HAVE_RENAMEAT = "1"
  HAVE_RL_APPEND_HISTORY = "1"
  HAVE_RL_CATCH_SIGNAL = "1"
  HAVE_RL_COMPLETION_APPEND_CHARACTER = "1"
  HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = "1"
  HAVE_RL_COMPLETION_MATCHES = "1"
  HAVE_RL_COMPLETION_SUPPRESS_APPEND = "1"
  HAVE_RL_PRE_INPUT_HOOK = "1"
  HAVE_RL_RESIZE_TERMINAL = "1"
  HAVE_ROUND = "1"
  HAVE_RTPSPAWN = "0"
  HAVE_SCHED_GET_PRIORITY_MAX = "1"
  HAVE_SCHED_H = "1"
  HAVE_SCHED_RR_GET_INTERVAL = "1"
  HAVE_SCHED_SETAFFINITY = "1"
  HAVE_SCHED_SETPARAM = "1"
  HAVE_SCHED_SETSCHEDULER = "1"
  HAVE_SEM_CLOCKWAIT = "1"
  HAVE_SEM_GETVALUE = "1"
  HAVE_SEM_OPEN = "1"
  HAVE_SEM_TIMEDWAIT = "1"
  HAVE_SEM_UNLINK = "1"
  HAVE_SENDFILE = "1"
  HAVE_SETEGID = "1"
  HAVE_SETEUID = "1"
  HAVE_SETGID = "1"
  HAVE_SETGROUPS = "1"
  HAVE_SETHOSTNAME = "1"
  HAVE_SETITIMER = "1"
  HAVE_SETLOCALE = "1"
  HAVE_SETPGID = "1"
  HAVE_SETPGRP = "1"
  HAVE_SETPRIORITY = "1"
  HAVE_SETREGID = "1"
  HAVE_SETRESGID = "1"
  HAVE_SETRESUID = "1"
  HAVE_SETREUID = "1"
  HAVE_SETSID = "1"
  HAVE_SETUID = "1"
  HAVE_SETVBUF = "1"
  HAVE_SHADOW_H = "1"
  HAVE_SHM_OPEN = "1"
  HAVE_SHM_UNLINK = "1"
  HAVE_SIGACTION = "1"
  HAVE_SIGALTSTACK = "1"
  HAVE_SIGFILLSET = "1"
  HAVE_SIGINFO_T_SI_BAND = "1"
  HAVE_SIGINTERRUPT = "1"
  HAVE_SIGNAL_H = "1"
  HAVE_SIGPENDING = "1"
  HAVE_SIGRELSE = "1"
  HAVE_SIGTIMEDWAIT = "1"
  HAVE_SIGWAIT = "1"
  HAVE_SIGWAITINFO = "1"
  HAVE_SNPRINTF = "1"
  HAVE_SOCKADDR_ALG = "1"
  HAVE_SOCKADDR_SA_LEN = "0"
  HAVE_SOCKADDR_STORAGE = "1"
  HAVE_SOCKETPAIR = "1"
  HAVE_SPAWN_H = "1"
  HAVE_SPLICE = "1"
  HAVE_SSIZE_T = "1"
  HAVE_STATVFS = "1"
  HAVE_STAT_TV_NSEC = "1"
  HAVE_STAT_TV_NSEC2 = "0"
  HAVE_STDARG_PROTOTYPES = "1"
  HAVE_STDINT_H = "1"
  HAVE_STDLIB_H = "1"
  HAVE_STD_ATOMIC = "1"
  HAVE_STRFTIME = "1"
  HAVE_STRINGS_H = "1"
  HAVE_STRING_H = "1"
  HAVE_STRLCPY = "0"
  HAVE_STROPTS_H = "0"
  HAVE_STRSIGNAL = "1"
  HAVE_STRUCT_PASSWD_PW_GECOS = "1"
  HAVE_STRUCT_PASSWD_PW_PASSWD = "1"
  HAVE_STRUCT_STAT_ST_BIRTHTIME = "0"
  HAVE_STRUCT_STAT_ST_BLKSIZE = "1"
  HAVE_STRUCT_STAT_ST_BLOCKS = "1"
  HAVE_STRUCT_STAT_ST_FLAGS = "0"
  HAVE_STRUCT_STAT_ST_GEN = "0"
  HAVE_STRUCT_STAT_ST_RDEV = "1"
  HAVE_STRUCT_TM_TM_ZONE = "1"
  HAVE_SYMLINK = "1"
  HAVE_SYMLINKAT = "1"
  HAVE_SYNC = "1"
  HAVE_SYSCONF = "1"
  HAVE_SYSEXITS_H = "1"
  HAVE_SYS_AUDIOIO_H = "0"
  HAVE_SYS_AUXV_H = "1"
  HAVE_SYS_BSDTTY_H = "0"
  HAVE_SYS_DEVPOLL_H = "0"
  HAVE_SYS_DIR_H = "0"
  HAVE_SYS_ENDIAN_H = "0"
  HAVE_SYS_EPOLL_H = "1"
  HAVE_SYS_EVENTFD_H = "1"
  HAVE_SYS_EVENT_H = "0"
  HAVE_SYS_FILE_H = "1"
  HAVE_SYS_IOCTL_H = "1"
  HAVE_SYS_KERN_CONTROL_H = "0"
  HAVE_SYS_LOADAVG_H = "0"
  HAVE_SYS_LOCK_H = "0"
  HAVE_SYS_MEMFD_H = "0"
  HAVE_SYS_MKDEV_H = "0"
  HAVE_SYS_MMAN_H = "1"
  HAVE_SYS_MODEM_H = "0"
  HAVE_SYS_NDIR_H = "0"
  HAVE_SYS_PARAM_H = "1"
  HAVE_SYS_POLL_H = "1"
  HAVE_SYS_RANDOM_H = "1"
  HAVE_SYS_RESOURCE_H = "1"
  HAVE_SYS_SELECT_H = "1"
  HAVE_SYS_SENDFILE_H = "1"
  HAVE_SYS_SOCKET_H = "1"
  HAVE_SYS_STATVFS_H = "1"
  HAVE_SYS_STAT_H = "1"
  HAVE_SYS_SYSCALL_H = "1"
  HAVE_SYS_SYSMACROS_H = "1"
  HAVE_SYS_SYS_DOMAIN_H = "0"
  HAVE_SYS_TERMIO_H = "0"
  HAVE_SYS_TIMES_H = "1"
  HAVE_SYS_TIME_H = "1"
  HAVE_SYS_TYPES_H = "1"
  HAVE_SYS_UIO_H = "1"
  HAVE_SYS_UN_H = "1"
  HAVE_SYS_UTSNAME_H = "1"
  HAVE_SYS_WAIT_H = "1"
  HAVE_SYS_XATTR_H = "1"
  HAVE_TCGETPGRP = "1"
  HAVE_TCSETPGRP = "1"
  HAVE_TEMPNAM = "1"
  HAVE_TERMIOS_H = "1"
  HAVE_TERM_H = "1"
  HAVE_TGAMMA = "1"
  HAVE_TIMEGM = "1"
  HAVE_TIMES = "1"
  HAVE_TMPFILE = "1"
  HAVE_TMPNAM = "1"
  HAVE_TMPNAM_R = "1"
  HAVE_TM_ZONE = "1"
  HAVE_TRUNCATE = "1"
  HAVE_TZNAME = "0"
  HAVE_UCS4_TCL = "0"
  HAVE_UNAME = "1"
  HAVE_UNISTD_H = "1"
  HAVE_UNLINKAT = "1"
  HAVE_USABLE_WCHAR_T = "0"
  HAVE_UTIL_H = "0"
  HAVE_UTIMENSAT = "1"
  HAVE_UTIMES = "1"
  HAVE_UTIME_H = "1"
  HAVE_UUID_CREATE = "0"
  HAVE_UUID_ENC_BE = "0"
  HAVE_UUID_GENERATE_TIME_SAFE = "1"
  HAVE_UUID_H = "0"
  HAVE_UUID_UUID_H = "1"
  HAVE_VFORK = "1"
  HAVE_WAIT3 = "1"
  HAVE_WAIT4 = "1"
  HAVE_WAITID = "1"
  HAVE_WAITPID = "1"
  HAVE_WCHAR_H = "1"
  HAVE_WCSCOLL = "1"
  HAVE_WCSFTIME = "1"
  HAVE_WCSXFRM = "1"
  HAVE_WMEMCMP = "1"
  HAVE_WORKING_TZSET = "1"
  HAVE_WRITEV = "1"
  HAVE_ZLIB_COPY = "1"
  HAVE__GETPTY = "0"
  HOST_GNU_TYPE = "x86_64-pc-linux-gnu"
  INCLDIRSTOMAKE = "/usr/local/include /usr/local/include /usr/local/include/python3.10 /usr/local/include/python3.10"
  INCLUDEDIR = "/usr/local/include"
  INCLUDEPY = "/usr/local/include/python3.10"
  INSTALL = "/usr/bin/install -c"
  INSTALL_DATA = "/usr/bin/install -c -m 644"
  INSTALL_PROGRAM = "/usr/bin/install -c"
  INSTALL_SCRIPT = "/usr/bin/install -c"
  INSTALL_SHARED = "/usr/bin/install -c -m 755"
  INSTSONAME = "libpython3.10.so.1.0"
  IO_H = "Modules/_io/_iomodule.h"
  IO_OBJS = "\"
  LDCXXSHARED = "g++ -shared"
  LDFLAGS = ""
  LDFLAGS_NODIST = ""
  LDLIBRARY = "libpython3.10.so"
  LDLIBRARYDIR = ""
  LDSHARED = "gcc -shared"
  LDVERSION = "3.10"
  LIBC = ""
  LIBDEST = "/usr/local/lib/python3.10"
  LIBDIR = "/usr/local/lib"
  LIBFFI_INCLUDEDIR = ""
  LIBM = "-lm"
  LIBOBJDIR = "Python/"
  LIBOBJS = ""
  LIBPC = "/usr/local/lib/pkgconfig"
  LIBPL = "/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu"
  LIBPYTHON = ""
  LIBRARY = "libpython3.10.a"
  LIBRARY_DEPS = "libpython3.10.a libpython3.10.so libpython3.so"
  LIBRARY_OBJS = "\"
  LIBRARY_OBJS_OMIT_FROZEN = "\"
  LIBS = "-lcrypt -ldl  -lm"
  LIBSUBDIRS = "asyncio \"
  LINKCC = "gcc"
  LINKFORSHARED = "-Xlinker -export-dynamic"
  LIPO_32BIT_FLAGS = ""
  LIPO_INTEL64_FLAGS = ""
  LLVM_PROF_ERR = "no"
  LLVM_PROF_FILE = ""
  LLVM_PROF_MERGER = "true"
  LN = "ln"
  LOCALMODLIBS = ""
  MACHDEP = "linux"
  MACHDEP_OBJS = ""
  MACHDESTLIB = "/usr/local/lib/python3.10"
  MACOSX_DEPLOYMENT_TARGET = ""
  MAINCC = "gcc"
  MAJOR_IN_MKDEV = "0"
  MAJOR_IN_SYSMACROS = "1"
  MAKESETUP = "./Modules/makesetup"
  MANDIR = "/usr/local/share/man"
  MKDIR_P = "/usr/bin/mkdir -p"
  MODBUILT_NAMES = "posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtype"
  MODDISABLED_NAMES = ""
  MODLIBS = ""
  MODOBJS = "Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/symtablemodule.o  Modules/xxsubtype.o"
  MODULE_OBJS = "\"
  MULTIARCH = "x86_64-linux-gnu"
  MULTIARCH_CPPFLAGS = "-DMULTIARCH=\"x86_64-linux-gnu\""
  MVWDELCH_IS_EXPRESSION = "1"
  NO_AS_NEEDED = "-Wl,--no-as-needed"
  OBJECT_OBJS = "\"
  OPENSSL_INCLUDES = ""
  OPENSSL_LDFLAGS = ""
  OPENSSL_LIBS = "-lssl -lcrypto"
  OPENSSL_RPATH = ""
  OPT = "-DNDEBUG -g -fwrapv -O3 -Wall"
  OTHER_LIBTOOL_OPT = ""
  PACKAGE_BUGREPORT = "0"
  PACKAGE_NAME = "0"
  PACKAGE_STRING = "0"
  PACKAGE_TARNAME = "0"
  PACKAGE_URL = "0"
  PACKAGE_VERSION = "0"
  PARSER_HEADERS = "\"
  PARSER_OBJS = "\ \ Parser/myreadline.o Parser/tokenizer.o"
  PEGEN_HEADERS = "\"
  PEGEN_OBJS = "\"
  PGO_PROF_GEN_FLAG = "-fprofile-generate"
  PGO_PROF_USE_FLAG = "-fprofile-use -fprofile-correction"
  PLATLIBDIR = "lib"
  POBJS = "\"
  POSIX_SEMAPHORES_NOT_ENABLED = "0"
  PROFILE_TASK = "-m test --pgo --timeout=1200"
  PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT = "1"
  PTHREAD_SYSTEM_SCHED_SUPPORTED = "1"
  PURIFY = ""
  PY3LIBRARY = "libpython3.so"
  PYLONG_BITS_IN_DIGIT = "0"
  PYTHON = "python"
  PYTHONFRAMEWORK = ""
  PYTHONFRAMEWORKDIR = "no-framework"
  PYTHONFRAMEWORKINSTALLDIR = ""
  PYTHONFRAMEWORKPREFIX = ""
  PYTHONPATH = ""
  PYTHON_FOR_BUILD = "./python -E"
  PYTHON_FOR_REGEN = ""
  PYTHON_HEADERS = "\"
  PYTHON_OBJS = "\"
  PY_BUILTIN_HASHLIB_HASHES = ""md5,sha1,sha256,sha512,sha3,blake2""
  PY_BUILTIN_MODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I. -I./Include -fPIC -DPy_BUILD_CORE_BUILTIN"
  PY_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall"
  PY_CFLAGS_NODIST = "-fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal"
  PY_COERCE_C_LOCALE = "1"
  PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I. -I./Include -fPIC -DPy_BUILD_CORE"
  PY_CORE_LDFLAGS = "-fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g"
  PY_CPPFLAGS = "-I. -I./Include"
  PY_ENABLE_SHARED = "1"
  PY_FORMAT_SIZE_T = ""z""
  PY_LDFLAGS = ""
  PY_LDFLAGS_NODIST = "-fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g"
  PY_SSL_DEFAULT_CIPHERS = "1"
  PY_SSL_DEFAULT_CIPHER_STRING = "0"
  PY_STDMODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I. -I./Include -fPIC"
  Py_DEBUG = "0"
  Py_ENABLE_SHARED = "1"
  Py_HASH_ALGORITHM = "0"
  Py_TRACE_REFS = "0"
  QUICKTESTOPTS = "-x test_subprocess test_io test_lib2to3 \"
  READELF = "readelf"
  RESSRCDIR = "Mac/Resources/framework"
  RETSIGTYPE = "void"
  RUNSHARED = "LD_LIBRARY_PATH=/usr/src/python"
  SCRIPTDIR = "/usr/local/lib"
  SETPGRP_HAVE_ARG = "0"
  SHELL = "/bin/sh"
  SHLIBS = "-lcrypt -ldl  -lm"
  SHLIB_SUFFIX = ".so"
  SHM_NEEDS_LIBRT = "0"
  SIGNED_RIGHT_SHIFT_ZERO_FILLS = "0"
  SITEPATH = ""
  SIZEOF_DOUBLE = "8"
  SIZEOF_FLOAT = "4"
  SIZEOF_FPOS_T = "16"
  SIZEOF_INT = "4"
  SIZEOF_LONG = "8"
  SIZEOF_LONG_DOUBLE = "16"
  SIZEOF_LONG_LONG = "8"
  SIZEOF_OFF_T = "8"
  SIZEOF_PID_T = "4"
  SIZEOF_PTHREAD_KEY_T = "4"
  SIZEOF_PTHREAD_T = "8"
  SIZEOF_SHORT = "2"
  SIZEOF_SIZE_T = "8"
  SIZEOF_TIME_T = "8"
  SIZEOF_UINTPTR_T = "8"
  SIZEOF_VOID_P = "8"
  SIZEOF_WCHAR_T = "4"
  SIZEOF__BOOL = "1"
  SO = ".cpython-310-x86_64-linux-gnu.so"
  SOABI = "cpython-310-x86_64-linux-gnu"
  SRCDIRS = "Parser Objects Python Modules Modules/_io Programs"
  SRC_GDB_HOOKS = "./Tools/gdb/libpython.py"
  STATIC_LIBPYTHON = "1"
  STDC_HEADERS = "1"
  STRICT_SYSV_CURSES = "/* Don't use ncurses extensions */"
  STRIPFLAG = "-s"
  SUBDIRS = ""
  SUBDIRSTOO = "Include Lib Misc"
  SYSLIBS = "-lm"
  SYS_SELECT_WITH_SYS_TIME = "1"
  TCLTK_INCLUDES = "-I/usr/include/tcl8.6"
  TCLTK_LIBS = "-ltk8.6 -ltkstub8.6 -ltcl8.6 -ltclstub8.6"
  TESTOPTS = ""
  TESTPATH = ""
  TESTPYTHON = "LD_LIBRARY_PATH=/usr/src/python ./python"
  TESTPYTHONOPTS = ""
  TESTRUNNER = "LD_LIBRARY_PATH=/usr/src/python ./python ./Tools/scripts/run_tests.py"
  TESTSUBDIRS = "ctypes/test \"
  TESTTIMEOUT = "1200"
  TEST_MODULES = "yes"
  THREAD_STACK_SIZE = "0"
  TIMEMODULE_LIB = "0"
  TIME_WITH_SYS_TIME = "1"
  TM_IN_SYS_TIME = "0"
  TZPATH = "/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo"
  UNICODE_DEPS = "\"
  UNIVERSALSDK = ""
  UPDATE_FILE = "./Tools/scripts/update_file.py"
  USE_COMPUTED_GOTOS = "0"
  VERSION = "3.10"
  WHEEL_PKG_DIR = ""
  WINDOW_HAS_FLAGS = "1"
  WITH_DECIMAL_CONTEXTVAR = "1"
  WITH_DOC_STRINGS = "1"
  WITH_DTRACE = "0"
  WITH_DYLD = "0"
  WITH_EDITLINE = "0"
  WITH_LIBINTL = "0"
  WITH_NEXT_FRAMEWORK = "0"
  WITH_PYMALLOC = "1"
  WITH_VALGRIND = "0"
  X87_DOUBLE_ROUNDING = "0"
  XMLLIBSUBDIRS = "xml xml/dom xml/etree xml/parsers xml/sax"
  abiflags = ""
  abs_builddir = "/usr/src/python"
  abs_srcdir = "/usr/src/python"
  base = "/usr/local"
  datarootdir = "/usr/local/share"
  exec_prefix = "/usr/local"
  installed_base = "/usr/local"
  installed_platbase = "/usr/local"
  platbase = "/usr/local"
  platlibdir = "lib"
  prefix = "/usr/local"
  projectbase = "/usr/local/bin"
  py_version = "3.10.16"
  py_version_nodot = "310"
  py_version_nodot_plat = ""
  py_version_short = "3.10"
  srcdir = "/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu"
  userbase = "/root/.local"

Example pyproject.toml

N/A: project is closed source and I don't have a working reproducer (yet).

Poetry Runtime Logs

I've redacted some names from the tail end of the log. I can't share full output until I have an open source reproducer.

poetry-runtime.log
--- Logging error ---
Traceback (most recent call last):
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_handler.py", line 22, in emit
  msg = self.format(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 943, in format
  return fmt.format(record)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_formatter.py", line 39, in format
  formatted = super().format(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 678, in format
  record.message = record.getMessage()
File "/usr/local/lib/python3.10/logging/__init__.py", line 368, in getMessage
  msg = msg % self.args
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py", line 270, in __str__
  (
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py", line 297, in spec
  # this method is not used by itself, so here and called functions can import stuff locally
AttributeError: 'PythonInfo' object has no attribute 'free_threaded'
Call stack:
File "/usr/local/lib/python3.10/threading.py", line 973, in _bootstrap
  self._bootstrap_inner()
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
  self.run()
File "/usr/local/lib/python3.10/threading.py", line 953, in run
  self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 83, in _worker
  work_item.run()
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
  result = self.fn(*self.args, **self.kwargs)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 274, in _execute_operation
  result = self._do_execute_operation(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 385, in _do_execute_operation
  result: int = getattr(self, f"_execute_{method}")(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 509, in _execute_install
  status_code = self._install(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 543, in _install
  archive = self._download_link(operation, Link(package.source_url))
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 714, in _download_link
  archive = self._chef.prepare(archive, output_dir=original_archive.parent)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 43, in prepare
  return self._prepare_sdist(archive, destination=output_dir)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 88, in _prepare_sdist
  return self._prepare(
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 49, in _prepare
  with isolated_builder(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
  return next(self.gen)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/isolated_build.py", line 180, in isolated_builder
  with ephemeral_environment(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
  return next(self.gen)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/env/__init__.py", line 47, in ephemeral_environment
  EnvManager.build_venv(
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/env/env_manager.py", line 552, in build_venv
  cli_result = virtualenv.cli_run(args, setup_logging=False)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 31, in cli_run
  of_session = session_via_cli(args, options, setup_logging, env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
  parser, elements = build_parser(args, options, setup_logging, env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 77, in build_parser
  parser._interpreter = interpreter = discover.interpreter  # noqa: SLF001
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter
  self._interpreter = self.run()
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py", line 60, in run
  result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py", line 81, in get_interpreter
  LOGGER.info("proposed %s", interpreter)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1477, in info
  self._log(INFO, msg, args, **kwargs)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1624, in _log
  self.handle(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1634, in handle
  self.callHandlers(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
  hdlr.handle(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 968, in handle
  self.emit(record)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_handler.py", line 30, in emit
  self.handleError(record)
Message: '<fg=blue>proposed %s</>'
Arguments: (PythonInfo({'platform': 'linux', 'implementation': 'CPython', 'version_info': VersionInfo(major=3, minor=10, micro=16, releaselevel='final', serial=0), 'architecture': 64, 'version_nodot': '310', 'version': '3.10.16 (main, Jan 14 2025, 02:25:17) [GCC 12.2.0]', 'os': 'posix', 'prefix': '/usr/local', 'base_prefix': '/usr/local', 'real_prefix': None, 'base_exec_prefix': '/usr/local', 'exec_prefix': '/usr/local', 'executable': '/usr/local/bin/python3.10', 'original_executable': '/usr/local/bin/python3.10', 'system_executable': '/usr/local/bin/python3.10', 'has_venv': True, 'path': ['/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages'], 'file_system_encoding': 'utf-8', 'stdout_encoding': 'utf-8', 'sysconfig_scheme': None, 'sysconfig_paths': {'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}', 'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}', 'purelib': '{base}/lib/python{py_version_short}/site-packages', 'platlib': '{platbase}/{platlibdir}/python{py_version_short}/site-packages', 'include': '{installed_base}/include/python{py_version_short}{abiflags}', 'scripts': '{base}/bin', 'data': '{base}'}, 'distutils_install': {'purelib': 'lib/python3.10/site-packages', 'platlib': 'lib/python3.10/site-packages', 'headers': 'include/python3.10/UNKNOWN', 'scripts': 'bin', 'data': ''}, 'sysconfig': {'makefile_filename': '/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile'}, 'sysconfig_vars': {'base': '/usr/local', 'abiflags': '', 'PYTHONFRAMEWORK': '', 'platlibdir': 'lib', 'platbase': '/usr/local', 'py_version_short': '3.10', 'installed_base': '/usr/local'}, 'system_stdlib': '/usr/local/lib/python3.10', 'system_stdlib_platform': '/usr/local/lib/python3.10', 'max_size': 9223372036854775807}),)

Stack trace:

19  .venv/lib/python3.10/site-packages/poetry/installation/executor.py:274 in _execute_operation
     272│
     273│             try:
   → 274│                 result = self._do_execute_operation(operation)
     275│             except EnvCommandError as e:
     276│                 if e.e.returncode == -2:

18  .venv/lib/python3.10/site-packages/poetry/installation/executor.py:385 in _do_execute_operation
     383│             return 0
     384│
   → 385│         result: int = getattr(self, f"_execute_{method}")(operation)
     386│
     387│         if result != 0:

17  .venv/lib/python3.10/site-packages/poetry/installation/executor.py:509 in _execute_install
     507│
     508│     def _execute_install(self, operation: Install | Update) -> int:
   → 509│         status_code = self._install(operation)
     510│
     511│         self._save_url_reference(operation)

16  .venv/lib/python3.10/site-packages/poetry/installation/executor.py:543 in _install
     541│         elif package.source_type == "url":
     542│             assert package.source_url is not None
   → 543│             archive = self._download_link(operation, Link(package.source_url))
     544│         else:
     545│             archive = self._download(operation)

15  .venv/lib/python3.10/site-packages/poetry/installation/executor.py:714 in _download_link
     712│             self._write(operation, message)
     713│
   → 714│             archive = self._chef.prepare(archive, output_dir=original_archive.parent)
     715│
     716│         # Use the original archive to provide the correct hash.

14  .venv/lib/python3.10/site-packages/poetry/installation/chef.py:43 in prepare
      41│             return self._prepare(archive, destination=destination, editable=editable)
      42│
   →  43│         return self._prepare_sdist(archive, destination=output_dir)
      44│
      45│     def _prepare(

13  .venv/lib/python3.10/site-packages/poetry/installation/chef.py:88 in _prepare_sdist
      86│             destination.mkdir(parents=True, exist_ok=True)
      87│
   →  88│             return self._prepare(
      89│                 sdist_dir,
      90│                 destination,

12  .venv/lib/python3.10/site-packages/poetry/installation/chef.py:49 in _prepare
      47│     ) -> Path:
      48│         distribution: DistributionType = "editable" if editable else "wheel"
   →  49│         with isolated_builder(
      50│             source=directory,
      51│             distribution=distribution,

11  /usr/local/lib/python3.10/contextlib.py:135 in __enter__
     133│         del self.args, self.kwds, self.func
     134│         try:
   → 135│             return next(self.gen)
     136│         except StopIteration:
     137│             raise RuntimeError("generator didn't yield") from None

10  .venv/lib/python3.10/site-packages/poetry/utils/isolated_build.py:180 in isolated_builder
     178│     )
     179│
   → 180│     with ephemeral_environment(
     181│         executable=python_executable,
     182│         flags={"no-pip": True},

 9  /usr/local/lib/python3.10/contextlib.py:135 in __enter__
     133│         del self.args, self.kwds, self.func
     134│         try:
   → 135│             return next(self.gen)
     136│         except StopIteration:
     137│             raise RuntimeError("generator didn't yield") from None

 8  .venv/lib/python3.10/site-packages/poetry/utils/env/__init__.py:47 in ephemeral_environment
      45│         # TODO: cache PEP 517 build environment corresponding to each project venv
      46│         venv_dir = Path(tmp_dir) / ".venv"
   →  47│         EnvManager.build_venv(
      48│             path=venv_dir,
      49│             executable=executable,

 7  .venv/lib/python3.10/site-packages/poetry/utils/env/env_manager.py:552 in build_venv
     550│         args.append(str(path))
     551│
   → 552│         cli_result = virtualenv.cli_run(args, setup_logging=False)
     553│
     554│         # Exclude the venv folder from from macOS Time Machine backups

 6  .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:31 in cli_run
      29│     """
      30│     env = os.environ if env is None else env
   →  31│     of_session = session_via_cli(args, options, setup_logging, env)
      32│     with of_session:
      33│         of_session.run()

 5  .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:49 in session_via_cli
      47│     """"""  # noqa: D205
      48│     env = os.environ if env is None else env
   →  49│     parser, elements = build_parser(args, options, setup_logging, env)
      50│     options = parser.parse_args(args)
      51│     creator, seeder, activators = tuple(e.create(options) for e in elements)  # create types

 4  .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:77 in build_parser
      75│
      76│     discover = get_discover(parser, args)
   →  77│     parser._interpreter = interpreter = discover.interpreter  # noqa: SLF001
      78│     if interpreter is None:
      79│         msg = f"failed to find interpreter for {discover}"

 3  .venv/lib/python3.10/site-packages/virtualenv/discovery/discover.py:41 in interpreter
      39│         """:return: the interpreter as returned by :meth:`run`, cached"""
      40│         if self._has_run is False:
   →  41│             self._interpreter = self.run()
      42│             self._has_run = True
      43│         return self._interpreter

 2  .venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py:60 in run
      58│     def run(self) -> PythonInfo | None:
      59│         for python_spec in self.python_spec:
   →  60│             result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
      61│             if result is not None:
      62│                 return result

 1  .venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py:82 in get_interpreter
      80│             continue
      81│         LOGGER.info("proposed %s", interpreter)
   →  82│         if interpreter.satisfies(spec, impl_must_match):
      83│             LOGGER.debug("accepted %s", interpreter)
      84│             return interpreter

AttributeError

'PythonSpec' object has no attribute 'free_threaded'

at .venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py:335 in satisfies
    331│                 return False
    332│         return True
    333│
    334│     _current_system = None
  → 335│     _current = None
    336│
    337│     @classmethod
    338│     def current(cls, app_data=None):
    339│         """

Cannot install REDACTED_PACKAGE_NAME_HERE
@sirosen sirosen added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 15, 2025
@dimbleby
Copy link
Contributor

probably just a bug in the latest virtualenv, you should report it to them

@sirosen
Copy link
Author

sirosen commented Jan 15, 2025

I don't think so, although I could be mistaken. I've read the virtualenv changes in the last release, and they appear correct to me.

If you look at those changes, free_threaded is a new attribute added on a virtualenv-internal object (PythonInfo). The code there doesn't expect an outside library to use its internal interfaces, but something happens under poetry such that an object which was not built by virtualenv is getting passed.

Poetry is using virtualenv.cli_run, and doesn't appear to be violating any virtualenv contracts in an obvious way, but the fact that there's an object being passed without this attribute is fairly suspicious. I've been unable to reproduce this bug without using poetry, but (per the issue) I haven't had a very consistent experience reproducing the bug in any context other than the original build system (where it is very reproducible).

@dimbleby
Copy link
Contributor

virtualenv has a cache, I expect there is a cached thing somewhere that does not have the new field. You should report this to them.

@abn
Copy link
Member

abn commented Jan 16, 2025

@sirosen I'd advice that you consider not using pip to install Poetry. Try using pipx or use the installer. Right now the likely culprit is that you have a system installed virtualenv that is causing you headaches.

Unable to reproduce this.

podman run --rm -i --entrypoint bash docker.io/python:3.10-slim-bookworm <<EOF
set -xe
# using pip here for simplicity  (not recommended)
python -m pip install --disable-pip-version-check --root-user-action ignore -q poetry

poetry new foobar
pushd foobar

# using pre-commit as an example as it uses setup.py
poetry add https://files.pythonhosted.org/packages/2e/c8/e22c292035f1bac8b9f5237a2622305bc0304e776080b246f3df57c4ff9f/pre_commit-4.0.1.tar.gz
EOF
+ poetry add https://files.pythonhosted.org/packages/2e/c8/e22c292035f1bac8b9f5237a2622305bc0304e776080b246f3df57c4ff9f/pre_commit-4.0.1.tar.gz
Creating virtualenv foobar-lWDpn5M1-py3.10 in /root/.cache/pypoetry/virtualenvs

Updating dependencies
Resolving dependencies...

Package operations: 9 installs, 0 updates, 0 removals

  - Installing distlib (0.3.9)
  - Installing filelock (3.16.1)
  - Installing platformdirs (4.3.6)
  - Installing cfgv (3.4.0)
  - Installing identify (2.6.5)
  - Installing nodeenv (1.9.1)
  - Installing pyyaml (6.0.2)
  - Installing virtualenv (20.29.0)
  - Installing pre-commit (4.0.1 https://files.pythonhosted.org/packages/2e/c8/e22c292035f1bac8b9f5237a2622305bc0304e776080b246f3df57c4ff9f/pre_commit-4.0.1.tar.gz)

Writing lock file

@dimbleby
Copy link
Contributor

dimbleby commented Jan 16, 2025

the problem will be what I already said: on the system with a problem there is a virtualenv cache that contains an object without the new field, and the updated code does not cope with that

once more: this is a virtualenv bug and should be reported there

@abn
Copy link
Member

abn commented Jan 16, 2025

dimbleby, I am sure you might be right there about the root cause. But I am definitely curious how the cache is impacting it inside a container (assuming a clean container).

@dimbleby
Copy link
Contributor

I haven't had a very consistent experience reproducing the bug in any context other than the original build system

Presumably not a clean container

@FeodorFitsner
Copy link

We are getting 'PythonSpec' object has no attribute 'free_threaded' error with virtualenv==20.29.0 in CI environment: https://ci.appveyor.com/project/flet-dev/flet/builds/51334223/job/k1fkp5yd6w5xndip#L1941

Pinning to the previous virtualenv==20.28.1 fixes issue.

@sirosen
Copy link
Author

sirosen commented Jan 16, 2025

I've been digging around and I can easily imagine that this is related to a cache load -- the virtualenv cache loading code includes a usage result.__dict__ = data.copy() which feels like it's implicated -- but I'm also pretty sure that this requires parallel invocations of virtualenv.cli_run. More on that below.

It is starting from a clean container -- and if I stop the build before the relevant stage where poetry install runs, I see no cache contents.

One very interesting thing I've found is that the application itself seems to depend through some chain on virtualenv==20.28.1 -- so that is getting installed into the same virtualenv as poetry itself during the build. (Because this app is not isolating itself from poetry properly.)

Fixing the lack of isolation between poetry and the project environment fixes the issue; i.e. this diff is sufficient:

-RUN python -m venv .venv \
-    && .venv/bin/python -m pip install 'poetry==2.0.1'
- RUN .venv/bin/poetry install
+RUN python -m venv .poetry-venv \
+    && .poetry-venv/bin/python -m pip install 'poetry==2.0.1'
+RUN .poetry-venv/bin/poetry install -vv

So I think that what's happening is that the lack of isolation causes a conflict between simultaneous invocations of multiple virtualenv versions on the same environment. One invocation populates the cache with the freshly installed (old) version, and the other loads from it.

I now have enough data, even sans a clear reproducer (which continues to elude me), that I feel like I can bring a bug report to virtualenv and explain what I'm seeing.

I leave it to the poetry devs to decide whether or not this scenario is sufficiently far outside of the bounds of what is supported that this can be closed. It seems to require that you mix your app venv with the poetry venv, which is inherently fragile.

@abn
Copy link
Member

abn commented Jan 16, 2025

@sirosen as described in https://python-poetry.org/docs/#installation,

Poetry should always be installed in a dedicated virtual environment to isolate it from the rest of your system. Each of the above described installation methods ensures that. It should in no case be installed in the environment of the project that is to be managed by Poetry. This ensures that Poetry’s own dependencies will not be accidentally upgraded or uninstalled. In addition, the isolated virtual environment in which poetry is installed should not be activated for running poetry commands.

@FeodorFitsner it looks like you are doing something similar as well, ie. reusing the same Python environment for both Poetry and your app.

  - Installing uvicorn (0.33.0)
  - Downgrading virtualenv (20.29.0 -> 20.28.1)
  - Installing watchdog (4.0.2)

Closing as this is not a Poetry issue.

@abn abn closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@FeodorFitsner
Copy link

Makes sense! Will re-do CI to install Poetry into separate env. Thank you guys!

@abn abn removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 16, 2025
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

4 participants