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

PosixPath' object has no attribute 'strip' since 2023.11.14 on Python 3.11.6 #6016

Closed
jan-kantert opened this issue Nov 15, 2023 · 5 comments · Fixed by #6017
Closed

PosixPath' object has no attribute 'strip' since 2023.11.14 on Python 3.11.6 #6016

jan-kantert opened this issue Nov 15, 2023 · 5 comments · Fixed by #6017
Labels
PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. Type: Regression This issue is a regression of a previous behavior.

Comments

@jan-kantert
Copy link

Issue description

Starting with 2023.11.14 we get an error in pipenv in all our python builds (Linux on upstream python 3.11 container) and locally on Linux/Mac.

Expected result

pipenv install . succeeds as in 2023.10.24.

Actual result

pipenv crashes:

⠸ Locking...
✔ Success!
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/command.py", line 209, in install
    do_install(
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/install.py", line 297, in do_install
    raise e
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/install.py", line 281, in do_install
    do_init(
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/install.py", line 672, in do_init
    do_lock(
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/lock.py", line 65, in do_lock
    venv_resolve_deps(
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 875, in venv_resolve_deps
    return prepare_lockfile(
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/locking.py", line 140, in prepare_lockfile
    lockfile_entry = get_locked_dep(project, dep, pipfile, current_entry)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/locking.py", line 123, in get_locked_dep
    lockfile_entry = clean_resolved_dep(project, dep, is_top_level, current_entry)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/dependencies.py", line 277, in clean_resolved_dep
    potential_hashes = unearth_hashes_for_dep(project, dep)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/dependencies.py", line 189, in unearth_hashes_for_dep
    install_req, markers, _ = install_req_from_pipfile(dep["name"], dep)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/dependencies.py", line 1097, in install_req_from_pipfile
    install_req, _ = expansive_install_req_from_line(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/dependencies.py", line 954, in expansive_install_req_from_line
    pip_line = pip_line.strip("'").lstrip(" ")
               ^^^^^^^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'strip'

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

Run pipenv install ..

Pipfile:

cat Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.11"

setup.py:

from setuptools import setup, find_packages

setup(
    name='xxx',
    version='0.1',

    packages=find_packages('app'),
    package_dir={'': 'app'},
    include_package_data=True,

    install_requires=(
        'Flask==3.0.0',
        'Flask-Login==0.6.3',
        'flask-oidc-ext==1.4.5',
        'Flask-Session==0.5.0',
        'Flask-WTF==1.2.1',
        'Flask-Bootstrap==3.3.7.1',
        'Werkzeug==3.0.1',
        'chardet==5.2.0',
        'cryptography==41.0.5',
        'gunicorn==21.2.0',
        'pyOpenSSL==23.3.0',
        'PyJWT[crypto]==2.8.0',
        'requests==2.31.0',
        'requests_pkcs12==1.22',
        'sqlite3dict==1.0.1',
        'pem==23.1.0',
        'tabulate==0.9.0',
        'setuptools==68.2.2',
        'pyjks==20.0.0',
        'itsdangerous>=2.1.2,<2.2',
    )
)

$ pipenv --support

Pipenv version: '2023.11.14'

Pipenv location: '/usr/local/lib/python3.11/site-packages/pipenv'

Python location: '/usr/local/opt/python@3.11/bin/python3.11'

OS Name: 'posix'

User pip version: '23.3.1'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.6',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '22.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 22.6.0: Fri Sep 15 13:39:52 PDT '
                     '2023; root:xnu-8796.141.3.700.8~1/RELEASE_X86_64',
 'python_full_version': '3.11.6',
 'python_version': '3.11',
 'sys_platform': 'darwin'}

System environment variables:

  • TERM_SESSION_ID
  • SSH_AUTH_SOCK
  • LC_TERMINAL_VERSION
  • COLORFGBG
  • ITERM_PROFILE
  • XPC_FLAGS
  • LANG
  • PWD
  • SHELL
  • __CFBundleIdentifier
  • SECURITYSESSIONID
  • TERM_PROGRAM_VERSION
  • TERM_PROGRAM
  • PATH
  • LC_TERMINAL
  • COLORTERM
  • COMMAND_MODE
  • TERM
  • HOME
  • TMPDIR
  • USER
  • XPC_SERVICE_NAME
  • LOGNAME
  • LaunchInstanceID
  • __CF_USER_TEXT_ENCODING
  • ITERM_SESSION_ID
  • SHLVL
  • OLDPWD
  • P9K_TTY
  • _P9K_TTY
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • LS_COLORS
  • P9K_SSH
  • KUBE_EDITOR
  • KOPS_STATE_STORE
  • AWS_PROFILE
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/opt/python@3.8/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/xxx/.krew/bin:/Users/xxx/.cargo/bin:/Users/xxx/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/xxx/.local/bin
  • SHELL: /bin/zsh
  • LANG: de_DE.UTF-8
  • PWD: /Users/xxx/src/xxx/xxx

Contents of Pipfile ('/Users/xxx/src/xxx/xxx/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.11"

This also happens on a freshly installed pipenv in Docker on all of our projects. Downgrade fixes it.

@jan-kantert jan-kantert changed the title PosixPath' object has no attribute 'strip' 2023.11.14 on Python 3.11.6 PosixPath' object has no attribute 'strip' since 2023.11.14 on Python 3.11.6 Nov 15, 2023
@matteius
Copy link
Member

Will take a look tonight.

@ericmanyc
Copy link

ericmanyc commented Nov 15, 2023

+1 getting the same error on Python 3.10.13

@matteius
Copy link
Member

Hey, I am checking on the tests now and if I can add a unit test for this -- it was reproducible locally. This branch fixed it for me if you have a moment to double confirm: #6017

@matteius
Copy link
Member

Verifiable test case added.

@matteius matteius added PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. Type: Regression This issue is a regression of a previous behavior. labels Nov 15, 2023
@matteius
Copy link
Member

Just pushed the release -- the unit test gave increased confidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. Type: Regression This issue is a regression of a previous behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants