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

Question:

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>AppDataLocalpypoetryCachevirtualenvs

  AttributeError

  'PythonInfo' object has no attribute 'version_nodot'

  at ~AppDataRoamingpypoetryvenvlibsite-packagesvirtualenvcreatevia_global_refbuiltincpythoncpython3.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 pypoetryvenv 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.

Asked By: Huug.

||

Answers:

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

Answered By: Donnyvdm

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

Answered By: Erik Aronesty
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.