'Problem installing my own package in Editable mode
I try to install my own package by using the command: pip install -e . but I get a very long error message which is attached at the end.
I tried to run the code on vscode and pycharm but the problem remains the same.
I started the package on a first computer which versions are:setuptools: 59.5.0 pip: 21.3.1 python: 3.9
On the second computer I had this problem.
Its versions are:setuptools: 58.1.0 pip: 21.2.4 python: 3.9
Then I tried on a fresh third computer with the same files and it worked just fine, versions:
setuptools: 47.1.0 pip: 20.1.1 python: 3.8
I'm attaching the relevant files that might be helpful in order to understand the issue.
The OS of all the computers is Windows, but the first and third are English version and the second computer is not. I think that maybe it is the problem, but I'm not sure and have no idea how to fix this if it is indeed the case here
setup.py:
from setuptools import setup
if __name__ == "__main__":
setup()
setup.cfg:
[metadata]
name=Mice
version=0.0.1
author=J. Random Hacker
[email protected]
[options]
packages=mice
install_requires=
typing_extensions >= 4.0.1
python_requires = >=3.6
package_dir =
=src
long_description=open('README.txt').read()
[options.extras_require]
testing =
pytest>=6.0
[options.package_data]
mice = py.typed
[flake8]
max-line-length=180
ignore=
F401 # A module has been imported but is not used anywhere in the file.
E302 # Two blank lines are expected between functions and classes.
The full error I'm getting is:
(myenv) D:\local_github\Mice>pip install -e .
Obtaining file:///D:/local_github/Mice
ERROR: Exception:
Traceback (most recent call last):
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
requirement_set = resolver.resolve(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 75, in resolve
collected = self.factory.collect_root_requirements(root_reqs)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 471, in collect_root_requirements
req = self._make_requirement_from_install_req(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 433, in _make_requirement_from_install_req
cand = self._make_candidate_from_link(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 189, in _make_candidate_from_link
self._editable_candidate_cache[link] = EditableCandidate(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 321, in __init__
super().__init__(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 227, in _prepare
dist = self._prepare_distribution()
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 331, in _prepare_distribution
return self._factory.preparer.prepare_editable_requirement(self._ireq)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\operations\prepare.py", line 622, in prepare_editable_requirement
dist = _get_prepared_distribution(
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\operations\prepare.py", line 60, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\distributions\sdist.py", line 34, in prepare_distribution_metadata
self._setup_isolation(finder)
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\distributions\sdist.py", line 61, in _setup_isolation
self.req.build_env = BuildEnvironment()
File "D:\local_github\Mice\myenv\lib\site-packages\pip\_internal\build_env.py", line 103, in __init__
fp.write(textwrap.dedent(
File "D:\yohai_new\python_folder\Python\Python39\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 589-591: character maps to <undefined>
Solution 1:[1]
The long_description key of setup.cfg is in the wrong section and its value is not valid.
It should be in the [metadata] section (not in [options]) and it should something like the following:
[metadata]
# ...
long_description = file: README.txt
long_description_content_type = text/plain
References:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
