@@ -15,50 +15,25 @@ 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
+ .. _contributing.c_compiler :
18
19
19
- Option 1: creating an environment without Docker
20
- ------------------------------------------------
20
+ Step 1: install a C compiler
21
+ ----------------------------
21
22
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.
23
+ How to do this will depend on your platform. If you choose to user ``Docker ``
24
+ in the next step, then you can skip this step.
36
25
37
26
**Windows **
38
27
39
- You will need `Build Tools for Visual Studio 2019
40
- <https://visualstudio.microsoft.com/downloads/> `_.
41
-
42
- .. warning ::
43
- You DO NOT need to install Visual Studio 2019.
44
- You only need "Build Tools for Visual Studio 2019" found by
45
- scrolling down to "All downloads" -> "Tools for Visual Studio 2019".
46
- In the installer, select the "C++ build tools" workload.
47
-
48
- You can install the necessary components on the commandline using
49
- `vs_buildtools.exe <https://download.visualstudio.microsoft.com/download/pr/9a26f37e-6001-429b-a5db-c5455b93953c/460d80ab276046de2455a4115cc4e2f1e6529c9e6cb99501844ecafd16c619c4/vs_BuildTools.exe >`_:
50
-
51
- .. code ::
28
+ You will need `Build Tools for Visual Studio <https://visualstudio.microsoft.com/downloads/ >`_.
52
29
53
- vs_buildtools.exe --quiet --wait --norestart --nocache ^
54
- --installPath C:\BuildTools ^
55
- --add "Microsoft.VisualStudio.Workload.VCTools;includeRecommended" ^
56
- --add Microsoft.VisualStudio.Component.VC.v141 ^
57
- --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
58
- --add Microsoft.VisualStudio.Component.Windows10SDK.17763
30
+ Note: you do not need to install Visual Studio.
31
+ You only need "Build Tools for Visual Studio" found by
32
+ scrolling down to "All downloads" -> "Tools for Visual Studio".
33
+ In the installer, select the "C++ build tools" workload.
59
34
60
- To setup the right paths on the commandline, call
61
- `` "C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16 10.0.17763.0 `` .
35
+ Alternatively, you could use the ` WSL < https://learn.microsoft.com/en-us/windows/wsl/install >`_
36
+ and consult the `` Linux `` instructions below .
62
37
63
38
**macOS **
64
39
@@ -69,12 +44,7 @@ https://devguide.python.org/setup/#macos
69
44
70
45
**Linux **
71
46
72
- For Linux-based :ref: `mamba <contributing.mamba >` installations, you won't have to install any
73
- additional components outside of the mamba environment. The instructions
74
- below are only needed if your setup isn't based on mamba environments.
75
-
76
- Some Linux distributions will come with a pre-installed C compiler. To find out
77
- which compilers (and versions) are installed on your system::
47
+ You probably already have a C compiler installed. You can check this with::
78
48
79
49
# for Debian/Ubuntu:
80
50
dpkg --list | grep compiler
@@ -83,67 +53,42 @@ which compilers (and versions) are installed on your system::
83
53
84
54
`GCC (GNU Compiler Collection) <https://gcc.gnu.org/ >`_, is a widely used
85
55
compiler, which supports C and a number of other languages. If GCC is listed
86
- as an installed compiler nothing more is required. If no C compiler is
87
- installed (or you wish to install a newer version) you can install a compiler
88
- (GCC in the example code below) with::
89
-
90
- # for recent Debian/Ubuntu:
91
- sudo apt install build-essential
92
- # for Red Had/RHEL/CentOS/Fedora
93
- yum groupinstall "Development Tools"
56
+ as an installed compiler nothing more is required.
94
57
95
- For other Linux distributions, consult your favorite search engine for
96
- compiler installation instructions.
58
+ If no C compiler is installed, or you wish to upgrade, or you're using a different
59
+ Linux distribution, consult your favorite search engine for compiler installation/update
60
+ instructions.
97
61
98
62
Let us know if you have any difficulties by opening an issue or reaching out on our contributor
99
63
community :ref: `Slack <community.slack >`.
100
64
101
- .. _contributing.mamba :
65
+ .. _contributing.isolated_environment :
102
66
103
- Option 1a: using mamba (recommended)
104
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
+ Step 2: create an isolated environment
68
+ ----------------------------------------
105
69
106
- Now create an isolated pandas development environment :
70
+ Before we begin, please :
107
71
108
- * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
109
- * Make sure your mamba is up to date (``mamba update mamba ``)
110
72
* Make sure that you have :any: `cloned the repository <contributing.forking> `
111
73
* ``cd `` to the pandas source directory
112
74
113
- We'll now kick off a three-step process:
75
+ .. _contributing.mamba :
76
+
77
+ Option 1: using mamba (recommended)
78
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114
79
115
- 1. Install the build dependencies
116
- 2. Build and install pandas
117
- 3. Install the optional dependencies
80
+ * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
81
+ * Make sure your mamba is up to date (``mamba update mamba ``)
118
82
119
83
.. code-block :: none
120
84
121
85
# Create and activate the build environment
122
86
mamba env create --file environment.yml
123
87
mamba activate pandas-dev
124
88
125
- # Build and install pandas
126
- python setup.py build_ext -j 4
127
- python -m pip install -e . --no-build-isolation --no-use-pep517
89
+ Option 2: using pip
90
+ ~~~~~~~~~~~~~~~~~~~
128
91
129
- At this point you should be able to import pandas from your locally built version::
130
-
131
- $ python
132
- >>> import pandas
133
- >>> print(pandas.__version__) # note: the exact output may differ
134
- 1.5.0.dev0+1355.ge65a30e3eb.dirty
135
-
136
- This will create the new environment, and not touch any of your existing environments,
137
- nor any existing Python installation.
138
-
139
- To return to your root environment::
140
-
141
- mamba deactivate
142
-
143
- Option 1b: using pip
144
- ~~~~~~~~~~~~~~~~~~~~
145
-
146
- If you aren't using mamba for your development environment, follow these instructions.
147
92
You'll need to have at least the :ref: `minimum Python version <install.version >` that pandas supports.
148
93
You also need to have ``setuptools `` 51.0.0 or later to build pandas.
149
94
@@ -162,10 +107,6 @@ You also need to have ``setuptools`` 51.0.0 or later to build pandas.
162
107
# Install the build dependencies
163
108
python -m pip install -r requirements-dev.txt
164
109
165
- # Build and install pandas
166
- python setup.py build_ext -j 4
167
- python -m pip install -e . --no-build-isolation --no-use-pep517
168
-
169
110
**Unix **/**macOS with pyenv **
170
111
171
112
Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv >`__.
@@ -174,7 +115,6 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
174
115
175
116
# Create a virtual environment
176
117
# Use an ENV_DIR of your choice. We'll use ~/Users/<yourname>/.pyenv/versions/pandas-dev
177
-
178
118
pyenv virtualenv < version> < name-to-give-it>
179
119
180
120
# For instance:
@@ -186,42 +126,29 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
186
126
# Now install the build dependencies in the cloned pandas repo
187
127
python -m pip install -r requirements-dev.txt
188
128
189
- # Build and install pandas
190
- python setup.py build_ext -j 4
191
- python -m pip install -e . --no-build-isolation --no-use-pep517
192
-
193
129
**Windows **
194
130
195
131
Below is a brief overview on how to set-up a virtual environment with Powershell
196
132
under Windows. For details please refer to the
197
133
`official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators >`__.
198
134
199
- Use an ENV_DIR of your choice. We'll use ~\\ virtualenvs\\ pandas-dev where
200
- '~' is the folder pointed to by either $env:USERPROFILE (Powershell) or
201
- %USERPROFILE% (cmd.exe) environment variable. Any parent directories
135
+ Use an ENV_DIR of your choice. We'll use `` ~\\virtualenvs\\pandas-dev `` where
136
+ `` ~ `` is the folder pointed to by either `` $env:USERPROFILE `` (Powershell) or
137
+ `` %USERPROFILE% `` (cmd.exe) environment variable. Any parent directories
202
138
should already exist.
203
139
204
140
.. code-block :: powershell
205
-
206
141
# Create a virtual environment
207
142
python - m venv $env: USERPROFILE \virtualenvs\pandas- dev
208
-
209
143
# Activate the virtualenv. Use activate.bat for cmd.exe
210
144
~\virtualenvs\pandas- dev\Scripts\Activate.ps1
211
-
212
145
# Install the build dependencies
213
146
python - m pip install - r requirements- dev.txt
214
147
215
- # Build and install pandas
216
- python setup.py build_ext - j 4
217
- python - m pip install - e . -- no- build-isolation -- no- use-pep517
218
-
219
- Option 2: creating an environment using Docker
220
- ----------------------------------------------
148
+ Option 3: using Docker
149
+ ~~~~~~~~~~~~~~~~~~~~~~
221
150
222
- Instead of manually setting up a development environment, you can use `Docker
223
- <https://docs.docker.com/get-docker/> `_ to automatically create the environment with just several
224
- commands. pandas provides a ``DockerFile `` in the root directory to build a Docker image
151
+ pandas provides a ``DockerFile `` in the root directory to build a Docker image
225
152
with a full pandas development environment.
226
153
227
154
**Docker Commands **
@@ -238,13 +165,6 @@ Run Container::
238
165
# but if not alter ${PWD} to match your local repo path
239
166
docker run -it --rm -v ${PWD}:/home/pandas pandas-dev
240
167
241
- When inside the running container you can build and install pandas the same way as the other methods
242
-
243
- .. code-block :: bash
244
-
245
- python setup.py build_ext -j 4
246
- python -m pip install -e . --no-build-isolation --no-use-pep517
247
-
248
168
*Even easier, you can integrate Docker with the following IDEs: *
249
169
250
170
**Visual Studio Code **
@@ -258,3 +178,25 @@ See https://code.visualstudio.com/docs/remote/containers for details.
258
178
Enable Docker support and use the Services tool window to build and manage images as well as
259
179
run and interact with containers.
260
180
See https://www.jetbrains.com/help/pycharm/docker.html for details.
181
+
182
+ Step 3: build and install pandas
183
+ --------------------------------
184
+
185
+ You can now run::
186
+
187
+ # Build and install pandas
188
+ python setup.py build_ext -j 4
189
+ python -m pip install -e . --no-build-isolation --no-use-pep517
190
+
191
+ At this point you should be able to import pandas from your locally built version::
192
+
193
+ $ python
194
+ >>> import pandas
195
+ >>> print(pandas.__version__) # note: the exact output may differ
196
+ 1.5.0.dev0+1355.ge65a30e3eb.dirty
197
+
198
+ This will create the new environment, and not touch any of your existing environments,
199
+ nor any existing Python installation.
200
+
201
+ Note that you will need to repeat this step each time the C extensions change, for example
202
+ if you modified them or if you did a fetch and merge from ``upstream/main ``.
0 commit comments