简体   繁体   中英

UnicodeDecodeError: 'charmap' codec| Error during installation of pip python-stdnum==1.8

I am fairly new to programming, so please bear with me.

While I was installing some required packages for a module that I'm using, I wasn't able to install python-stdnum==1.8 .

I got the following error message:

File "C:\Users\59996\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 967: character maps to <undefined>
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Is there anything I can do to still be able to install the package?

Any help would be greatly appreciated. Thanks in advance!

If it's for the Odoo 14 install on Windows, the issue is in the "requirements.txt"

Change "python-stdnum==1.8" to "python-stdnum==1.8.1" (even if the answer of Federico Baù is working by the way)

then another issue will appear so change "psutil==5.6.6" to "psutil==5.6.7" still in the "requirements.txt"

source: https://github.com/odoo/odoo/issues/62919

Best regards

I ran to the same problem while installing Odoo Dependencies in Windows, but after some tacke I found a solution.

It's a old bug with stdnum 1.8 --> stdnum 1.8 installation fails on windows .

Solution

  1. Go to arthurdejong.org/python-stdnum/ and findpython-stdnum-1.8.tar.gz

  2. Download the Zip in a folder, rename it from python-stdnum-1.8.tar.gz to python-stdnum-1.8.tar_.gz (Just to avoid name collision).

  3. Then create the following Python Script (in the same directory):


import tarfile

def open_tarfile_function(tarfile_file_name):
    open_tarfile=tarfile.open("python-stdnum-1.8.tar_.gz")
    open_tarfile.extractall(path='stdnum')
    open_tarfile.close()

open_tarfile_function('data.tgz')

  1. It will create a folder named stdnum, open it and then open setup.py , go to line 37 and modify from this:

with open(os.path.join(base_dir, 'README'), 'r') as fp:
    long_description = fp.read()

To this:

with open(os.path.join(base_dir, 'README'), 'rb') as fp:
    long_description = fp.read().decode('utf-8')

Save it.

  1. Now in the same Directory run this code:

import tarfile
import os.path

def make_tarfile(output_filename, source_dir):
    with tarfile.open(output_filename, "w:gz") as tar:
        tar.add(source_dir, arcname=os.path.sep)

output_filename = "python-stdnum-1.8.tar.gz"
source_dir = "stdnum\python-stdnum-1.8"

make_tarfile(output_filename, source_dir)

  1. This will create file python-stdnum-1.8.tar.gz copy the Absolute Path

  2. Go to your Python Environment and run:


pip install D:\Odoo\Odoo_instance_one\python-stdnum-1.8.tar.gz

Obviously replace the Absolute Path with your absolute path.

First,you can use the online installation, use the command pip install python-stdnum==1.8 .

Second,you can download whl file of python-stdnum from here .

For example download to F:/file .

Then use command pip install F:/file/python_stdnum-1.15-py2.py3-none-any.whl to install.

python-stdnum 1.8 is the previous version, there is no corresponding whl file anymore.

In general, the previous version corresponds to the python version is relatively low, so if you use pip install python-stdnum==1.8 to install, there may be problems, because your current python is 3.7, which is relatively new.

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