Skip to content

Commit 78d1498

Browse files
authored
BLD/DOC: Use conda(-forge) compilers (#38084)
1 parent 760c2fa commit 78d1498

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

doc/source/development/contributing.rst

+34-7
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Creating a development environment
146146
----------------------------------
147147

148148
To test out code changes, you'll need to build pandas from source, which
149-
requires a C compiler and Python environment. If you're making documentation
149+
requires a C/C++ compiler and Python environment. If you're making documentation
150150
changes, you can skip to :ref:`contributing.documentation` but you won't be able
151151
to build the documentation locally before pushing your changes.
152152

@@ -195,6 +195,13 @@ operations. To install pandas from source, you need to compile these C
195195
extensions, which means you need a C compiler. This process depends on which
196196
platform you're using.
197197

198+
If you have setup your environment using ``conda``, the packages ``c-compiler``
199+
and ``cxx-compiler`` will install a fitting compiler for your platform that is
200+
compatible with the remaining conda packages. On Windows and macOS, you will
201+
also need to install the SDKs as they have to be distributed separately.
202+
These packages will be automatically installed by using ``pandas``'s
203+
``environment.yml``.
204+
198205
**Windows**
199206

200207
You will need `Build Tools for Visual Studio 2017
@@ -206,12 +213,33 @@ You will need `Build Tools for Visual Studio 2017
206213
scrolling down to "All downloads" -> "Tools for Visual Studio 2019".
207214
In the installer, select the "C++ build tools" workload.
208215

216+
You can install the necessary components on the commandline using
217+
`vs_buildtools.exe <https://aka.ms/vs/16/release/vs_buildtools.exe>`_:
218+
219+
.. code::
220+
221+
vs_buildtools.exe --quiet --wait --norestart --nocache ^
222+
--installPath C:\BuildTools ^
223+
--add "Microsoft.VisualStudio.Workload.VCTools;includeRecommended" ^
224+
--add Microsoft.VisualStudio.Component.VC.v141 ^
225+
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
226+
--add Microsoft.VisualStudio.Component.Windows10SDK.17763
227+
228+
To setup the right paths on the commandline, call
229+
``"C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16 10.0.17763.0``.
230+
209231
**macOS**
210232

211-
Information about compiler installation can be found here:
233+
To use the ``conda``-based compilers, you will need to install the
234+
Developer Tools using ``xcode-select --install``. Otherwise
235+
information about compiler installation can be found here:
212236
https://devguide.python.org/setup/#macos
213237

214-
**Unix**
238+
**Linux**
239+
240+
For Linux-based ``conda`` installations, you won't have to install any
241+
additional components outside of the conda environment. The instructions
242+
below are only needed if your setup isn't based on conda environments.
215243

216244
Some Linux distributions will come with a pre-installed C compiler. To find out
217245
which compilers (and versions) are installed on your system::
@@ -243,11 +271,10 @@ Let us know if you have any difficulties by opening an issue or reaching out on
243271
Creating a Python environment
244272
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245273

246-
Now that you have a C compiler, create an isolated pandas development
247-
environment:
274+
Now create an isolated pandas development environment:
248275

249-
* Install either `Anaconda <https://www.anaconda.com/download/>`_ or `miniconda
250-
<https://conda.io/miniconda.html>`_
276+
* Install either `Anaconda <https://www.anaconda.com/download/>`_, `miniconda
277+
<https://conda.io/miniconda.html>`_, or `miniforge <https://github.com/conda-forge/miniforge>`_
251278
* Make sure your conda is up to date (``conda update conda``)
252279
* Make sure that you have :ref:`cloned the repository <contributing.forking>`
253280
* ``cd`` to the pandas source directory

environment.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ dependencies:
1212
- asv
1313

1414
# building
15+
# The compiler packages are meta-packages and install the correct compiler (activation) packages on the respective platforms.
16+
- c-compiler
17+
- cxx-compiler
1518
- cython>=0.29.21
1619

1720
# code checks

scripts/generate_pip_deps_from_conda.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import yaml
2121

22-
EXCLUDE = {"python"}
22+
EXCLUDE = {"python", "c-compiler", "cxx-compiler"}
2323
RENAME = {"pytables": "tables", "pyqt": "pyqt5", "dask-core": "dask"}
2424

2525

@@ -48,6 +48,9 @@ def conda_package_to_pip(package):
4848

4949
break
5050

51+
if package in EXCLUDE:
52+
return
53+
5154
if package in RENAME:
5255
return RENAME[package]
5356

0 commit comments

Comments
 (0)