[PYTHON] I just did pip install pyrebase ... (UnicodeDecodeError)

Introduction

It all started when I decided to use firebase with flask and found a library called pyrebase that was convenient ~~ (?) ~~.

chapter: 1 ~ Omen ~

pip install at the anaconda prompt

(flask_env) C:\Users\ryosu\flask_project\auto_call_app>pip install pyrebase4
Collecting pyrebase4
  Using cached https://files.pythonhosted.org/packages/25/17/653e33c0f3d4fb6556570c955b9a298990dd515bbd09b1a2abc99ec7a9fa/Pyrebase4-4.3.0-py3-none-any.whl
Collecting pycryptodome>=3.6.4
  Using cached https://files.pythonhosted.org/packages/c8/a9/d65f44cdb4b44e05b494fa0bfed087105a706033644e5826c48d3c6ccfb8/pycryptodome-3.9.4-cp38-cp38-win_amd64.whl
Collecting python-jwt==2.0.1
  Using cached https://files.pythonhosted.org/packages/dd/2a/9c4230b09f63737e7beb34e3a19895cd50c5ff88af16d3cd54cd71e2325a/python_jwt-2.0.1-py2.py3-none-any.whl
Collecting requests>=2.19.1
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting requests-toolbelt>=0.7.1
  Using cached https://files.pythonhosted.org/packages/60/ef/7681134338fc097acef8d9b2f8abe0458e4d87559c689a8c306d0957ece5/requests_toolbelt-0.9.1-py2.py3-none-any.whl
Collecting oauth2client==4.1.2
  Using cached https://files.pythonhosted.org/packages/82/d8/3eab58811282ac7271a081ba5c0d4b875ce786ca68ce43e2a62ade32e9a8/oauth2client-4.1.2-py2.py3-none-any.whl
Collecting gcloud==0.18.3
  Using cached https://files.pythonhosted.org/packages/11/ab/d0cee58db2d8445c26e6f5db25d9b1f1aa14a3ab30eea8ce77ae808d10ef/gcloud-0.18.3.tar.gz
Collecting jws>=0.1.3
  Using cached https://files.pythonhosted.org/packages/01/9e/1536d578ed50f5fe8196310ddcc921a3cd8e973312d60ac74488b805d395/jws-0.1.3.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ryosu\Anaconda3\envs\flask_env\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ryosu\\AppData\\Local\\Temp\\pip-install-mp_hyf90\\jws\\setup.py'"'"'; __file__='"'"'C:\\Users\\ryosu\\AppData\\Local\\Temp\\pip-install-mp_hyf90\\jws\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\pip-egg-info'
         cwd: C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\setup.py", line 17, in <module>
        long_description=read('README.md'),
      File "C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\setup.py", line 5, in read
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    UnicodeDecodeError: 'cp932' codec can't decode byte 0x93 in position 502: illegal multibyte sequence
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

When I checked the error code for the time being, there was an article saying that it would be better to set sys.setdefaultencoding ('utf-8'), but it seems to be a module that can be used only in python2 series, and it is no longer in python3 series ...

chapter: 2 ~ To hell ~

If you look at the error statement again here

  Using cached https://files.pythonhosted.org/packages/11/ab/d0cee58db2d8445c26e6f5db25d9b1f1aa14a3ab30eea8ce77ae808d10ef/gcloud-0.18.3.tar.gz
Collecting jws>=0.1.3
  Using cached https://files.pythonhosted.org/packages/01/9e/1536d578ed50f5fe8196310ddcc921a3cd8e973312d60ac74488b805d395/jws-0.1.3.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ryosu\Anaconda3\envs\flask_env\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ryosu\\AppData\\Local\\Temp\\pip-install-mp_hyf90\\jws\\setup.py'"'"'; __file__='"'"'C:\\Users\\ryosu\\AppData\\Local\\Temp\\pip-install-mp_hyf90\\jws\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\pip-egg-info'
         cwd: C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\setup.py", line 17, in <module>
        long_description=read('README.md'),
      File "C:\Users\ryosu\AppData\Local\Temp\pip-install-mp_hyf90\jws\setup.py", line 5, in read
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    UnicodeDecodeError: 'cp932' codec can't decode byte 0x93 in position 502: illegal multibyte sequence
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

It seems that an error is appearing when installing jws, so when I did pip install jws, I got the same error, so after all it became ....

Looking at the error statement further, Return open (os.path" in jws \ setup.py, like File" C: \ Users \ ryosu \ AppData \ Local \ Temp \ pip-install-mp_hyf90 \ jws \ setup.py "You can see that the line .join (os.path.dirname (__ file__), fname)). read ()has ** UnicodeDecodeError **. If you check setup.py directly from jws github,

setup.py


import os
from setuptools import setup

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    name = "jws",
    version = "0.1.2",
    author = "Brian J Brennan",
    author_email = "[email protected]",
    description = ("JSON Web Signatures implementation in Python"),
    license = "MIT",
    keywords = "jws json web security signing",
    url = "http://github.com/brianlovesdata/python-jws",
    packages=['jws'],
    long_description=read('README.md'),
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Topic :: Utilities",
        "License :: OSI Approved :: MIT License",
    ],
    test_suite = 'nose.collector',
)

I was able to find it. To resolve the ** UnicodeDecodeError **, you should be able to specify the encoding and pip inastall it directly from github ...

chapter: 3 ~ And to the legend ~

Download jws as a zip file from github and return open (os.path.join (os.path.dirname (__file__)" in setup.py), fname)). Rewrite ()toreturn open (os.path.join (os.path.dirname (__ file__), fname), encoding ='utf-8_sig'). read (), error Looking at the statement again, it says Collecting jws> = 0.1.3, so I also set it asversion = "0.1.3".

When I put the rewritten jws into the newly created repository ... I was able to push firmly-> rewritten jws github Pip install this. To pip install directly from github, enter the github link like pip install git + https://github.com/kitarikes/jws4me.

$pip install git+https://github.com/kitarikes/jws4me
Collecting git+https://github.com/kitarikes/jws4me
  Cloning https://github.com/kitarikes/jws4me to c:\users\ryosu\appdata\local\temp\pip-req-build-lqn51ndb
  Running command git clone -q https://github.com/kitarikes/jws4me 'C:\Users\ryosu\AppData\Local\Temp\pip-req-build-lqn51ndb'
  Running command git submodule update --init --recursive -q
Building wheels for collected packages: jws
  Building wheel for jws (setup.py) ... done
  Created wheel for jws: filename=jws-0.1.3-cp38-none-any.whl size=9572 sha256=31bec145f3eb22bb415d4469f7c22914e333c3199114753d6154be320498537e
  Stored in directory: C:\Users\ryosu\AppData\Local\Temp\pip-ephem-wheel-cache-wm556ysw\wheels\8c\c9\43\5580c6dd5674d87b0619c3d91f0ec51398ed1dbd4274b0cda4
Successfully built jws
Installing collected packages: jws
  Found existing installation: jws 0.1.2
    Uninstalling jws-0.1.2:
      Successfully uninstalled jws-0.1.2
Successfully installed jws-0.1.3

Successfully installed jws-0.1.3 !!!! I was able to install it successfully. After pip install pyrebase4, pyrebase4 was successfully installed! (~~ I like 3 in the Dragon Quest series. Of course I also like # 5. ~~)

in conclusion

I've had a lot of trouble trying to install pyrebase, but it's okay because it's error tolerant again ... (I'm finally ready to work on flask ...)

(As an aside, after suffering from this error, I feel even more sad because I couldn't do Atcoder ABC 147 held today.)

Link

https://github.com/nhorvath/Pyrebase4 https://github.com/brianloveswords/python-jws

Recommended Posts

I just did pip install pyrebase ... (UnicodeDecodeError)
I got a UnicodeDecodeError when pip install on ubuntu
I was addicted to pip install mysqlclient
I want to pip install with PythonAnywhere
I can't install the package with pip.
I just did FizzBuzz with AWS Lambda
I can't install Dask with pip on Ubuntu
sudo pip install
Install pip on Mavericks
Install pip, pyenv, BeautifulSoup4
How to install pip
I can't install Anaconda!
Install the pip command
Install pip / pip3 on Ubuntu
Install scikit.learn with pip
When pip install fails
I have libncurses but get angry with pip install readline