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('"'"'rn'"'"', '"'"'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('"'"'rn'"'"', '"'"'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.
3
Answers
Installing nuscenes-devkit :-
via pip:-
from source:-
Here is what worked for me:
Sometimes it helps to upgrade
pip
itself before doing thepip install
dance: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.