@@ -15,24 +15,11 @@ locally before pushing your changes. It's recommended to also install the :ref:`
15
15
.. contents :: Table of contents:
16
16
:local:
17
17
18
+ Step 1: install a C compiler
19
+ ----------------------------
18
20
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.
36
23
37
24
**Windows **
38
25
@@ -48,6 +35,9 @@ You will need `Build Tools for Visual Studio 2022
48
35
Alternatively, you can install the necessary components on the commandline using
49
36
`vs_BuildTools.exe <https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?source=recommendations&view=vs-2022 >`_
50
37
38
+ Alternatively, you could use the `WSL <https://learn.microsoft.com/en-us/windows/wsl/install >`_
39
+ and consult the ``Linux `` instructions below.
40
+
51
41
**macOS **
52
42
53
43
To 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::
71
61
72
62
`GCC (GNU Compiler Collection) <https://gcc.gnu.org/ >`_, is a widely used
73
63
compiler, 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.
77
65
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.
85
69
86
70
Let us know if you have any difficulties by opening an issue or reaching out on our contributor
87
71
community :ref: `Slack <community.slack >`.
88
72
89
- .. _contributing.mamba :
90
-
91
- Option 1a: using mamba (recommended)
92
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
+ Step 2: create an isolated environment
74
+ ----------------------------------------
93
75
94
- Now create an isolated pandas development environment :
76
+ Before we begin, please :
95
77
96
- * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
97
- * Make sure your mamba is up to date (``mamba update mamba ``)
98
78
* Make sure that you have :any: `cloned the repository <contributing.forking> `
99
79
* ``cd `` to the pandas source directory
100
80
101
- We'll now kick off a three-step process:
81
+ .. _contributing.mamba :
82
+
83
+ Option 1: using mamba (recommended)
84
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
85
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 ``)
106
88
107
89
.. code-block :: none
108
90
109
91
# Create and activate the build environment
110
92
mamba env create --file environment.yml
111
93
mamba activate pandas-dev
112
94
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
+ ~~~~~~~~~~~~~~~~~~~
133
97
134
- If you aren't using mamba for your development environment, follow these instructions.
135
98
You'll need to have at least the :ref: `minimum Python version <install.version >` that pandas supports.
136
99
You also need to have ``setuptools `` 51.0.0 or later to build pandas.
137
100
@@ -150,10 +113,6 @@ You also need to have ``setuptools`` 51.0.0 or later to build pandas.
150
113
# Install the build dependencies
151
114
python -m pip install -r requirements-dev.txt
152
115
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
-
157
116
**Unix **/**macOS with pyenv **
158
117
159
118
Consult 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>`__.
162
121
163
122
# Create a virtual environment
164
123
# Use an ENV_DIR of your choice. We'll use ~/Users/<yourname>/.pyenv/versions/pandas-dev
165
-
166
124
pyenv virtualenv < version> < name-to-give-it>
167
125
168
126
# For instance:
@@ -174,19 +132,15 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
174
132
# Now install the build dependencies in the cloned pandas repo
175
133
python -m pip install -r requirements-dev.txt
176
134
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
-
181
135
**Windows **
182
136
183
137
Below is a brief overview on how to set-up a virtual environment with Powershell
184
138
under Windows. For details please refer to the
185
139
`official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators >`__.
186
140
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
190
144
should already exist.
191
145
192
146
.. code-block :: powershell
@@ -200,16 +154,10 @@ should already exist.
200
154
# Install the build dependencies
201
155
python - m pip install - r requirements- dev.txt
202
156
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
+ ~~~~~~~~~~~~~~~~~~~~~~
209
159
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
213
161
with a full pandas development environment.
214
162
215
163
**Docker Commands **
@@ -226,13 +174,6 @@ Run Container::
226
174
# but if not alter ${PWD} to match your local repo path
227
175
docker run -it --rm -v ${PWD}:/home/pandas pandas-dev
228
176
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
-
236
177
*Even easier, you can integrate Docker with the following IDEs: *
237
178
238
179
**Visual Studio Code **
@@ -246,3 +187,26 @@ See https://code.visualstudio.com/docs/remote/containers for details.
246
187
Enable Docker support and use the Services tool window to build and manage images as well as
247
188
run and interact with containers.
248
189
See 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