@@ -68,10 +68,7 @@ If Python 3 support is not required, omit the packages that mention `python3`.
68
68
69
69
3. [Clone or download * DeepMind Lab* ](https://github.com/deepmind/lab).
70
70
71
- 4. If necessary, edit ` python.BUILD` according to the [Python
72
- instructions](# python-dependencies) below.
73
-
74
- 5. Build * DeepMind Lab* and run a random agent. (Use the ` -c opt` flag to enable
71
+ 4. Build * DeepMind Lab* and run a random agent. (Use the ` -c opt` flag to enable
75
72
optimizations.)
76
73
77
74
` ` ` shell
@@ -97,9 +94,9 @@ arguments. Run `bazel run :random_agent -- --help` to see those.
97
94
98
95
* DeepMind Lab* does not include every dependency hermetically. In particular,
99
96
Python is not included, but instead it must already be installed on your system.
100
- This means that depending on the details of where that library is installed, you
101
- may need to adjust the Bazel build rules in
102
- [ ` python.BUILD ` ](../../bazel/python.BUILD) to locate it correctly .
97
+ Our Bazel workspace includes a mechanism to discover the location of the
98
+ system ' s Python paths automatically by running the `python2` and `python3`
99
+ interpreters. Additionally, NumPy must be available on your system, too .
103
100
104
101
Bazel can build Python code using either Python 2 or Python 3. The default is
105
102
Python 3, but each individual `py_binary` and `py_test` target can specify the
@@ -108,57 +105,10 @@ desired version using the
108
105
argument. The build rules need to make the local installation path of correct
109
106
version of Python available.
110
107
111
- If you only intend to use one of the two versions (e.g. on an older system where
112
- Python 3 with NumPy is not available), you only need to provide paths for that
113
- version; however, the codebase includes tests that run under both Python 2 and
114
- Python 3.
115
-
116
108
The default build rules should work for Debian and Ubuntu. They use Bazel' s
117
109
[configurable attributes](https://docs.bazel.build/versions/master/be/common-definitions.html#configurable-attributes)
118
110
to provide paths for Python 2 and Python 3, respectively, based on which version
119
- is required during a particular build. Note that paths in the build rules are
120
- relative to the root path specified in the [`WORKSPACE`](../../WORKSPACE) file
121
- (which is `"/usr"` by default).
122
-
123
- Python requires two separate dependencies: The CPython extension API, and NumPy.
124
- If, say, NumPy is installed in a custom location, like it is on SUSE Linux and
125
- RedHat Linux, you need to add the files from that location and set an include
126
- search path accordingly. For example:
127
-
128
- ```python
129
- cc_library(
130
- name = "python",
131
- hdrs = select(
132
- {
133
- "@bazel_tools//tools/python:PY2": glob([
134
- "include/python2.7/*.h",
135
- "lib64/python2.7/site-packages/numpy/core/include/**/*.h",
136
- ]),
137
- "@bazel_tools//tools/python:PY3": glob([
138
- "include/python3.6m/*.h",
139
- "lib64/python3.6/site-packages/numpy/core/include/**/*.h",
140
- ]),
141
- },
142
- no_match_error = "Internal error, Python version should be one of PY2 or PY3",
143
- ),
144
- includes = select(
145
- {
146
- "@bazel_tools//tools/python:PY2": [
147
- "include/python2.7",
148
- "lib64/python2.7/site-packages/numpy/core/include",
149
- ],
150
- "@bazel_tools//tools/python:PY3": [
151
- "include/python3.6m",
152
- "lib64/python3.6/site-packages/numpy/core/include",
153
- ],
154
- },
155
- no_match_error = "Internal error, Python version should be one of PY2 or PY3",
156
- ),
157
- visibility = ["//visibility:public"],
158
- )
159
- ```
160
- The outputs of `rpm -ql python` and `rpm -ql python-numpy-devel` might be
161
- helpful to find the right include directories on Red-Hat-like systems.
111
+ is required during a particular build.
162
112
163
113
If you have installed NumPy locally via PIP and would like to use the * DeepMind
164
114
Lab* PIP module, then you should build the module against the version of NumPy
0 commit comments