5

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!

Federico Baù
  • 6,013
  • 5
  • 30
  • 38
Nomad_King
  • 51
  • 1
  • 2

3 Answers3

22

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

Adri
  • 251
  • 2
  • 4
  • you're a lifesaver man, but in my case psutil version 5.6.7 is no longer necessary. – Mark Jul 02 '21 at 04:40
4

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 find python-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.

Federico Baù
  • 6,013
  • 5
  • 30
  • 38
  • Hi Federico, I am trying your solution but I'm stuck at step 3. Do I have to change something in that script? I get the following error message when I try to run it: FileNotFoundError: [Errno 2] No such file or directory: 'python-stdnum-1.8.tar_.gz' – Nomad_King Feb 06 '21 at 15:36
  • @Nomad_King Check better Step 2, **Download the Zip in a folder, rename it from python-stdnum-1.8.tar.gz to python-stdnum-1.8.tar_.gz** Did you rename the folder adding the '_' at the end? – Federico Baù Feb 06 '21 at 16:49
  • This is only to avoid name collision, then in Step 5 you will output with the correct name **python-stdnum-1.8.tar.gz** if you follow the step there it should be to change any of my code. – Federico Baù Feb 06 '21 at 16:51
0

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.

  • Hi August, that worked perfectly. The only thing is that the module still asks me for the version 1.8. I do not seem to find this version as a whl file type. the only file type for version 1.8 on pypi.org, is the source file type. Is the installation for this file type the same? – Nomad_King Jan 21 '21 at 02:52
  • Hi,If you use source file,download [python-stdnum-1.8.tar.gz](https://files.pythonhosted.org/packages/89/ad/9388970542f82857ac2958b3eaddfad16caaf967cf8532e9486dedc69420/python-stdnum-1.8.tar.gz).Then unzip the file. First,use `python setup.py build`,second,use `python setup.py install`. –  Jan 21 '21 at 03:09
  • The second option with the install command, seemed to go well. However, there was a warning which tried to run a so called "install_lib" but couldn't install it. It gave the message: install_lib: 'build\lib' does not exist -- no python modules to install. Within my python module it still requires me the stdnum==1.8. – Nomad_King Jan 21 '21 at 03:22
  • It seems that the problem is caused by the old version and it is no longer maintained. This also explains why there is no whl file for python-stdnum 1.8. –  Jan 21 '21 at 03:38
  • @August I found a solution, in case someone needs to use version 1.8. It has to do with Windows – Federico Baù Jan 26 '21 at 06:28