Search code examples
pythoninstallationpip

Failed to install NRCLex


Used the following code to install NRCLex:

! pip install wheel
! pip install NRCLex

But result in:

Collecting NRCLex
  Using cached NRCLex-4.0-py3-none-any.whl (4.4 kB)
Requirement already satisfied: textblob in c:\python311\lib\site-packages (from NRCLex) (0.17.1)
INFO: pip is looking at multiple versions of nrclex to determine which version is compatible with other requirements. This could take a while.
  Using cached NRCLex-3.0.0.tar.gz (396 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\user\AppData\Local\Temp\pip-install-7hqwaka7\nrclex_fe003416b3ed450ab085f7a2d7febbb6\setup.py", line 9, in <module>
          long_description = fh.read()
                             ^^^^^^^^^
      UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position 687: illegal multibyte sequence
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Literally no idea what is going on right here. Googled for reasons but seems no one has ever encountered this problem before.


Solution

  • I solved it like this:

    Win + R -> cmd

    set PYTHONUTF8=1

    pip install NRCLex