Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package dependencies #2013

Merged
merged 24 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-base-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
. ${{env.venv_dir}}/bin/activate
pip install --upgrade pip
pip install wheel==0.38.4
pip install -e .[camera_obs,opendrive,test,test_notebook,torch,train,gym,argoverse]
pip install -e .[camera_obs,opendrive,test,test_notebook,torch,train,gym,argoverse,envision]
if echo ${{matrix.tests}} | grep -q -e "env" -e "examples"; then pip install -e .[rllib]; fi
if echo ${{matrix.tests}} | grep -q "/ray"; then pip install -e .[ray]; fi
- name: Run smoke tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-base-tests-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
pip install --upgrade pip
pip install wheel==0.38.4
pip install -r utils/setup/mac_requirements.txt
pip install -e .[camera_obs,opendrive,rllib,test,test_notebook,torch,train,argoverse]
pip install -e .[camera_obs,opendrive,rllib,test,test_notebook,torch,train,argoverse,envision]
if echo ${{matrix.tests}} | grep -q -e "/env" -e "/examples"; then pip install -e .[rllib]; fi
if echo ${{matrix.tests}} | grep -q "/ray"; then pip install -e .[ray]; fi
- name: Run smoke tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
. ${{env.venv_dir}}/bin/activate
pip install --upgrade pip "setuptools<58.3.0"
pip install wheel==0.38.4
pip install .[camera_obs,doc,train,ray]
pip install .[camera_obs,doc,train,ray,envision,argoverse,opendrive,waymo]
saulfield marked this conversation as resolved.
Show resolved Hide resolved
cd ${GITHUB_WORKSPACE}/docs
make html SPHINXOPTS="-W -T -E --keep-going"
- name: Check build output
Expand All @@ -105,4 +105,4 @@ jobs:
else
echo "Sphinx build failed."
exit 1
fi
fi
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ Copy and pasting the git commit messages is __NOT__ enough.
### Changed
- Changed waypoints in sumo maps to use more incoming lanes into junctions.
- Increased the cutoff radius for filtering out waypoints that are too far away in junctions in sumo maps.
- Made Envision dependencies optional. Use `pip install -e .[envision]` to install them.
saulfield marked this conversation as resolved.
Show resolved Hide resolved
- Made Waymo dependencies optional. Use `pip install -e .[waymo]` to install them.
### Deprecated
### Fixed
- Fixed implementations of `RoadMap.waypoint_paths()` to ensure that the result is never empty.
### Removed
- Removed the following dependencies from smarts: `pandas`, `rich`, `twisted`, `sh`.
### Security

## [1.1.0] # 2023-04-28
Expand Down
4 changes: 2 additions & 2 deletions cli/envision.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# THE SOFTWARE.
import click

from envision.server import run


@click.group(
name="envision",
Expand All @@ -43,6 +41,8 @@ def envision_cli():
type=float,
)
def start_server(port, max_capacity):
from envision.server import run

run(max_capacity_mb=max_capacity, port=port)


Expand Down
8 changes: 6 additions & 2 deletions cli/waymo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import click
import tableprint as tp

from smarts.waymo import waymo_utils


@click.group(
name="waymo",
Expand All @@ -40,6 +38,8 @@ def waymo_cli():
"tfrecord_file", type=click.Path(exists=True), metavar="<tfrecord_file>"
)
def overview(tfrecord_file: str):
from smarts.waymo import waymo_utils

scenarios = waymo_utils.get_tfrecord_info(tfrecord_file)
rows = [
[k, v["timestamps"], v["vehicles"], v["pedestrians"]]
Expand Down Expand Up @@ -79,6 +79,8 @@ def preview(
animate: bool,
label_vehicles: bool,
):
from smarts.waymo import waymo_utils

waymo_utils.plot_scenario(tfrecord_file, scenario_id, animate, label_vehicles)


Expand All @@ -97,6 +99,8 @@ def export(
scenario_id: str,
export_folder: str,
):
from smarts.waymo import waymo_utils

scenario_folder = os.path.join(export_folder, scenario_id)
if not os.path.exists(scenario_folder):
os.makedirs(scenario_folder)
Expand Down
1 change: 0 additions & 1 deletion cli/zoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from pathlib import Path

import click
from rich import print


@click.group(name="zoo", help="Build, install, or instantiate workers.")
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@
"mdutils",
"moviepy",
"opendrive2lanelet",
"pandas",
"pathos",
"PIL",
"pynput",
"ray",
"rich",
"tabulate",
"tools",
"torch",
Expand Down
9 changes: 8 additions & 1 deletion envision/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@
from typing import Any, Optional, Union

import numpy as np
import websocket

try:
import websocket
except:
raise ImportError(
"Missing dependencies for Envision. Install them using the command `pip install -e .[envision]` at the source directory."
)


from envision import types
from envision.client_config import EnvisionStateFilter
Expand Down
19 changes: 12 additions & 7 deletions envision/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@
from pathlib import Path
from typing import Dict, List, Optional, Sequence, Union

import ijson
import tornado.gen
import tornado.ioloop
import tornado.iostream
import tornado.web
import tornado.websocket
from tornado.websocket import WebSocketClosedError
try:
import ijson
import tornado.gen
import tornado.ioloop
import tornado.iostream
import tornado.web
import tornado.websocket
from tornado.websocket import WebSocketClosedError
except:
raise ImportError(
"Missing dependencies for Envision. Install them using the command `pip install -e .[envision]` at the source directory."
)

import smarts.core.models
from envision.web import dist as web_dist
Expand Down
52 changes: 28 additions & 24 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,28 @@ install_requires =
# 50.0 is broken: https://github.com/pypa/setupatools/issues/2353
setuptools>=41.0.0,!=50.0
click>=7.1.2 # used in scl
eclipse-sumo>=1.12.0 # sumo
gym>=0.17.3,<=0.19.0
gymnasium==0.27.0
# numpy>=1.19.5 required for tf 2.4
# numpy<1.24 required for ray (see https://github.com/ray-project/ray/issues/31258)
numpy>=1.19.5,<1.24.0
pandas>=1.3.4 # only used by zoo/evaluation
numpy>=1.19.5,<1.24.0
psutil>=5.4.8
pybullet>=3,<4.0
rich>=11.2.0
Rtree>=0.9.7
sh>=1.14.2
shapely>=2.0.0
tableprint>=0.9.1
trimesh==3.9.29 # Used for writing .glb files
PyYAML>=3.13
yattag>=1.14.0 # for Scenario Studio

# The following are planned to be made optional
eclipse-sumo>=1.12.0 # sumo
Rtree>=0.9.7 # technically optional, but used by sumo internally for performance (see `getNeighboringLanes()`)
gymnasium==0.27.0
pybullet>=3,<4.0
visdom>=0.1.8.9
# The following are for Scenario Studio
yattag>=1.14.0
# The following is for both SS and Envision
protobuf>=3.17.3, <4.0.0 # for /smarts/zoo and remote agents

# The following are planned for removal
gym>=0.17.3,<=0.19.0
cloudpickle>=1.3.0,<=2.1.0
# The following are for /envision
tornado>=5.1.1
websocket-client>=1.2.1
ijson>=3.1.4
# The following are for the /smarts/algorithms
matplotlib>=3.2.2
# The following are for /smarts/zoo and remote agents
protobuf>=3.17.3, <4.0.0
PyYAML>=3.13
twisted>=21.7.0
scipy

[options.packages.find]
exclude =
Expand All @@ -68,6 +60,8 @@ console_scripts =
diagnostic =
py-cpuinfo==9.0.0
mdutils==1.4.0
gym>=0.17.3,<=0.19.0
matplotlib>=3.2.2
camera_obs =
Panda3D==1.10.9
panda3d-gltf==0.13
Expand All @@ -85,6 +79,10 @@ doc =
sphinxcontrib-apidoc>=0.3.0
sphinx-click>=4.4.0
sphinx-rtd-theme>=1.1.1
envision =
tornado>=5.1.1
websocket-client>=1.2.1
ijson>=3.1.4
extras = pynput>=1.7.4 # Used by HumanKeyboardAgent
gym =
moviepy == 1.0.3
Expand Down Expand Up @@ -114,10 +112,16 @@ torch =
torchvision==0.5.0
train =
tensorflow>=2.4.0
opendrive =
opendrive2lanelet>=1.2.1
argoverse =
av2>=0.2.1
Rtree>=0.9.7
opendrive =
opendrive2lanelet>=1.2.1
Rtree>=0.9.7
waymo =
matplotlib>=3.2.2
protobuf>=3.17.3, <4.0.0
Rtree>=0.9.7

[aliases]
test=pytest
4 changes: 1 addition & 3 deletions smarts/core/argoverse_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

import heapq
import logging
import random
Expand All @@ -27,7 +26,6 @@
from typing import Dict, List, Optional, Sequence, Set, Tuple

import numpy as np
import rtree
from shapely.geometry import Point as SPoint
from shapely.geometry import Polygon

Expand All @@ -45,13 +43,13 @@
from smarts.sstudio.types import MapSpec

try:
import rtree
from av2.geometry.interpolate import interp_arc
from av2.map.lane_segment import LaneMarkType, LaneSegment
from av2.map.map_api import ArgoverseStaticMap
except:
raise ImportError(
"You may not have installed the [argoverse] dependencies required for using Argoverse 2 maps with SMARTS. Install it first using the command `pip install -e .[argoverse]` at the source directory."
""
)


Expand Down
4 changes: 1 addition & 3 deletions smarts/core/opendrive_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
from typing import Dict, Generator, List, Optional, Sequence, Set, Tuple

import numpy as np
import rtree

from smarts.core.utils.glb import make_map_glb, make_road_line_glb

# pytype: disable=import-error


try:
import rtree
from lxml import etree
from opendrive2lanelet.opendriveparser.elements.geometry import Line as LineGeometry
from opendrive2lanelet.opendriveparser.elements.junction import (
Expand Down Expand Up @@ -68,7 +67,6 @@
except ImportError:
raise ImportError(
"You may not have installed the [opendrive] dependencies required for using the OpenDRIVE maps with SMARTS. Install it first using the command `pip install -e .[opendrive]` at the source directory."
""
)
# pytype: enable=import-error

Expand Down
2 changes: 1 addition & 1 deletion smarts/core/sumo_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def nearest_lanes(
point[1],
r=radius,
includeJunctions=not include_junctions,
allowFallback=False,
allowFallback=False, # makes this call fail if rtree is not installed
)
if not include_junctions:
candidate_lanes = [
Expand Down
33 changes: 19 additions & 14 deletions smarts/core/waymo_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,23 @@
from typing import Any, Dict, Generator, List, Optional, Sequence, Set, Tuple, Union

import numpy as np
import rtree
from shapely.geometry import Point as SPoint
from shapely.geometry import Polygon

from smarts.core.coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint
from smarts.core.lanepoints import LanePoints, LinkedLanePoint
from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint
from smarts.core.route_cache import RouteWithCache
from smarts.core.utils.file import read_tfrecord_file
from smarts.core.utils.geometry import buffered_shape
from smarts.core.utils.glb import make_map_glb, make_road_line_glb
from smarts.core.utils.math import (
inplace_unwrap,
line_intersect_vectorized,
radians_to_vec,
ray_boundary_intersect,
vec_2d,
)
from smarts.sstudio.types import MapSpec
from smarts.waymo.waymo_open_dataset.protos import scenario_pb2
from smarts.waymo.waymo_open_dataset.protos.map_pb2 import (
Expand All @@ -47,19 +59,12 @@
)
from smarts.waymo.waymo_utils import WaymoDatasetError

from .coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint
from .lanepoints import LanePoints, LinkedLanePoint
from .road_map import RoadMap, RoadMapWithCaches, Waypoint
from .route_cache import RouteWithCache
from .utils.file import read_tfrecord_file
from .utils.geometry import buffered_shape
from .utils.math import (
inplace_unwrap,
line_intersect_vectorized,
radians_to_vec,
ray_boundary_intersect,
vec_2d,
)
try:
import rtree
except:
raise ImportError(
"You may not have installed the [argoverse] dependencies required for using Argoverse 2 maps with SMARTS. Install it first using the command `pip install -e .[argoverse]` at the source directory."
saulfield marked this conversation as resolved.
Show resolved Hide resolved
)


class WaymoMap(RoadMapWithCaches):
Expand Down
Loading