问题
Trying to install a package, for example, pytorch
pip install torch
/ pip install -U torch
And I'm greeted with this
Collecting torch
Using cached torch-0.1.2.post2.tar.gz (128 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-35x5kco9\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-35x5kco9\\torch\\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\aissy\AppData\Local\Temp\pip-install-35x5kco9\torch\pip-egg-info'
cwd: C:\Users\aissy\AppData\Local\Temp\pip-install-35x5kco9\torch\
Complete output (30 lines):
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2811, in get_entry_map
ep_map = self._ep_map
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2769, in __getattr__
raise AttributeError(attr)
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\aissy\AppData\Local\Temp\pip-install-35x5kco9\torch\setup.py", line 265, in <module>
description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 133, in _install_setup_requires
(k, v) for k, v in attrs.items()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\dist.py", line 444, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 656, in <genexpr>
for entry in dist.get_entry_map(group).values()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2814, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2516, in parse_map
maps[group] = cls.parse_group(group, lines, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2494, in parse_group
ep = cls.parse(line, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2472, in parse
raise ValueError(msg, src)
ValueError: ("EntryPoint must be in 'name=module:attrs [extras]' format but got this instead json-server=json-server.cli:main", 'json-server=json-server.cli:main')
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
PS C:\Windows\system32> py -m pip install -u nltk
Usage:
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe -m pip install [options] <requirement specifier> [package-index-options] ...
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe -m pip install [options] [-e] <vcs project url> ...
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe -m pip install [options] [-e] <local project path> ...
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe -m pip install [options] <archive url/path> ...
no such option: -u
PS C:\Windows\system32> py -m pip install -U nltk Collecting nltk
Using cached nltk-3.5.zip (1.4 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-d1oaxx5q\\nltk\\setup.py'"'"'; __file__='"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-d1oaxx5q\\nltk\\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\aissy\AppData\Local\Temp\pip-install-d1oaxx5q\nltk\pip-egg-info'
cwd: C:\Users\aissy\AppData\Local\Temp\pip-install-d1oaxx5q\nltk\
Complete output (30 lines):
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2811, in get_entry_map
ep_map = self._ep_map
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2769, in __getattr__
raise AttributeError(attr)
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\aissy\AppData\Local\Temp\pip-install-d1oaxx5q\nltk\setup.py", line 112, in <module>
entry_points=console_scripts,
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 133, in _install_setup_requires
(k, v) for k, v in attrs.items()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\dist.py", line 444, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 656, in <genexpr>
for entry in dist.get_entry_map(group).values()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2814, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2516, in parse_map
maps[group] = cls.parse_group(group, lines, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2494, in parse_group
ep = cls.parse(line, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2472, in parse
raise ValueError(msg, src)
ValueError: ("EntryPoint must be in 'name=module:attrs [extras]' format but got this instead json-server=json-server.cli:main", 'json-server=json-server.cli:main')
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
PS C:\Windows\system32> py -m pip install pip Requirement already satisfied: pip in c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\site-packages (20.0.2)
PS C:\Windows\system32> py -m pip install pip==20.0.1 Collecting pip==20.0.1
Using cached pip-20.0.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.0.2
Uninstalling pip-20.0.2:
Successfully uninstalled pip-20.0.2
WARNING: The scripts pip.exe, pip3.7.exe and pip3.exe are installed in 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.0.1
PS C:\Windows\system32> py -m pip install pip==20.0.2 Collecting pip==20.0.2
Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.0.1
Uninstalling pip-20.0.1:
Successfully uninstalled pip-20.0.1
WARNING: The scripts pip.exe, pip3.7.exe and pip3.exe are installed in 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.0.2
PS C:\Windows\system32> py -m pip install torch Collecting torch
Using cached torch-0.1.2.post2.tar.gz (128 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-1ii8iy6m\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\aissy\\AppData\\Local\\Temp\\pip-install-1ii8iy6m\\torch\\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\aissy\AppData\Local\Temp\pip-install-1ii8iy6m\torch\pip-egg-info'
cwd: C:\Users\aissy\AppData\Local\Temp\pip-install-1ii8iy6m\torch\
Complete output (30 lines):
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2811, in get_entry_map
ep_map = self._ep_map
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2769, in __getattr__
raise AttributeError(attr)
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\aissy\AppData\Local\Temp\pip-install-1ii8iy6m\torch\setup.py", line 265, in <module>
description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 133, in _install_setup_requires
(k, v) for k, v in attrs.items()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\dist.py", line 444, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 656, in <genexpr>
for entry in dist.get_entry_map(group).values()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2814, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2516, in parse_map
maps[group] = cls.parse_group(group, lines, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2494, in parse_group
ep = cls.parse(line, dist)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pkg_resources\__init__.py", line 2472, in parse
raise ValueError(msg, src)
ValueError: ("EntryPoint must be in 'name=module:attrs [extras]' format but got this instead json-server=json-server.cli:main", 'json-server=json-server.cli:main')
-----------------------------------------
As what I believe json-server
's Entrypoint is causing the issue. As far as I'm aware, json-server
is not a python package but a CLI tool.
I'm assuming the -
in json-server=json-server.cli:main
as from what I read from this post
What can I do about it?
回答1:
There're two problems in the package.
The main importable directory is named json-server. It's a bug,
-
is forbidden in Python names. It must be renamed tojson_server
.The script is declared using that forbidden module. It must be fixed as
[tool.poetry.scripts]
json-server = "json_server.cli:main"
Please report these bugs.
来源:https://stackoverflow.com/questions/61423397/problems-with-entrypoints-from-other-packages-when-installing-package-through