Skip to content

Commit 3bd3010

Browse files
authored
[Cmake][R][ipu] cleanup 3.7 for python code - Part1 (PaddlePaddle#59875)
* cleanup 3.7 doc and code * add setup.py.in
1 parent c70062e commit 3bd3010

File tree

12 files changed

+29
-22
lines changed

12 files changed

+29
-22
lines changed

.github/ISSUE_TEMPLATE/3_build-installation-issue.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ body:
3737
2. CPU(可选):请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库的使用情况,是否支持AVX指令集。
3838
3. GPU:请提供GPU型号,CUDA(如cuda10.2)和CUDNN版本号(如cudnn7.6.5)。
3939
4. 系统环境:请说明系统类型、版本(如Mac OS 10.14)。
40-
5. Python版本(如python 3.7)。
40+
5. Python版本(如python 3.8)。
4141
6. (可选)若安装过程遇到问题,请提供安装方式(pip/conda/docker/源码编译)和相应的安装命令。
4242
7. (可选)若使用paddle过程中,遇到了无法使用gpu相关问题,请在命令行中键入`nvidia-smi`和`nvcc -V`,提供这两个命令输出的截图。
4343
8. (可选)若使用特殊硬件,请单独注明。

cmake/python_module.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function(check_py_version py_version)
5353
string(REPLACE "." ";" version_list ${py_version})
5454
list(LENGTH version_list version_list_len)
5555
if(version_list_len LESS 2)
56-
message(FATAL_ERROR "Please input Python version, eg:3.7 or 3.8 and so on")
56+
message(FATAL_ERROR "Please input Python version, eg:3.8 or 3.9 and so on")
5757
endif()
5858

5959
list(GET version_list 0 version_major)
@@ -62,6 +62,6 @@ function(check_py_version py_version)
6262
if((version_major GREATER_EQUAL 3) AND (version_minor GREATER_EQUAL 7))
6363

6464
else()
65-
message(FATAL_ERROR "Paddle only support Python version >=3.7 now!")
65+
message(FATAL_ERROR "Paddle only support Python version >=3.8 now!")
6666
endif()
6767
endfunction()

paddle/cinn/auto_schedule/cost_model/xgb_cost_model.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pybind11::array VectorToNumpy(const std::vector<std::vector<Dtype>>& vec) {
7171
// Something may be wrong when users use virtual Python environment.
7272
void AddDistPkgToPythonSysPath() {
7373
pybind11::module sys_py_mod = pybind11::module::import("sys");
74-
// short version such as "3.7", "3.8", ...
74+
// short version such as "3.8", "3.9", ...
7575
std::string py_short_version =
7676
sys_py_mod.attr("version").cast<std::string>().substr(0, 3);
7777

python/paddle/base/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ def __bootstrap__():
144144
Returns:
145145
None
146146
"""
147-
# NOTE(zhiqiu): When (1)numpy < 1.19; (2) python < 3.7,
148-
# unittest is always imported in numpy (maybe some versions not).
149-
# so is_test is True and p2p is not inited.
150147
in_test = 'unittest' in sys.modules
151148

152149
try:

python/setup.py.in

+9-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,15 @@ if sys.version_info < (3,8):
533533
if sys.version_info >= (3,8):
534534
setup_requires_tmp = []
535535
for setup_requires_i in setup_requires:
536-
if "<\"3.6\"" in setup_requires_i or "<=\"3.6\"" in setup_requires_i or "<\"3.5\"" in setup_requires_i or "<=\"3.5\"" in setup_requires_i or "<\"3.7\"" in setup_requires_i:
536+
if (
537+
"<\"3.6\"" in setup_requires_i
538+
or "<=\"3.6\"" in setup_requires_i
539+
or "<\"3.5\"" in setup_requires_i
540+
or "<=\"3.5\"" in setup_requires_i
541+
or "<\"3.7\"" in setup_requires_i
542+
or "<=\"3.7\"" in setup_requires_i
543+
or "<\"3.8\"" in setup_requires_i
544+
):
537545
continue
538546
setup_requires_tmp+=[setup_requires_i]
539547
setup_requires = setup_requires_tmp

r/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ docker build -t paddle-rapi:latest .
1212
```
1313

1414
### Local installation
15-
First, make sure `Python` is installed, assuming that the path is `/opt/python3.7`.
15+
First, make sure `Python` is installed, assuming that the path is `/opt/python3.8`.
1616

1717
``` bash
1818
python -m pip install paddlepaddle # CPU version
@@ -31,7 +31,7 @@ First, load PaddlePaddle in R.
3131
library(reticulate)
3232
library(RcppCNPy)
3333

34-
use_python("/opt/python3.7/bin/python3.7")
34+
use_python("/opt/python3.8/bin/python3.8")
3535
paddle <- import("paddle.base.core")
3636
```
3737

r/README_cn.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
在 R 中使用 PaddlePaddle
33

44
## 环境安装
5-
首先确保已安装Python,假设路径为`/opt/python3.7`
5+
首先确保已安装Python,假设路径为`/opt/python3.8`
66

77
使用Python安装Paddle
88
``` bash
9-
/opt/python3.7/bin/python3.7 -m pip install paddlepaddle # CPU
10-
/opt/python3.7/bin/python3.7 -m pip install paddlepaddle-gpu # GPU
9+
/opt/python3.8/bin/python3.8 -m pip install paddlepaddle # CPU
10+
/opt/python3.8/bin/python3.8 -m pip install paddlepaddle-gpu # GPU
1111
```
1212

1313
安装r运行paddle预测所需要的库
@@ -20,7 +20,7 @@ install.packages("reticulate") # 调用Paddle
2020

2121
``` r
2222
library(reticulate)
23-
use_python("/opt/python3.7/bin/python")
23+
use_python("/opt/python3.8/bin/python")
2424

2525
paddle <- import("paddle.base.core")
2626
```

r/example/mobilenet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3.7
1+
#!/usr/bin/env python3.8
22

33
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
44
#

r/example/mobilenet.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
library(reticulate) # call Python library
44

5-
use_python("/opt/python3.7/bin/python")
5+
use_python("/opt/python3.8/bin/python")
66

77
np <- import("numpy")
88
paddle <- import("paddle.base.core")

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,8 @@ def get_setup_requires():
882882
or "<\"3.5\"" in setup_requires_i
883883
or "<=\"3.5\"" in setup_requires_i
884884
or "<\"3.7\"" in setup_requires_i
885+
or "<=\"3.7\"" in setup_requires_i
886+
or "<\"3.8\"" in setup_requires_i
885887
):
886888
continue
887889
setup_requires_tmp += [setup_requires_i]

test/ipu/distributed/test_dist_pod128_sample.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
'''
15-
python3.7 -m paddle.distributed.launch \
15+
python3.8 -m paddle.distributed.launch \
1616
--devices=128 \
1717
ipu \
1818
--hosts=host1,host2 \
@@ -31,7 +31,7 @@
3131
--vipu-partition=pod128_bert \
3232
--vipu-server-host=lr17-1-ctrl \
3333
--update-partition=yes \
34-
python3.7 test/ipu/disabled/test_dist_pod128_ipu.py
34+
python3.8 test/ipu/disabled/test_dist_pod128_ipu.py
3535
'''
3636

3737
import os

test/ipu/distributed/test_dist_sample.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
'''
1515
Single host:
16-
python3.7 -m paddle.distributed.launch \
16+
python3.8 -m paddle.distributed.launch \
1717
--devices=4 \
1818
ipu \
1919
--hosts=localhost \
@@ -29,11 +29,11 @@
2929
--num-replicas=4 \
3030
--ipus-per-replica=1 \
3131
--print-topology=yes \
32-
python3.7 test/ipu/distributed/test_dist_sample.py
32+
python3.8 test/ipu/distributed/test_dist_sample.py
3333
'''
3434
'''
3535
Multi hosts:
36-
python3.7 -m paddle.distributed.launch \
36+
python3.8 -m paddle.distributed.launch \
3737
--devices=4 \
3838
ipu \
3939
--hosts=host1,host2 \
@@ -49,7 +49,7 @@
4949
--num-replicas=4 \
5050
--ipus-per-replica=1 \
5151
--print-topology=yes \
52-
python3.7 test/ipu/distributed/test_dist_sample.py
52+
python3.8 test/ipu/distributed/test_dist_sample.py
5353
'''
5454

5555
import os

0 commit comments

Comments
 (0)