Skip to content

UTF-8 path-chars Encoding Issue during poetry install #8550

@etaMS20

Description

@etaMS20
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Hello,

there seems to be an Issue with UTF-8 Encoding during dynamic installation process of packages.
My Path contains a special character (ä), seems like that caused the problem during reading from stdin (no encoding declared).
I know its bad practice to have that in path but i use a company domain and user-path is auto-set by windows during startup :<.

(I was able to bypass this issue by downgrading to poetry 1.5.1)

Trace back:

poetry install
Installing dependencies from lock file

Package operations: 69 installs, 1 update, 0 removals

  • Installing certifi (2023.7.22)
  • Installing charset-normalizer (3.3.0)
  • Installing idna (3.4)
  • Installing urllib3 (2.0.6)

  CalledProcessError

  Command '['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-']' returned non-zero exit status 1.

  at C:\Python\Lib\subprocess.py:571 in run
       567|             # We don't call process.wait() as .__exit__ does that for us.
       568|             raise
       569|         retcode = process.poll()
       570|         if check and retcode:
    >  571|             raise CalledProcessError(retcode, process.args,
       572|                                      output=stdout, stderr=stderr)
       573|     return CompletedProcess(process.args, retcode, stdout, stderr)
       574| 
       575| 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-'] errored with the following return code 1
  
  Error output:
  SyntaxError: Non-UTF-8 code starting with '\xe4' in file <stdin> on line 9, but no encoding declared; see https://peps.python.org/pep-0263/ for details
  
  
  Input:
  
  import importlib.util
  import json
  import sys
  
  from pathlib import Path
  
  spec = importlib.util.spec_from_file_location(
      "packaging", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\__init__.py")
  )
  packaging = importlib.util.module_from_spec(spec)
  sys.modules[spec.name] = packaging
  
  spec = importlib.util.spec_from_file_location(
      "packaging.tags", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\tags.py")
  )
  packaging_tags = importlib.util.module_from_spec(spec)
  spec.loader.exec_module(packaging_tags)
  
  print(
      json.dumps([(t.interpreter, t.abi, t.platform) for t in packaging_tags.sys_tags()])
  )
  

  at C:\Python\Lib\site-packages\poetry\utils\env\base_env.py:363 in _run
      359|                 output = subprocess.check_output(
      360|                     cmd, stderr=stderr, env=env, text=True, **kwargs
      361|                 )
      362|         except CalledProcessError as e:
    > 363|             raise EnvCommandError(e, input=input_)
      364| 
      365|         return output
      366| 
      367|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:


  CalledProcessError

  Command '['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-']' returned non-zero exit status 1.

  at C:\Python\Lib\subprocess.py:571 in run
       567|             # We don't call process.wait() as .__exit__ does that for us.
       568|             raise
       569|         retcode = process.poll()
       570|         if check and retcode:
    >  571|             raise CalledProcessError(retcode, process.args,
       572|                                      output=stdout, stderr=stderr)
       573|     return CompletedProcess(process.args, retcode, stdout, stderr)
       574| 
       575| 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-'] errored with the following return code 1
  
  Error output:
  SyntaxError: Non-UTF-8 code starting with '\xe4' in file <stdin> on line 9, but no encoding declared; see https://peps.python.org/pep-0263/ for details
  
  
  Input:
  
  import importlib.util
  import json
  import sys
  
  from pathlib import Path
  
  spec = importlib.util.spec_from_file_location(
      "packaging", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\__init__.py")
  )
  packaging = importlib.util.module_from_spec(spec)
  sys.modules[spec.name] = packaging
  
  spec = importlib.util.spec_from_file_location(
      "packaging.tags", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\tags.py")
  )
  packaging_tags = importlib.util.module_from_spec(spec)
  spec.loader.exec_module(packaging_tags)
  
  print(
      json.dumps([(t.interpreter, t.abi, t.platform) for t in packaging_tags.sys_tags()])
  )
  

  at C:\Python\Lib\site-packages\poetry\utils\env\base_env.py:363 in _run
      359|                 output = subprocess.check_output(
      360|                     cmd, stderr=stderr, env=env, text=True, **kwargs
      361|                 )
      362|         except CalledProcessError as e:
    > 363|             raise EnvCommandError(e, input=input_)
      364| 
      365|         return output
      366| 
      367|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:


  CalledProcessError

  Command '['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-']' returned non-zero exit status 1.

  at C:\Python\Lib\subprocess.py:571 in run
       567|             # We don't call process.wait() as .__exit__ does that for us.
       568|             raise
       569|         retcode = process.poll()
       570|         if check and retcode:
    >  571|             raise CalledProcessError(retcode, process.args,
       572|                                      output=stdout, stderr=stderr)
       573|     return CompletedProcess(process.args, retcode, stdout, stderr)
       574| 
       575| 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-'] errored with the following return code 1
  
  Error output:
  SyntaxError: Non-UTF-8 code starting with '\xe4' in file <stdin> on line 9, but no encoding declared; see https://peps.python.org/pep-0263/ for details
  
  
  Input:
  
  import importlib.util
  import json
  import sys
  
  from pathlib import Path
  
  spec = importlib.util.spec_from_file_location(
      "packaging", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\__init__.py")
  )
  packaging = importlib.util.module_from_spec(spec)
  sys.modules[spec.name] = packaging
  
  spec = importlib.util.spec_from_file_location(
      "packaging.tags", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\tags.py")
  )
  packaging_tags = importlib.util.module_from_spec(spec)
  spec.loader.exec_module(packaging_tags)
  
  print(
      json.dumps([(t.interpreter, t.abi, t.platform) for t in packaging_tags.sys_tags()])
  )
  

  at C:\Python\Lib\site-packages\poetry\utils\env\base_env.py:363 in _run
      359|                 output = subprocess.check_output(
      360|                     cmd, stderr=stderr, env=env, text=True, **kwargs
      361|                 )
      362|         except CalledProcessError as e:
    > 363|             raise EnvCommandError(e, input=input_)
      364| 
      365|         return output
      366| 
      367|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:


  CalledProcessError

  Command '['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-']' returned non-zero exit status 1.

  at C:\Python\Lib\subprocess.py:571 in run
       567|             # We don't call process.wait() as .__exit__ does that for us.
       568|             raise
       569|         retcode = process.poll()
       570|         if check and retcode:
    >  571|             raise CalledProcessError(retcode, process.args,
       572|                                      output=stdout, stderr=stderr)
       573|     return CompletedProcess(process.args, retcode, stdout, stderr)
       574| 
       575| 

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['C:\\Users\\MalvinSchädle\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\eta-control-fKGJYgDt-py3.11\\Scripts\\python.exe', '-I', '-W', 'ignore', '-'] errored with the following return code 1
  
  Error output:
  SyntaxError: Non-UTF-8 code starting with '\xe4' in file <stdin> on line 9, but no encoding declared; see https://peps.python.org/pep-0263/ for details
  
  
  Input:
  
  import importlib.util
  import json
  import sys
  
  from pathlib import Path
  
  spec = importlib.util.spec_from_file_location(
      "packaging", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\__init__.py")
  )
  packaging = importlib.util.module_from_spec(spec)
  sys.modules[spec.name] = packaging
  
  spec = importlib.util.spec_from_file_location(
      "packaging.tags", Path(r"C:\Users\MalvinSchädle\AppData\Roaming\Python\Python311\site-packages\packaging\tags.py")
  )
  packaging_tags = importlib.util.module_from_spec(spec)
  spec.loader.exec_module(packaging_tags)
  
  print(
      json.dumps([(t.interpreter, t.abi, t.platform) for t in packaging_tags.sys_tags()])
  )
  

  at C:\Python\Lib\site-packages\poetry\utils\env\base_env.py:363 in _run
      359|                 output = subprocess.check_output(
      360|                     cmd, stderr=stderr, env=env, text=True, **kwargs
      361|                 )
      362|         except CalledProcessError as e:
    > 363|             raise EnvCommandError(e, input=input_)
      364| 
      365|         return output
      366| 
      367|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions