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

Windows update breaks pipenv virtual environments creation #2983

Closed
alejmolinas opened this issue Oct 10, 2018 · 7 comments
Closed

Windows update breaks pipenv virtual environments creation #2983

alejmolinas opened this issue Oct 10, 2018 · 7 comments

Comments

@alejmolinas
Copy link

alejmolinas commented Oct 10, 2018

Issue description

> pipenv install and > pipenv --python 3 fails in a desktop folder after windows update.

Expected result

Creation of a virtual environment and installing all dependencies declared in Pipfile.lock

Actual result

> pipenv install
Traceback (most recent call last):
  File "c:\users\ale\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ale\AppData\Local\Programs\Python\Python36\Scripts\pipenv.exe\__main__.py", line 9, in <module>
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\cli\command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 1695, in do_install
    pypi_mirror=pypi_mirror,
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 561, in ensure_project
    pypi_mirror=pypi_mirror,
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 484, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 397, in ensure_python
    path_to_python = find_a_system_python(python)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 360, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 81, in find_python_version
    match = self.windows_finder.find_python_version(
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 49, in windows_finder
    self._windows_finder = WindowsFinder()
  File "<attrs generated init 87ada516ba10af7bd87735a5460aaaf86a1d070f>", line 13, in __init__
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 66, in get_versions
    path = ensure_path(install_path.__getattr__(""))
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
    raise AttributeError(attr)
AttributeError
> pipenv --python 3
*
* (Same as pipenv install)
 AttributeError

Steps to replicate

I was working on a project after updating windows and I wanted to test my configuration so I did
> pipenv --rm to delete my current environment. When I tried to use > pipenv install --dev I got that error.
I have already tried reinstalling pipenv and python and deleting all my site-packages.

It once let me create an environment in c:\\users\\ale, but not in other directories. I also tried > pipenv -support, but it failed at getting the python installations with the same error as always.
I again tested removing the environment and performing a > pipenv install but this time it failed.

After some testing I removed the Pipfile and Pipfile.lock in c:\\users\\ale and >pipenv install worked again but only in that directory as creating an empty folder in the desktop or other directories and executing pipenv install always fails with the same traceback.


Windows 10 Home: '1803 (OS build 17134.345)'

Pip version: '18.1'

Pipenv version: '2018.10.9'

Pipenv location: 'c:\\users\\ale\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\pipenv'

Python location: 'c:\\users\\ale\\appdata\\local\\programs\\python\\python36\\python.exe'

Python installations found:

Traceback (most recent call last):
 *
 * (Same error as above)
 *
  File "c:\users\ale\appdata\local\programs\python\python36\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
    raise AttributeError(attr)
AttributeError
@uranusjr
Copy link
Member

Can you help test if pep514tools works on your machine?

@alejmolinas
Copy link
Author

Yes, pep514tools works on my machine

>>> import pep514tools as pt
>>> list(pt.findall())
[<environment PythonCore\2.7>, <environment PythonCore\3.6>, <environment PythonCore\3.7>, <environment ContinuumAnalytics\Anaconda36-64>, <environment PythonCore\3.6>, <environment PythonCore\2.7>]

@rrwalton
Copy link

rrwalton commented Oct 20, 2018

I'm seeing the same problem:
Win 10 1803.
Python 3.7.0


pipenv install -e .
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\__main__.py", line 4, in <module>
    cli()
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\cli\command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 488, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 401, in ensure_python
    path_to_python = find_a_system_python(python)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\core.py", line 364, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 85, in find_python_version
    match = self.windows_finder.find_python_version(
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 53, in windows_finder
    self._windows_finder = WindowsFinder()
  File "<attrs generated init edcac9548e6d4740d95ac8fb7f6f80b602817da2>", line 13, in __init__
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 68, in get_versions
    py_version = PythonVersion.from_windows_launcher(version_object)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 182, in from_windows_launcher
    creation_dict = cls.parse(launcher_entry.info.version)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
    raise AttributeError(attr)
AttributeError: version

@techalchemy
Copy link
Member

These are not the same issue. Please fill out the full issue template.

@daniel-brosche
Copy link

I have a very similar issue using a fresh installed python 3.6 and also tried a fresh 3.7 on my windows 10 system:

pipenv install
Traceback (most recent call last):
  File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\Scripts\pipenv.exe\__main__.py", line 9, in <module>
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\program files\python36\lib\site-packages\pipenv\cli\command.py", line 249, in install
    editable_packages=state.installstate.editables,
  File "c:\program files\python36\lib\site-packages\pipenv\core.py", line 1724, in do_install
    pypi_mirror=pypi_mirror,
  File "c:\program files\python36\lib\site-packages\pipenv\core.py", line 565, in ensure_project
    pypi_mirror=pypi_mirror,
  File "c:\program files\python36\lib\site-packages\pipenv\core.py", line 488, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "c:\program files\python36\lib\site-packages\pipenv\core.py", line 401, in ensure_python
    path_to_python = find_a_system_python(python)
  File "c:\program files\python36\lib\site-packages\pipenv\core.py", line 364, in find_a_system_python
    python_entry = finder.find_python_version(line)
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 85, in find_python_version
    match = self.windows_finder.find_python_version(
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 53, in windows_finder
    self._windows_finder = WindowsFinder()
  File "<attrs generated init b2e341b0215e3c35e816b36d635b3aaaa24df2a7>", line 13, in __init__
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 66, in get_versions
    path = ensure_path(install_path.__getattr__(""))
  File "c:\program files\python36\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
    raise AttributeError(attr)
AttributeError

I have no clue how to fix that.

@Pierek
Copy link

Pierek commented Jun 26, 2019

Anyone still having this problem in 2018.11.26 version? I'm performing the same steps as @alejmolinas

@RayDragon
Copy link

RayDragon commented Nov 24, 2019

@Pierek , I was facing almost the same error, It was caused due to reinstall of python (removal of other python versions). I just tweeked it by:

( replace C:\mapps\python3.8\ to where your python is located )

in file

C:\mapps\python3.8\Lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py

change def getattr to by commenting the last return AttributeError ...

    def __getattr__(self, attr):
        if attr.startswith('_'):
            return object.__getattribute__(self, attr)

        if attr == 'value':
            attr = ''

        key = self._attr_to_key(attr)
        try:
            return self._d[key]
        except KeyError:
            pass
        except Exception:
            raise AttributeError(attr)
        print("Some error occured, continuing anyway ...", self._d, attr)
        # raise AttributeError(attr)

I guess we can revert the code back to original after single installation, since once I installed a pipenv the error was resolved

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

7 participants