简体   繁体   中英

python poetry installation failed on Windows 10 - no pyvenv.cfg file

I installed Python 3.9 using winget.

PS C:\Users\andre> winget list PythonSoftware
Name       ID                                                Version
-----------------------------------------------------------------------
Python 3.9 PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0 3.9.2544.0

I am trying to install poetry. Therefore, I downloaded the new installation script from https://install.python-poetry.org/ and run it within a Windows terminal. Here's the output:

PS C:\Users\andre\Downloads> python .\install-poetry.py
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Scripts

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.1.12)
Installing Poetry (1.1.12): Creating environment
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "C:\Users\andre\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
  Actual location:    "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "C:\Users\andre\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
  Actual location:    "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Installing Poetry (1.1.12): An error occurred. Removing partial environment.
Poetry installation failed.
See C:\Users\andre\Downloads\poetry-installer-error-bzs5mfpr.log for error logs.

And finally the output of the respective log file:

No pyvenv.cfg file


Traceback:

  File "C:\Users\andre\Downloads\install-poetry.py", line 872, in main
    return installer.run()
  File "C:\Users\andre\Downloads\install-poetry.py", line 503, in run
    self.install(version)
  File "C:\Users\andre\Downloads\install-poetry.py", line 524, in install
    with self.make_env(version) as env:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "C:\Users\andre\Downloads\install-poetry.py", line 596, in make_env
    raise e
  File "C:\Users\andre\Downloads\install-poetry.py", line 582, in make_env
    yield VirtualEnvironment.make(env_path)
  File "C:\Users\andre\Downloads\install-poetry.py", line 317, in make
    env.pip("install", "--disable-pip-version-check", "--upgrade", "pip")
  File "C:\Users\andre\Downloads\install-poetry.py", line 340, in pip
    return self.python("-m", "pip", "--isolated", *args, **kwargs)
  File "C:\Users\andre\Downloads\install-poetry.py", line 337, in python
    return self.run(self._python, *args, **kwargs)
  File "C:\Users\andre\Downloads\install-poetry.py", line 330, in run
    raise PoetryInstallationError(

Apparently, there's some issue with the place where Python has been installed, isn't it? How can I solve that issue?

This indeed is path issue with multiple versions of Python Installation, especially the version from Microsoft is not setting the path properly us the installer from https://www.python.org/downloads/ it fixes the error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM