poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Unable to run poetry shell command and create virtual environment

Open sravanpannala opened this issue 5 years ago • 2 comments

  • [ x] I am on the latest Poetry version.
  • [ x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • Windows 10 Enterprise 10.0.17134:
  • 1.1.7:
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

I am trying to create a new environment using poetry shell command after using poetry init. This is failing as it is detecting and trying to use an uninstalled version of miniconda. I removed all python installations from my computer, cleared the registry to solve this issue and it is recurring. I am unable to even start a virtual environment. Here is the error message:

EnvCommandError

  Command C:\Users\spannala\AppData\Local\pypoetry\Cache\virtualenvs\poetry-demo-vPxyddgv-py3.9\Scripts\python.exe - errored with the following return code 1, and output:
  Python path configuration:
    PYTHONHOME = (not set)
    PYTHONPATH = (not set)
    program name = 'C:\Users\spannala\AppData\Local\pypoetry\Cache\virtualenvs\poetry-demo-vPxyddgv-py3.9\Scripts\python.exe'
    isolated = 0
    environment = 1
    user site = 1
    import site = 1
    sys._base_executable = 'C:\\Users\\spannala\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\poetry-demo-vPxyddgv-py3.9\\Scripts\\python.exe'
    sys.base_prefix = ''
    sys.base_exec_prefix = ''
    sys.platlibdir = 'lib'
    sys.executable = 'C:\\Users\\spannala\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\poetry-demo-vPxyddgv-py3.9\\Scripts\\python.exe'
    sys.prefix = ''
    sys.exec_prefix = ''
    sys.path = [
      'C:\\Users\\spannala\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\poetry-demo-vPxyddgv-py3.9\\Scripts\\python39.zip',
      '.\\DLLs',
      '.\\lib',
      'c:\\users\\spannala\\miniconda3',
    ]
  Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
  Python runtime state: core initialized
  ModuleNotFoundError: No module named 'encodings'

  Current thread 0x00003dd4 (most recent call first):
  <no Python frame>
  input was : import sys

  if hasattr(sys, "real_prefix"):
      print(sys.real_prefix)
  elif hasattr(sys, "base_prefix"):
      print(sys.base_prefix)
  else:
      print(sys.prefix)


  at c:\users\spannala\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:1101 in _run
      1097│                 output = subprocess.check_output(
      1098│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1099│                 )
      1100│         except CalledProcessError as e:
    → 1101│             raise EnvCommandError(e, input=input_)
      1102│
      1103│         return decode(output)
      1104│
      1105│     def execute(self, bin, *args, **kwargs):

sravanpannala avatar Jun 29 '21 00:06 sravanpannala

This issue is solved after uninstalling and reinstalling poetry using pipx several times and restarting the pc.

sravanpannala avatar Jun 29 '21 03:06 sravanpannala

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Mar 02 '24 11:03 github-actions[bot]