@@ -15,24 +15,11 @@ locally before pushing your changes. It's recommended to also install the :ref:`
1515.. contents :: Table of contents:
1616 :local:
1717
18+ Step 1: install a C compiler
19+ ----------------------------
1820
19- Option 1: creating an environment without Docker
20- ------------------------------------------------
21-
22- Installing a C compiler
23- ~~~~~~~~~~~~~~~~~~~~~~~
24-
25- pandas uses C extensions (mostly written using Cython) to speed up certain
26- operations. To install pandas from source, you need to compile these C
27- extensions, which means you need a C compiler. This process depends on which
28- platform you're using.
29-
30- If you have setup your environment using :ref: `mamba <contributing.mamba >`, the packages ``c-compiler ``
31- and ``cxx-compiler `` will install a fitting compiler for your platform that is
32- compatible with the remaining mamba packages. On Windows and macOS, you will
33- also need to install the SDKs as they have to be distributed separately.
34- These packages will automatically be installed by using the ``pandas ``
35- ``environment.yml `` file.
21+ How to do this will depend on your platform. If you choose to user ``Docker ``
22+ in the next step, then you can skip this step.
3623
3724**Windows **
3825
@@ -48,6 +35,9 @@ You will need `Build Tools for Visual Studio 2022
4835Alternatively, you can install the necessary components on the commandline using
4936`vs_BuildTools.exe <https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?source=recommendations&view=vs-2022 >`_
5037
38+ Alternatively, you could use the `WSL <https://learn.microsoft.com/en-us/windows/wsl/install >`_
39+ and consult the ``Linux `` instructions below.
40+
5141**macOS **
5242
5343To use the :ref: `mamba <contributing.mamba >`-based compilers, you will need to install the
@@ -71,67 +61,40 @@ which compilers (and versions) are installed on your system::
7161
7262`GCC (GNU Compiler Collection) <https://gcc.gnu.org/ >`_, is a widely used
7363compiler, which supports C and a number of other languages. If GCC is listed
74- as an installed compiler nothing more is required. If no C compiler is
75- installed (or you wish to install a newer version) you can install a compiler
76- (GCC in the example code below) with::
64+ as an installed compiler nothing more is required.
7765
78- # for recent Debian/Ubuntu:
79- sudo apt install build-essential
80- # for Red Had/RHEL/CentOS/Fedora
81- yum groupinstall "Development Tools"
82-
83- For other Linux distributions, consult your favorite search engine for
84- compiler installation instructions.
66+ If no C compiler is installed, or you wish to upgrade, or you're using a different
67+ Linux distribution, consult your favorite search engine for compiler installation/update
68+ instructions.
8569
8670Let us know if you have any difficulties by opening an issue or reaching out on our contributor
8771community :ref: `Slack <community.slack >`.
8872
89- .. _contributing.mamba :
90-
91- Option 1a: using mamba (recommended)
92- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73+ Step 2: create an isolated environment
74+ ----------------------------------------
9375
94- Now create an isolated pandas development environment :
76+ Before we begin, please :
9577
96- * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
97- * Make sure your mamba is up to date (``mamba update mamba ``)
9878* Make sure that you have :any: `cloned the repository <contributing.forking> `
9979* ``cd `` to the pandas source directory
10080
101- We'll now kick off a three-step process:
81+ .. _contributing.mamba :
82+
83+ Option 1: using mamba (recommended)
84+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10285
103- 1. Install the build dependencies
104- 2. Build and install pandas
105- 3. Install the optional dependencies
86+ * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
87+ * Make sure your mamba is up to date (``mamba update mamba ``)
10688
10789.. code-block :: none
10890
10991 # Create and activate the build environment
11092 mamba env create --file environment.yml
11193 mamba activate pandas-dev
11294
113- # Build and install pandas
114- python setup.py build_ext -j 4
115- python -m pip install -e . --no-build-isolation --no-use-pep517
116-
117- At this point you should be able to import pandas from your locally built version::
118-
119- $ python
120- >>> import pandas
121- >>> print(pandas.__version__) # note: the exact output may differ
122- 1.5.0.dev0+1355.ge65a30e3eb.dirty
123-
124- This will create the new environment, and not touch any of your existing environments,
125- nor any existing Python installation.
126-
127- To return to your root environment::
128-
129- mamba deactivate
130-
131- Option 1b: using pip
132- ~~~~~~~~~~~~~~~~~~~~
95+ Option 2: using pip
96+ ~~~~~~~~~~~~~~~~~~~
13397
134- If you aren't using mamba for your development environment, follow these instructions.
13598You'll need to have at least the :ref: `minimum Python version <install.version >` that pandas supports.
13699You also need to have ``setuptools `` 51.0.0 or later to build pandas.
137100
@@ -150,10 +113,6 @@ You also need to have ``setuptools`` 51.0.0 or later to build pandas.
150113 # Install the build dependencies
151114 python -m pip install -r requirements-dev.txt
152115
153- # Build and install pandas
154- python setup.py build_ext -j 4
155- python -m pip install -e . --no-build-isolation --no-use-pep517
156-
157116 **Unix **/**macOS with pyenv **
158117
159118Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv >`__.
@@ -162,7 +121,6 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
162121
163122 # Create a virtual environment
164123 # Use an ENV_DIR of your choice. We'll use ~/Users/<yourname>/.pyenv/versions/pandas-dev
165-
166124 pyenv virtualenv < version> < name-to-give-it>
167125
168126 # For instance:
@@ -174,19 +132,15 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
174132 # Now install the build dependencies in the cloned pandas repo
175133 python -m pip install -r requirements-dev.txt
176134
177- # Build and install pandas
178- python setup.py build_ext -j 4
179- python -m pip install -e . --no-build-isolation --no-use-pep517
180-
181135 **Windows **
182136
183137Below is a brief overview on how to set-up a virtual environment with Powershell
184138under Windows. For details please refer to the
185139`official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators >`__.
186140
187- Use an ENV_DIR of your choice. We'll use ~\\ virtualenvs\\ pandas-dev where
188- '~' is the folder pointed to by either $env:USERPROFILE (Powershell) or
189- %USERPROFILE% (cmd.exe) environment variable. Any parent directories
141+ Use an ENV_DIR of your choice. We'll use `` ~\\virtualenvs\\pandas-dev `` where
142+ `` ~ `` is the folder pointed to by either `` $env:USERPROFILE `` (Powershell) or
143+ `` %USERPROFILE% `` (cmd.exe) environment variable. Any parent directories
190144should already exist.
191145
192146.. code-block :: powershell
@@ -200,16 +154,10 @@ should already exist.
200154 # Install the build dependencies
201155 python - m pip install - r requirements- dev.txt
202156
203- # Build and install pandas
204- python setup.py build_ext - j 4
205- python - m pip install - e . -- no- build-isolation -- no- use-pep517
206-
207- Option 2: creating an environment using Docker
208- ----------------------------------------------
157+ Option 3: using Docker
158+ ~~~~~~~~~~~~~~~~~~~~~~
209159
210- Instead of manually setting up a development environment, you can use `Docker
211- <https://docs.docker.com/get-docker/> `_ to automatically create the environment with just several
212- commands. pandas provides a ``DockerFile `` in the root directory to build a Docker image
160+ pandas provides a ``DockerFile `` in the root directory to build a Docker image
213161with a full pandas development environment.
214162
215163**Docker Commands **
@@ -226,13 +174,6 @@ Run Container::
226174 # but if not alter ${PWD} to match your local repo path
227175 docker run -it --rm -v ${PWD}:/home/pandas pandas-dev
228176
229- When inside the running container you can build and install pandas the same way as the other methods
230-
231- .. code-block :: bash
232-
233- python setup.py build_ext -j 4
234- python -m pip install -e . --no-build-isolation --no-use-pep517
235-
236177*Even easier, you can integrate Docker with the following IDEs: *
237178
238179**Visual Studio Code **
@@ -246,3 +187,26 @@ See https://code.visualstudio.com/docs/remote/containers for details.
246187Enable Docker support and use the Services tool window to build and manage images as well as
247188run and interact with containers.
248189See https://www.jetbrains.com/help/pycharm/docker.html for details.
190+
191+ Step 3: build and install pandas
192+ --------------------------------
193+
194+ You can now run::
195+
196+ # Build and install pandas
197+ python setup.py build_ext -j 4
198+ python -m pip install -e . --no-build-isolation --no-use-pep517
199+
200+ At this point you should be able to import pandas from your locally built version::
201+
202+ $ python
203+ >>> import pandas
204+ >>> print(pandas.__version__) # note: the exact output may differ
205+ 2.0.0.dev0+880.g2b9e661fbb.dirty
206+
207+ This will create the new environment, and not touch any of your existing environments,
208+ nor any existing Python installation.
209+
210+ .. note ::
211+ You will need to repeat this step each time the C extensions change, for example
212+ if you modified any file in ``pandas/_libs `` or if you did a fetch and merge from ``upstream/main ``.
0 commit comments