poetry icon indicating copy to clipboard operation
poetry copied to clipboard

`poetry install` authentication issue with http-basic private index (in devcontainer)

Open ckchow opened this issue 11 months ago • 11 comments

Description

Using poetry install in a context without a keyring backend (in this case a devcontainer), trying to pull packages from a private http-basic secured pypi, causes 401 unauthorized in the install process. poetry lock works, and certain GETs earlier in poetry install succeed as well.

devcontainer.json dockerfile.txt

Workarounds

PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install -vvv works

Poetry Installation Method

pipx

Operating System

Linux 43d0d0761105 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 22:39:36 UTC 2024 x86_64 GNU/Linux

Poetry Version

1.8.1, 1.7.1

Poetry Configuration

cache-dir = "/root/.cache/pypoetry"
experimental.new-installer = true
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.appml-pypi.url = "https://<redacted>/artifactory/api/pypi/appml-pypi/simple/"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /root/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true


### Python Sysconfig

```bash session
Platform: "linux-x86_64"
Python version: "3.8"
Current installation scheme: "posix_prefix"

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

Variables: 
        ABIFLAGS = ""
        AC_APPLE_UNIVERSAL_BUILD = "0"
        AIX_GENUINE_CPLUSPLUS = "0"
        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.8"
        BLDLIBRARY = "-L. -lpython3.8"
        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 = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration"
        CONFIGURE_CPPFLAGS = ""
        CONFIGURE_LDFLAGS = ""
        CONFIGURE_LDFLAGS_NODIST = ""
        CONFIG_ARGS = "'--build=x86_64-linux-gnu' '--enable-loadable-sqlite-extensions' '--enable-optimizations' '--enable-option-checking=fatal' '--enable-shared' '--with-system-expat' '--without-ensurepip' 'build_alias=x86_64-linux-gnu'"
        CONFINCLUDEDIR = "/usr/local/include"
        CONFINCLUDEPY = "/usr/local/include/python3.8"
        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.8 /usr/local/lib/python3.8/lib-dynload"
        DESTLIB = "/usr/local/lib/python3.8"
        DESTPATH = ""
        DESTSHARED = "/usr/local/lib/python3.8/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 = "no"
        EXE = ""
        EXEMODE = "755"
        EXTRATESTOPTS = ""
        EXTRA_CFLAGS = ""
        EXT_SUFFIX = ".cpython-38-x86_64-linux-gnu.so"
        FILEMODE = "644"
        FLOAT_WORDS_BIGENDIAN = "0"
        FLOCK_NEEDS_LIBBSD = "0"
        GETPGRP_HAVE_ARG = "0"
        GETTIMEOFDAY_NO_TZ = "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_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_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_GETTIMEOFDAY = "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_LINK = "1"
        HAVE_LINKAT = "1"
        HAVE_LINUX_CAN_BCM_H = "1"
        HAVE_LINUX_CAN_H = "1"
        HAVE_LINUX_CAN_RAW_FD_FRAMES = "1"
        HAVE_LINUX_CAN_RAW_H = "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_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_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_PUTENV = "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_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_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_STRDUP = "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_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_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_UNSETENV = "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_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_X509_VERIFY_PARAM_SET1_HOST = "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.8 /usr/local/include/python3.8"
        INCLUDEDIR = "/usr/local/include"
        INCLUDEPY = "/usr/local/include/python3.8"
        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.8.so.1.0"
        IO_H = "Modules/_io/_iomodule.h"
        IO_OBJS = "\"
        LDCXXSHARED = "g++ -shared"
        LDFLAGS = ""
        LDFLAGS_NODIST = ""
        LDLIBRARY = "libpython3.8.so"
        LDLIBRARYDIR = ""
        LDSHARED = "gcc -shared"
        LDVERSION = "3.8"
        LIBC = ""
        LIBDEST = "/usr/local/lib/python3.8"
        LIBDIR = "/usr/local/lib"
        LIBFFI_INCLUDEDIR = ""
        LIBM = "-lm"
        LIBOBJDIR = "Python/"
        LIBOBJS = ""
        LIBPC = "/usr/local/lib/pkgconfig"
        LIBPL = "/usr/local/lib/python3.8/config-3.8-x86_64-linux-gnu"
        LIBPYTHON = ""
        LIBRARY = "libpython3.8.a"
        LIBRARY_OBJS = "\"
        LIBRARY_OBJS_OMIT_FROZEN = "\"
        LIBS = "-lcrypt -ldl  -lm"
        LIBSUBDIRS = "tkinter tkinter/test tkinter/test/test_tkinter \"
        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.8"
        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/hashtable.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"
        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/parsetok.o Parser/tokenizer.o"
        PGO_PROF_GEN_FLAG = "-fprofile-generate"
        PGO_PROF_USE_FLAG = "-fprofile-use -fprofile-correction"
        POBJS = "\"
        POSIX_SEMAPHORES_NOT_ENABLED = "0"
        PROFILE_TASK = "-m test --pgo"
        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 = "python3"
        PYTHON_HEADERS = "\"
        PYTHON_OBJS = "\"
        PY_BUILTIN_MODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -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 = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -I./Include/internal"
        PY_COERCE_C_LOCALE = "1"
        PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -I./Include/internal -I. -I./Include -fPIC -DPy_BUILD_CORE"
        PY_CORE_LDFLAGS = ""
        PY_CPPFLAGS = "-I. -I./Include"
        PY_FORMAT_SIZE_T = ""z""
        PY_LDFLAGS = ""
        PY_LDFLAGS_NODIST = ""
        PY_SSL_DEFAULT_CIPHERS = "1"
        PY_SSL_DEFAULT_CIPHER_STRING = "0"
        PY_STDMODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration  -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"
        SGI_ABI = "@SGI_ABI@"
        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-38-x86_64-linux-gnu.so"
        SOABI = "cpython-38-x86_64-linux-gnu"
        SRCDIRS = "Parser Objects Python Modules Modules/_io Programs"
        SRC_GDB_HOOKS = "./Tools/gdb/libpython.py"
        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 = ""
        TCLTK_LIBS = ""
        TESTOPTS = ""
        TESTPATH = ""
        TESTPYTHON = "LD_LIBRARY_PATH=/usr/src/python ./python"
        TESTPYTHONOPTS = ""
        TESTRUNNER = "LD_LIBRARY_PATH=/usr/src/python ./python ./Tools/scripts/run_tests.py"
        TESTTIMEOUT = "1200"
        TIMEMODULE_LIB = "0"
        TIME_WITH_SYS_TIME = "1"
        TM_IN_SYS_TIME = "0"
        UNICODE_DEPS = "\"
        UNIVERSALSDK = ""
        UPDATE_FILE = "python3 ./Tools/scripts/update_file.py"
        USE_COMPUTED_GOTOS = "0"
        VERSION = "3.8"
        WINDOW_HAS_FLAGS = "1"
        WITH_DECIMAL_CONTEXTVAR = "1"
        WITH_DOC_STRINGS = "1"
        WITH_DTRACE = "0"
        WITH_DYLD = "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"
        prefix = "/usr/local"
        projectbase = "/usr/local/bin"
        py_version = "3.8.18"
        py_version_nodot = "38"
        py_version_short = "3.8"
        srcdir = "/usr/local/lib/python3.8/config-3.8-x86_64-linux-gnu"
        userbase = "/root/.local"

Example pyproject.toml

[[tool.poetry.source]]
name = "appml-pypi"
url = "https://<blah>/artifactory/api/pypi/appml-pypi/simple/"
priority = "primary"


[[tool.poetry.source]]
name = "PyPI"
priority = "explicit"

[tool.poetry.dependencies]
appml-lib = "0.5.1"
dbt-core = "^1.2.1"
python = "^3.8,<3.11"

Poetry Runtime Logs

beginning of poetry install -vvv

[urllib3.connectionpool] Starting new HTTPS connection (6): <redacted>
[urllib3.connectionpool] https://<redacted> "GET /artifactory/api/pypi/appml-pypi/simple/pyrsistent/ HTTP/1.1" 200 None

later

[urllib3.connectionpool] Starting new HTTPS connection (4): <redacted>
No suitable keyring backend found
No suitable keyring backends were found
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
[urllib3.connectionpool] Starting new HTTPS connection (5): <redacted>
[urllib3.connectionpool] Starting new HTTPS connection (6): <redacted>
[urllib3.connectionpool] <redacted> "GET /artifactory/api/pypi/appml-pypi/packages/packages/c0/7a/3da654f49c95d0cc6e9549a855b5818e66a917e852ec608e77550c8dc08b/setuptools-69.1.1-py3-none-any.whl HTTP/1.1" 401 91

ckchow avatar Feb 29 '24 23:02 ckchow

Perhaps your credentials have permissions in one of those places but not the other

Perhaps one of them is being answered from cache

Unless you can provide a way to reproduce this, it is unlikely that we can guess what you are seeing

dimbleby avatar Mar 01 '24 00:03 dimbleby

The credentials work on all the URLs listed, I tried them in my browser and was able to download the artifacts.

Probably not answered from cache, this behavior happens in a completely fresh python:3.8 docker container.

I was chatting in discord with abn and they mentioned that it might be possible to repro and test this with a devpi test fixture.

ckchow avatar Mar 01 '24 00:03 ckchow

Sure, if you can provide a repro that way, that works.

Lots of us use credentials for private repositories all the time, so I have to guess this is likely to be something specific to you.

I think there is a good chance you will find it difficult to set up a repro - but if so, hopefully in trying you will learn something about what it is that is unusual in your environment.

dimbleby avatar Mar 01 '24 00:03 dimbleby

Maybe it's washed out in the report details, but the fact that PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install works does feel like it's a keyring issue. I will see if I can repro in a hermetic environment if I get some free time.

ckchow avatar Mar 01 '24 00:03 ckchow

I can confirm we are also running into private package authentication issues in our CI pipeline runs. We have narrowed it down to poetry 1.8.x being the cause.

When we pin the poetry version to 1.7.1, it installs perfectly fine. But as soon as the version isn't pinned and the pipeline install poetry 1.8.x, then the authorization fails.

Please see below: This fails authentication when poetry 1.8.x is installed during the pipeline run

- task: PipAuthenticate@1
  displayName: 'Pip Authentication'
  inputs:
    artifactFeeds: '<feed_name>'
    onlyAddExtraIndex: true

- script: |
    curl -sSL https://install.python-poetry.org | python3 -
    export PATH=$PATH:$HOME/.poetry/bin
    export PAT=$(echo "$PIP_EXTRA_INDEX_URL" | sed -n 's/.*build:\([^@]*\)@.*/\1/p')
    poetry config http-basic.<source_name> $PAT ""
    poetry install
  displayName: 'Install dependencies'

image image

Work around: Pin the version of poetry to 1.7.1

- task: PipAuthenticate@1
  displayName: 'Pip Authentication'
  inputs:
    artifactFeeds: '<feed_name>'
    onlyAddExtraIndex: true

- script: |
    curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1
    export PATH=$PATH:$HOME/.poetry/bin
    export PAT=$(echo "$PIP_EXTRA_INDEX_URL" | sed -n 's/.*build:\([^@]*\)@.*/\1/p')
    poetry config http-basic.<source_name> $PAT ""
    poetry install
  displayName: 'Install dependencies'

image

Garett601 avatar Mar 05 '24 09:03 Garett601

This fails authentication when poetry 1.8.x is installed during the pipeline run

@Garett601 can you please provide the -vvv log please? The "Authorization error" seems to indicate the problem actually lies elsewhere and is a separate issue to that of what is reported here.

abn avatar Mar 05 '24 16:03 abn

We're seeing similar on v1.8.2, when installing locally on a Windows machine, trying to authenticate to an AWS CodeArtifact repo. I think it may have something to do with the length of the token provided by CodeArtifact (but this wasn't an issue with earlier Poetry versions).

If I specify the source as follows in pyproject.toml, then run 'poetry lock', then 'poetry install', I get the 401 issue:

[[tool.poetry.source]] name = "aws" url = "https://ourpypi-123456789012.aws_account_id.d.codeartifact.eu-west-2.amazonaws.com/pypi/ourpypi/simple/" priority = "primary"

I have tried this by passing creds via 'poetry config http-basic.aws aws $token', including with the keychain disabled, and as environment variables.

If instead I set the source as follows in pyproject.toml, then run 'poetry lock', then 'poetry install', it works:

[[tool.poetry.source]] name = "aws" url = "https://aws:[long_CodeArtifact_token]@ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com/pypi/ourpypi/simple/" priority = "primary"

NB The sha256 values of each package in the lock file do not change between the two variants of pyproject.toml following 'poetry lock'. They are valid. Only package.source.url varies.

The verbose logging for the error is:

PS C:\Code\xxx> poetry install -vvv Loading configuration file C:\Users\xxx\AppData\Roaming\pypoetry\config.toml Loading configuration file C:\Users\xxx\AppData\Roaming\pypoetry\auth.toml Adding repository aws (https://ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com/pypi/ourpypi/simple) and setting it as primary Deactivating the PyPI repository Using virtualenv: C:\Code\xxx.venv Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 54 installs, 0 updates, 0 removals, 1 skipped

  • Installing six (1.16.0): Pending... Creating new session for ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com [urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com:443 [urllib3:urllib3.connectionpool] https://ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com:443 "GET /pypi/ourpypi/simple/six/ HTTP/1.1" 200 None Creating new session for ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com [urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com:443 [urllib3:urllib3.connectionpool] https://ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com:443 "GET /pypi/ourpypi/simple/six/1.16.0/six-1.16.0-py2.py3-none-any.whl HTTP/1.1" 401 98
  • Installing six (1.16.0): Failed

Stack trace:

11 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:281 in _execute_operation 279│ 280│ try: → 281│ result = self._do_execute_operation(operation) 282│ except EnvCommandError as e: 283│ if e.e.returncode == -2:

10 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:391 in _do_execute_operation 389│ return 0 390│ → 391│ result: int = getattr(self, f"execute{method}")(operation) 392│ 393│ if result != 0:

9 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:516 in _execute_install 514│ 515│ def _execute_install(self, operation: Install | Update) -> int: → 516│ status_code = self._install(operation) 517│ 518│ self._save_url_reference(operation)

8 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:554 in _install 552│ archive = self._download_link(operation, Link(package.source_url)) 553│ else: → 554│ archive = self._download(operation) 555│ 556│ operation_message = self.get_operation_message(operation)

7 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:746 in _download 744│ self._yanked_warnings.append(message) 745│ → 746│ return self._download_link(operation, link) 747│ 748│ def _download_link(self, operation: Install | Update, link: Link) -> Path:

6 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:753 in _download_link 751│ # Get original package for the link provided 752│ download_func = functools.partial(self._download_archive, operation) → 753│ original_archive = self._artifact_cache.get_cached_archive_for_link( 754│ link, strict=True, download_func=download_func 755│ )

5 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\cache.py:272 in get_cached_archive_for_link 270│ cache_dir.mkdir(parents=True, exist_ok=True) 271│ try: → 272│ download_func(link.url, cached_archive) 273│ except BaseException: 274│ cached_archive.unlink(missing_ok=True)

4 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\executor.py:821 in _download_archive 819│ dest: Path, 820│ ) -> None: → 821│ downloader = Downloader(url, dest, self._authenticator) 822│ wheel_size = downloader.total_size 823│

3 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\helpers.py:177 in init 175│ headers = {"Accept-Encoding": "Identity"} 176│ → 177│ self._response = get( 178│ url, stream=True, headers=headers, timeout=REQUESTS_TIMEOUT 179│ )

2 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\authenticator.py:267 in get 265│ 266│ def get(self, url: str, **kwargs: Any) -> requests.Response: → 267│ return self.request("get", url, **kwargs) 268│ 269│ def head(self, url: str, **kwargs: Any) -> requests.Response:

1 ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\utils\authenticator.py:245 in request 243│ if resp.status_code not in STATUS_FORCELIST or is_last_attempt: 244│ if raise_for_status: → 245│ resp.raise_for_status() 246│ return resp 247│

HTTPError

401 Client Error: Unauthorized for url: https://ourpypi-123456789012.d.codeartifact.eu-west-2.amazonaws.com/pypi/ourpypi/simple/six/1.16.0/six-1.16.0-py2.py3-none-any.whl#sha256=8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254

at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\requests\models.py:1021 in raise_for_status 1017│ f"{self.status_code} Server Error: {reason} for url: {self.url}" 1018│ ) 1019│ 1020│ if http_error_msg: → 1021│ raise HTTPError(http_error_msg, response=self) 1022│ 1023│ def close(self): 1024│ """Releases the connection back to the pool. Once this method has been 1025│ called the underlying raw object must not be accessed again.

Cannot install six.

PSC-MM avatar Mar 18 '24 18:03 PSC-MM

We're seeing similar on v1.8.2, when installing locally on a Windows machine, trying to authenticate to an AWS CodeArtifact repo. I think it may have something to do with the length of the token provided by CodeArtifact (but this wasn't an issue with earlier Poetry versions).

I also thought this was the issue, and checked the PAT length as a debug step, and it did seem like an odd length (But this was the same as before and it works perfectly with poetry 1.7.1) image

Garett601 avatar Mar 19 '24 05:03 Garett601

Just to say that I got past this issue, for the time being, by uninstalling and reinstalling Poetry (current version, 1.8.2) on my Windows machine. I have successfully with both PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring (as per OP) and poetry config keyring.enabled false. Both result in the creds being stored in plaintext in auth.toml, which is fine for now.

It is just a suspicion and not something I can follow up on, but the trigger for this behaviour may have been when we tried authenticating to CodeArtifact with a token longer than allowed by keychain on Windows, which from one report is 1280 characters. Seems that CodeArtifact tokens are around 1400 chrs when authenticating via a role, vs ~1200 chrs when authenticating via a user. I saw the same behaviour then as described in this issue: https://github.com/python-poetry/poetry/issues/6597. Since then, and until reinstalling, this current issue has been in play.

PSC-MM avatar Mar 20 '24 09:03 PSC-MM

I encounter the same issue in a python:3.11.9 docker container with poetry installed via the install script. It works with poetry 1.7.1 but not with poetry 1.8.3. Any of the above workarounds do not work for me (setting PYTHON_KEYRING_BACKEND and poetry config keyring.enabled false).

bcvanmeurs avatar Jul 09 '24 11:07 bcvanmeurs

@Garett601 - perhaps your issue is the same as one that I've encountered. I see in your config you use an empty password:

poetry config http-basic.<source_name> $PAT ""

Gemfury recommends the same pattern (https://gemfury.com/help/errors/repo-url-password/) and my builds also started failing after upgrading to 1.8.

I set the token to the auth user via environment in our dockerfiles, and do not set a password:

# Export fury auth to poetry
ARG fury_auth
ENV POETRY_HTTP_BASIC_FURY_USERNAME ${fury_auth}

Seems to originate in e4cf21831d467d1369f52941f56c248ee0466871 where I think it is this change that is responsible for the difference.

Prior, if a username is set but no password, get_http_auth() would always return {"username": "whateverthetokenis", "password": None}, irrespective of whether a keyring backend is available:

https://github.com/python-poetry/poetry/blob/7243b94109a5185642a576a498d932ccc9e829f3/src/poetry/utils/password_manager.py#L205-L217

After, if no password is set and there is no keyring backend available, this method now returns None which means that the request runs without auth:

https://github.com/python-poetry/poetry/blob/e4cf21831d467d1369f52941f56c248ee0466871/src/poetry/utils/password_manager.py#L199-L214

My workaround is to set both the username and password for auth, which is also supported for my case.

peterschutt avatar Aug 02 '24 03:08 peterschutt