@@ -5,9 +5,8 @@ Installing PCSE
5
5
Requirements and dependencies
6
6
=============================
7
7
8
- PCSE is being developed on Ubuntu Linux 14.04 and Windows 7 using Python 2.7.11 and is known to work with
9
- the 3.x series (using the 2to3 tool). As Python is a platform independent language, PCSE
10
- works equally well on Linux, Windows or Mac OSX.
8
+ PCSE is being developed on Ubuntu Linux 14.04 and Windows 7 using Python 2.7.14 and python 3.6.5 .
9
+ As Python is a platform independent language, PCSE works equally well on Linux, Windows or Mac OSX.
11
10
Before installing PCSE, Python itself must be installed on your system. Most Linux systems provide
12
11
Python through the native package manager. For Windows users the most straightforward approach for installing
13
12
Python is through one of the prepackaged Python distributions such as `Enthought Canopy `_,
@@ -20,14 +19,20 @@ The dependencies of PCSE are the following:
20
19
* Numpy >= 1.6
21
20
* SQLalchemy >= 0.8
22
21
* PyYAML >= 3.11
23
- * tabulate >= 0.7.5
24
22
* xlrd >= 0.9.3
25
23
* xlwt >= 1.0.0
24
+ * pandas >= 0.20
25
+ * requests >= 2.0.0
26
+ * traitlets-pcse == 5.0.0.dev
27
+
28
+ The last package in the list is a modified version of the `traitlets `_ package which provides some
29
+ additional functionality used by PCSE.
26
30
27
31
.. _Enthought Canopy : https://www.enthought.com/products/canopy/
28
32
.. _Anaconda : https://store.continuum.io/cshop/anaconda/
29
33
.. _PythonXY : https://python-xy.github.io/
30
34
.. _HomeBrew : http://brew.sh
35
+ .. _traitlets : https://traitlets.readthedocs.io/en/stable/
31
36
32
37
Setting up your python environment
33
38
==================================
@@ -72,75 +77,46 @@ After installing MiniConda you should open a command box and check that conda is
72
77
is foreign system : False
73
78
74
79
Now we will use a Conda environment file to recreate the python environment that we use to develop and run
75
- PCSE. First you should download the conda environment file which comes in two flavours, a bare minimum
76
- environment for running PCSE (:download: `downloads/py2_pcse .yml `) and a more complete environment which
77
- includes the Jupyter notebook, Pandas and IPython (:download: `downloads/py2_pcse_full .yml `). If you intend
78
- to run the 'Getting started' section, you should take the latter one . Save the environment file
80
+ PCSE. First you should download the conda environment file which comes in two flavours, an
81
+ environment for running PCSE on python 3 (:download: `downloads/py3_pcse .yml `) and one for python 2
82
+ (:download: `downloads/py3_pcse .yml `). Both environments include the Jupyter notebook and IPython which are
83
+ needed for running the ` getting started` section and the example notebooks . Save the environment file
79
84
on a temporary location such as ``d:\temp\make_env\ ``. We will now create a dedicated virtual environment
80
- using the command ``conda env create `` and tell conda to use the environment file with the option ``-f p2_pcse_full .yml ``
85
+ using the command ``conda env create `` and tell conda to use the environment file with the option ``-f p3_pcse .yml ``
81
86
as show below:
82
87
83
88
.. code-block :: doscon
84
89
85
- D:\temp\make_env>conda env create -f py2_pcse_full.yml
86
- Fetching package metadata: ....
87
- .Solving package specifications: .........
88
- Linking packages ...
89
- [ COMPLETE ]|##################################################| 100%
90
- Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname==3.4.0.2 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
91
- Requirement already satisfied (use --upgrade to upgrade): line-profiler==1.0 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
92
- Requirement already satisfied (use --upgrade to upgrade): sphinx-rtd-theme==0.1.7 in c:\miniconda3\envs\py2_pcse_b\lib\site-packages
93
- Collecting tabulate==0.7.5
94
- Installing collected packages: tabulate
95
- Successfully installed tabulate-0.7.5
90
+ (C:\Miniconda3) D:\temp\make_env>conda env create -f py3_pcse.yml
91
+ Fetching package metadata .............
92
+ Solving package specifications: .
93
+ intel-openmp-2 100% |###############################| Time: 0:00:00 6.39 MB/s
94
+
95
+ ... Lots of output here
96
+
97
+ Installing collected packages: traitlets-pcse
98
+ Successfully installed traitlets-pcse-5.0.0.dev0
96
99
#
97
100
# To activate this environment, use:
98
- # > activate py2_pcse
101
+ # > activate py3_pcse
102
+ #
103
+ # To deactivate an active environment, use:
104
+ # > deactivate
105
+ #
106
+ # * for power-users using bash, you must source
99
107
#
100
108
101
- You can then activate your environment (note the addition of ``[py2_pcse] `` on your command prompt) and
109
+ You can then activate your environment (note the addition of ``(py3_pcse) `` on your command prompt) and
102
110
run an upgrade to upgrade all packages to the latest versions:
103
111
104
112
.. code-block :: doscon
105
113
106
- D:\temp\make_env>activate py2_pcse
114
+ D:\temp\make_env>activate py3_pcse
107
115
Deactivating environment "C:\Miniconda3"...
108
116
Activating environment "C:\Miniconda3\envs\py2_pcse"...
109
117
110
- [py2_pcse] D:\temp\make_env>conda upgrade --all
111
- Fetching package metadata: ....
112
- Solving package specifications: .........
113
-
114
- Package plan for installation in environment C:\Miniconda3\envs\py2_pcse:
115
-
116
- The following packages will be downloaded:
117
-
118
- package | build
119
- ---------------------------|-----------------
120
- vs2008_runtime-9.00.30729.1| 1 1.1 MB
121
- zlib-1.2.8 | vc9_3 95 KB
122
-
123
- ... Lots of output here
124
-
125
- Proceed ([y]/n)? y
126
-
127
- Fetching packages ...
128
- vs2008_runtime 100% |###############################| Time: 0:00:02 518.43 kB/s
129
-
130
- ... Lots of output here
131
-
132
- pyqt-4.11.4-py 100% |###############################| Time: 0:00:04 571.51 kB/s
133
- tornado-4.3-py 100% |###############################| Time: 0:00:01 387.81 kB/s
134
- Extracting packages ...
135
- [ COMPLETE ]|##################################################| 100%
136
- Unlinking packages ...
137
- [ COMPLETE ]|##################################################| 100%
138
- Linking packages ...
139
- 1 file(s) copied.###################################### | 81%
140
- [ COMPLETE ]|##################################################| 100%
141
-
142
- [py2_pcse] D:\temp\make_env>
143
-
118
+ D:\temp\make_env>activate py3_pcse
119
+ (py3_pcse) D:\temp\make_env>
144
120
145
121
Installing and testing PCSE
146
122
===========================
@@ -154,7 +130,7 @@ environment:
154
130
155
131
.. code-block :: doscon
156
132
157
- [py2_pcse] D:\temp\make_env>pip install PCSE
133
+ (py3_pcse) D:\temp\make_env>pip install pcse
158
134
Collecting PCSE
159
135
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.0 in c:\miniconda3\envs\py2_pcse\lib\site-packages (from PCSE)
160
136
Requirement already satisfied (use --upgrade to upgrade): xlrd>0.9.0 in c:\miniconda3\envs\py2_pcse\lib\site-packages (from PCSE)
@@ -189,20 +165,18 @@ For testing the PCSE package we need to start python and import pcse:
189
165
190
166
.. code-block :: doscon
191
167
192
- [py2_pcse] D:\temp\make_env>python
193
- Python 2 .7.11 |Continuum Analytics, Inc.| (default, Mar 4 2016, 15:18:41 ) [MSC v.1500 32 bit (Intel)] on win32
168
+ (py3_pcse) D:\temp\make_env>python
169
+ Python 3 .7.0 (default, Aug 14 2018, 19:12:50 ) [MSC v.1900 32 bit (Intel)] :: Anaconda, Inc. on win32
194
170
Type "help", "copyright", "credits" or "license" for more information.
195
- Anaconda is brought to you by Continuum Analytics.
196
- Please check out: http://continuum.io/thanks and https://anaconda.org
197
171
>>> import pcse
198
- Building PCSE demo database at: C:\Users\wit015\.pcse\pcse.db
172
+ Building PCSE demo database at: C:\Users\wit015\.pcse\pcse.db ... OK
199
173
>>>
200
174
201
175
Next, the tests can be executed by calling the `test() ` function at the top of the package::
202
176
177
+
203
178
>>> pcse.test()
204
179
runTest (pcse.tests.test_abioticdamage.Test_FROSTOL) ... ok
205
- runTest (pcse.tests.test_assimilation.Test_WOFOST_Assimilation) ... ok
206
180
runTest (pcse.tests.test_partitioning.Test_DVS_Partitioning) ... ok
207
181
runTest (pcse.tests.test_evapotranspiration.Test_PotentialEvapotranspiration) ... ok
208
182
runTest (pcse.tests.test_evapotranspiration.Test_WaterLimitedEvapotranspiration1) ... ok
@@ -220,25 +194,26 @@ Next, the tests can be executed by calling the `test()` function at the top of t
220
194
runTest (pcse.tests.test_agromanager.TestAgroManager6) ... ok
221
195
runTest (pcse.tests.test_agromanager.TestAgroManager7) ... ok
222
196
runTest (pcse.tests.test_agromanager.TestAgroManager8) ... ok
223
- runTest (pcse.tests.test_wofost.TestPotentialSunflower) ... ok
224
197
runTest (pcse.tests.test_wofost.TestWaterlimitedWinterWheat) ... ok
198
+ runTest (pcse.tests.test_wofost.TestWaterlimitedWinterRapeseed) ... ok
225
199
runTest (pcse.tests.test_wofost.TestWaterlimitedSunflower) ... ok
200
+ runTest (pcse.tests.test_wofost.TestPotentialWinterRapeseed) ... ok
201
+ runTest (pcse.tests.test_wofost.TestPotentialSpringBarley) ... ok
202
+ runTest (pcse.tests.test_wofost.TestPotentialSunflower) ... ok
226
203
runTest (pcse.tests.test_wofost.TestPotentialPotato) ... ok
204
+ runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok
227
205
runTest (pcse.tests.test_wofost.TestPotentialWinterWheat) ... ok
206
+ runTest (pcse.tests.test_wofost.TestPotentialGrainMaize) ... ok
228
207
runTest (pcse.tests.test_wofost.TestWaterlimitedSpringBarley) ... ok
229
- runTest (pcse.tests.test_wofost.TestWaterlimitedGrainMaize) ... ok
230
- runTest (pcse.tests.test_wofost.TestWaterlimitedWinterRapeseed) ... ok
231
- runTest (pcse.tests.test_wofost.TestPotentialWinterRapeseed) ... ok
232
208
runTest (pcse.tests.test_wofost.TestWaterlimitedPotato) ... ok
233
- runTest (pcse.tests.test_wofost.TestPotentialSpringBarley) ... ok
234
- runTest (pcse.tests.test_wofost.TestPotentialGrainMaize) ... ok
235
209
runTest (pcse.tests.test_lintul3.TestLINTUL3_SpringWheat) ... ok
236
210
runTest (pcse.tests.test_wofost_npk.TestWOFOSTNPK_WinterWheat) ... ok
237
211
238
212
----------------------------------------------------------------------
239
- Ran 33 tests in 57.472s
213
+ Ran 32 tests in 54.306s
240
214
241
215
OK
216
+ >>>
242
217
243
218
If the model output matches the expected output the test will report 'OK',
244
219
otherwise an error will be produced with a detailed traceback on where the
@@ -248,10 +223,8 @@ due to problems with the test.
248
223
249
224
Moreover, SQLAlchemy may complain with a warning that can be safely ignored::
250
225
251
- /usr/lib/python2.7/dist-packages/sqlalchemy/types.py:307: SAWarning:
252
- Dialect sqlite+pysqlite does *not* support Decimal objects natively, and
253
- SQLAlchemy must convert from floating point - rounding errors and other
254
- issues may occur. Please consider storing Decimal numbers as strings or
255
- integers on this platform for lossless storage.
256
- d[coltype] = rp = d['impl'].result_processor(dialect, coltype)
226
+ C:\Miniconda3\envs\py3_pcse\lib\site-packages\sqlalchemy\sql\sqltypes.py:603: SAWarning:
227
+ Dialect sqlite+pysqlite does *not* support Decimal objects natively, and SQLAlchemy must
228
+ convert from floating point - rounding errors and other issues may occur. Please consider
229
+ storing Decimal numbers as strings or integers on this platform for lossless storage.
257
230
0 commit comments