Huug.
Huug.

Reputation: 177

Poetry installs/adds fail with `'PythonInfo' object has no attribute 'version_nodot'` error?

I updated poetry to latest stable 1.1.14 release and immediately ran into some strange environment handling issues. Adding select packages (seemingly randomly, e.g. pandas and pynvim) fail with a 'PythonInfo' object has no attribute 'version_nodot' error, which renders poetry largely unusable.

Creating virtualenv testpoetry-g4SgMX0R-py3.8 in C:\Users\<username>\AppData\Local\pypoetry\Cache\virtualenvs

  AttributeError

  'PythonInfo' object has no attribute 'version_nodot'

  at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\virtualenv\create\via_global_ref\builtin\cpython\cpython3.py:122 in python_zip
      118│         "python{VERSION}.zip" and "python{VERSION}._pth" files. User can
      119│         move/rename *zip* file and edit `sys.path` by editing *_pth* file.
      120│         Here the `pattern` is used only for the default *zip* file name!
      121│         """
    → 122│         pattern = "*python{}.zip".format(interpreter.version_nodot)
      123│         matches = fnmatch.filter(interpreter.path, pattern)
      124│         matched_paths = map(Path, matches)
      125│         existing_paths = filter(method("exists"), matched_paths)
      126│         path = next(existing_paths, None)

Any idea what might be going wrong here or have the same/similar issue?

I've since updated to the --preview version of Poetry which now superficially respects my conda environment when forced to through the config option virtualenvs.prefer-active-python = true. But I say superficially, since it still seems to fail in the pypoetry\venv\ folder as in the trace above (not sure why it has to go there if it's operating in the conda env in the first place).

Any ideas more than welcome, thanks.

Upvotes: 2

Views: 1640

Answers (2)

Erik Aronesty
Erik Aronesty

Reputation: 12877

I ran into this as well. Happens as an interaction between poetry and virtualenv. This is, likely, a bug in your virtualenv, not poetry.

This can fix:

python -m virtualenv api -reset-app-data

See also:

https://github.com/pypa/virtualenv/issues/2367

Upvotes: 2

Donnyvdm
Donnyvdm

Reputation: 26

I had the exact same issue. This poetry update was actually the first time for me to use the new install script (curl -sSL https://install.python-poetry.org | python3 -).

When I encountered this issue I uninstalled using

curl -sSL https://install.python-poetry.org | python3 - --uninstall

and instead updated poetry with the previous install script:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

This fixed the issue for me, even with version 1.1.14 of poetry

Upvotes: 1

Related Questions