@@ -92,28 +92,6 @@ Option 1: using mamba (recommended)
92
92
mamba env create --file environment.yml
93
93
mamba activate pandas-dev
94
94
95
- # Build and install pandas
96
- python setup.py build_ext -j 4
97
- python -m pip install -e . --no-build-isolation --no-use-pep517
98
-
99
- # Alternatively, if you would like to try out our new build system
100
- # based on meson
101
- pip install . --no-build-isolation --config-settings="builddir=builddir"
102
-
103
- At this point you should be able to import pandas from your locally built version::
104
-
105
- $ python
106
- >>> import pandas
107
- >>> print(pandas.__version__) # note: the exact output may differ
108
- 1.5.0.dev0+1355.ge65a30e3eb.dirty
109
-
110
- This will create the new environment, and not touch any of your existing environments,
111
- nor any existing Python installation.
112
-
113
- To return to your root environment::
114
-
115
- mamba deactivate
116
-
117
95
Option 2: using pip
118
96
~~~~~~~~~~~~~~~~~~~
119
97
@@ -135,15 +113,6 @@ You also need to have ``setuptools`` 51.0.0 or later to build pandas.
135
113
# Install the build dependencies
136
114
python -m pip install -r requirements-dev.txt
137
115
138
- # Build and install pandas
139
- python setup.py build_ext -j 4
140
- python setup.py develop
141
-
142
- # Alternatively, if you would like to try out our new build system
143
- # based on meson
144
- pip install . --no-build-isolation --config-settings=" builddir=builddir"
145
-
146
-
147
116
**Unix **/**macOS with pyenv **
148
117
149
118
Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv >`__.
@@ -163,14 +132,6 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
163
132
# Now install the build dependencies in the cloned pandas repo
164
133
python -m pip install -r requirements-dev.txt
165
134
166
- # Build and install pandas
167
- python setup.py build_ext -j 4
168
- python setup.py develop
169
-
170
- # Alternatively, if you would like to try out our new build system
171
- # based on meson
172
- pip install . --no-build-isolation --config-settings=" builddir=builddir"
173
-
174
135
**Windows **
175
136
176
137
Below is a brief overview on how to set-up a virtual environment with Powershell
@@ -193,16 +154,8 @@ should already exist.
193
154
# Install the build dependencies
194
155
python - m pip install - r requirements- dev.txt
195
156
196
- # Build and install pandas
197
- python setup.py build_ext - j 4
198
- python setup.py develop
199
-
200
- # Alternatively, if you would like to try out our new build system
201
- # based on meson
202
- pip install . -- no- build-isolation -- config- settings= " builddir=builddir"
203
-
204
- Option 2: creating an environment using Docker
205
- ----------------------------------------------
157
+ Option 3: using Docker
158
+ ~~~~~~~~~~~~~~~~~~~~~~
206
159
207
160
pandas provides a ``DockerFile `` in the root directory to build a Docker image
208
161
with a full pandas development environment.
@@ -238,11 +191,51 @@ See https://www.jetbrains.com/help/pycharm/docker.html for details.
238
191
Step 3: build and install pandas
239
192
--------------------------------
240
193
241
- You can now run::
194
+ There are currently two supported ways of building pandas, pip/meson and setuptools(setup.py).
195
+ Historically, pandas has only supported using setuptools to build pandas. However, this method
196
+ requires a lot of convoluted code in setup.py and also has many issues in compiling pandas in parallel
197
+ due to limitations in setuptools.
198
+
199
+ The newer build system, invokes the meson backend through pip (via a `PEP 517 <https://peps.python.org/pep-0517/ >`_ build).
200
+ It automatically uses all available cores on your CPU, and also avoids the need for manual rebuilds by
201
+ rebuilding automatically whenever pandas is imported(with an editable install).
202
+
203
+ For these reasons, you should compile pandas with meson.
204
+ Because the meson build system is newer, you may find bugs/minor issues as it matures. You can report these bugs
205
+ `here <https://github.com/pandas-dev/pandas/issues/49683 >`_.
206
+
207
+ To compile pandas with meson, run::
242
208
243
209
# Build and install pandas
244
- python setup.py build_ext -j 4
245
- python -m pip install -e . --no-build-isolation --no-use-pep517
210
+ python -m pip install -ve . --no-build-isolation
211
+
212
+ ** Build options **
213
+
214
+ It is possible to pass options from the pip frontend to the meson backend if you would like to configure your
215
+ install. Occasionally, you'll want to use this to adjust the build directory, and/or toggle debug/optimization levels.
216
+
217
+ You can pass a build directory to pandas by appending ``--config-settings builddir="your builddir here" `` to your pip command.
218
+ This option allows you to configure where meson stores your built C extensions, and allows for fast rebuilds.
219
+
220
+ Sometimes, it might be useful to compile pandas with debugging symbols, when debugging C extensions.
221
+ Appending ``--config-settings setup-args="-Ddebug=true" `` will do the trick.
222
+
223
+ With pip, it is possible to chain together multiple config settings (for example specifying both a build directory
224
+ and building with debug symbols would look like
225
+ ``--config-settings builddir="your builddir here" --config-settings setup-args="-Ddebug=true" ``.
226
+
227
+ **Compiling pandas with setup.py **
228
+
229
+ .. note ::
230
+ This method of compiling pandas will be deprecated and removed very soon, as the meson backend matures.
231
+
232
+ To compile pandas with setuptools, run::
233
+
234
+ python setup.py develop
235
+
236
+ .. note ::
237
+ You will also need to repeat this step each time the C extensions change,
238
+ for example if you modified any file in ``pandas/_libs `` or if you did a fetch and merge from ``upstream/main ``.
246
239
247
240
At this point you should be able to import pandas from your locally built version::
248
241
@@ -251,9 +244,7 @@ At this point you should be able to import pandas from your locally built versio
251
244
>>> print(pandas.__version__) # note: the exact output may differ
252
245
2.0.0.dev0+880.g2b9e661fbb.dirty
253
246
254
- This will create the new environment, and not touch any of your existing environments,
255
- nor any existing Python installation.
256
-
257
- .. note ::
258
- You will need to repeat this step each time the C extensions change, for example
259
- if you modified any file in ``pandas/_libs `` or if you did a fetch and merge from ``upstream/main ``.
247
+ .. tip ::
248
+ If you ever find yourself wondering whether setuptools or meson was used to build your pandas,
249
+ you can check the value of ``pandas._built_with_meson ``, which will be true if meson was used
250
+ to compile pandas.
0 commit comments