如何从来源安装此Python软件包?
有一个nuscenes-devkit: https://github.com/nutonomy/nutonomy/nusonomy/nuscenes-devkit
我在私人存储库中进行了一些修改,并想从源头安装它,但我不能。
如果我进行pip install
ERROR: Command errored out with exit status 1:
command: /mnt/nvme1n1/venvs/enp2/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-wfs5ujhi/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-wfs5ujhi/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 /tmp/pip-req-build-wfs5ujhi/pip-egg-info
cwd: /tmp/pip-req-build-wfs5ujhi/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-wfs5ujhi/setup.py", line 5, in <module>
with open('../README.md', 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '../README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
。 vim ../ readme.md
来自同一文件夹。
更新:另外,我尝试了python setup.py install
从设置
文件夹。它有以下错误:
running install
running bdist_egg
running egg_info
writing python-sdk/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to python-sdk/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to python-sdk/nuscenes_devkit.egg-info/requires.txt
writing top-level names to python-sdk/nuscenes_devkit.egg-info/top_level.txt
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
upd2:我有Ubuntu 20.04 LTS,Python 3.8.10,PIP 22.1.2(为方便起见,我在Bastian Venthur的说明结束时检查了Python和Pip版本)。另外,我尝试在自己的虚拟环境中进行此操作,这也是使用Python Venv创建的。
UPD3:这是Bastian Venthur的答案中pip install -e
Obtaining file:///tmp/nuscenes-devkit/setup
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running egg_info
creating /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info
writing /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/SOURCES.txt'
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
。
Obtaining file:///tmp/nuscenes-devkit/setup
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/nuscenes-devkit/setup/setup.py'"'"'; __file__='"'"'/tmp/nuscenes-devkit/setup/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /tmp/nuscenes-devkit/setup/
Complete output (6 lines):
running egg_info
writing python-sdk/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to python-sdk/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to python-sdk/nuscenes_devkit.egg-info/requires.txt
writing top-level names to python-sdk/nuscenes_devkit.egg-info/top_level.txt
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
There is a nuScenes-devkit: https://github.com/nutonomy/nuscenes-devkit
I made some modifications in a private repository and want to install it from source but I can't.
If I do pip install .
from setup
folder, I have the following error:
ERROR: Command errored out with exit status 1:
command: /mnt/nvme1n1/venvs/enp2/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-wfs5ujhi/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-wfs5ujhi/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 /tmp/pip-req-build-wfs5ujhi/pip-egg-info
cwd: /tmp/pip-req-build-wfs5ujhi/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-wfs5ujhi/setup.py", line 5, in <module>
with open('../README.md', 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '../README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Although, README.md
certainly exists, I can check it by vim ../README.md
from the same folder.
UPD: Also I tried python setup.py install
from setup
folder. It has the following error:
running install
running bdist_egg
running egg_info
writing python-sdk/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to python-sdk/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to python-sdk/nuscenes_devkit.egg-info/requires.txt
writing top-level names to python-sdk/nuscenes_devkit.egg-info/top_level.txt
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
UPD2: I have Ubuntu 20.04 LTS, Python 3.8.10, pip 22.1.2 (for convenience, I checked Python and pip versions at the end of the instruction of Bastian Venthur). Also, I tried to do it in my own virtual environment, which is also created using python venv.
UPD3: Here is the full error from pip install -e .
from the answer of Bastian Venthur:
Obtaining file:///tmp/nuscenes-devkit/setup
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running egg_info
creating /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info
writing /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-02j0_bgt/nuscenes_devkit.egg-info/SOURCES.txt'
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Also, I tried to do it with sudo pip install -e .
:
Obtaining file:///tmp/nuscenes-devkit/setup
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/nuscenes-devkit/setup/setup.py'"'"'; __file__='"'"'/tmp/nuscenes-devkit/setup/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /tmp/nuscenes-devkit/setup/
Complete output (6 lines):
running egg_info
writing python-sdk/nuscenes_devkit.egg-info/PKG-INFO
writing dependency_links to python-sdk/nuscenes_devkit.egg-info/dependency_links.txt
writing requirements to python-sdk/nuscenes_devkit.egg-info/requires.txt
writing top-level names to python-sdk/nuscenes_devkit.egg-info/top_level.txt
error: package directory 'python-sdk/nuscenes_devkit/egg-info' does not exist
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
tl; dr:
在
nuscenes-devkit
存储库中使用以下内容创建一个setup.py
文件(然后,安装,运行pip install。来自根目录):
说明:
在虚拟环境中运行时,PIP复制包含
setup.py.py
脚本的目录到临时目录,并从那里运行安装。在nuscenes_devkit
中,python-sdk
目录是该项目的root软件包,因为它是setup 目录,因此,您将获得
filenotfounderror
。在任何情况下,在根目录中拥有
setup.py
脚本绝对是最佳实践(甚至更好的方法是使用setup.cfg
file,但这不在范围)。我个人认为,该问题应被视为
nuscenes-devkit
中的错误。因此,解决方案是将
setup.py
脚本移动到根目录并相应地对齐(我还利用setuptools.find_packages
来简化脚本)。最后注:您可以看一下高级安装 doc,那里的指令不提及
pip
或setup.py
,他们建议修改pythonpath
而不是。我个人不喜欢这种方法,但这可能是另一种解决方案。TL;DR:
Create a
setup.py
file in the root directory of thenuscenes-devkit
repository with the following content (then, to install, runpip install .
from the root directory):Explanation:
When running in a virtual environment, pip copies the directory that contains the
setup.py
script to a temporary directory and runs the installation from there. Innuscenes_devkit
, thepython-sdk
directory which is the root package of the project is not copied to this temporary directory since it's a sibling of thesetup
directory, hence, you get aFileNotFoundError
.At any case, having the
setup.py
script in the root directory is definitely the best practice (even better approach would be to usesetup.cfg
file but this is out of scope).I personally think this issue should be considered as a bug in
nuscenes-devkit
.So the solution is to move the
setup.py
script to the root directory and align it accordingly (I also took the liberty of usingsetuptools.find_packages
to simplify the script).Last note: You may take a look at the advanced installation doc, the instructions there doesn't mention
pip
orsetup.py
, they suggest modifyingPYTHONPATH
instead. I personally don't like this approach, but it may be an alternative solution.安装 nuscenes-devkit: -
通过pip: -
来自来源: -
Installing nuscenes-devkit :-
via pip:-
from source:-
这是对我有用的原因:
有时它有助于升级
pip
本身 执行pip pip install
dance:Here is what worked for me:
Sometimes it helps to upgrade
pip
itself before doing thepip install
dance:当我关注Guy Szweigman使用
setup.py.py
文件的答案时,我仍然在下面获取错误消息。如果这是Nuscenes-devkit或Setuptools的另一个错误,则可以理解。
When I follow guy szweigman's accepted answer using the
setup.py
file on top level, I still get the error message below.Insights appreciated if this is another error of nuscenes-devkit or of setuptools in general.