If I install my own package with pip, I get an error.

Asked 2 years ago, Updated 2 years ago, 50 views

I have several PCs, and I have created a Git repository with the main development PC project as my master, and I synchronize with git pull on another PC.
In the project folder of each PC, we create a virtual environment in venv and use the common folder name ENV in common.
To install your own packages in each virtual environment, run the following commands for each package:

 python-mpip install-e.

It can be installed on a development PC without any problems.
However, on the other PC (hereinafter referred to as PC1), the character code causes an error.
A markdown file with a description of each package is written in Japanese, which seems to be the target of the error.

PC1 Development How can I install my own package without character code errors like a PC?

Both the development PC and PC1 are:
Windows 10 Pro Python 3.9.10

 (ENV) PSC:\Users\> python-mpip install-e.
Obtaining file:// C:\Users\
  Preparing metadata (setup.py) ... error
  error —Subprocess-exited-with-error
  
  × python setup.py egg_infodid not run successfully.
  │ exit code: 1
  - - > [6 lines of output ]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setup tools-caller>", line 34, in<module>
        File "C:\Users\setup.py", line 13, in <module>
          long_description=open("README.md").read(),
      UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 34: illegal multibyte sequence
      [end of output]

  note —This error origin from a subprocess, and is likely not a problem with pip.
error:metadata-generation-failed

× Encounter error while generating package metadata.
- ->See above for output.

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

python python3 windows

2022-09-30 20:26

1 Answers

It was resolved by correcting the part you pointed out.

before modification:

long_description=open("README.md").read(),

modified:

long_description=open("README.md", encoding='UTF-8').read(),

setup.py

from setuptools import setup, find_packages

version = "1.0.0"

install_requires=[
    # Description of required dependent libraries, if any
]

setup(
    name = 'app',
    version = nversion,
    description="***",
    long_description=open("README.md", encoding='UTF-8').read(),
    long_description_content_type='text/markdown',
    author='Imagenics.co.,ltd',
    license='***',
    keywords='***',
    python_requires='>=3.6',
    packages = find_packages(),
    install_requires = install_requires,
)


2022-09-30 20:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.