-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Developer Guide for Python users #1512
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
This page gives some general instructions and tips to build and develop Analytics Zoo for Python developers. | ||
|
||
You are very welcome to add customized functionalities to Analytics Zoo to meet your own demands. | ||
You are also highly encouraged to contribute to Analytics Zoo for extra features so that other community users would get benefits as well. | ||
|
||
--- | ||
## **Download Analytics Zoo Source Code** | ||
Analytics Zoo source code is available at [GitHub](https://github.com/intel-analytics/analytics-zoo): | ||
|
||
```bash | ||
git clone https://github.com/intel-analytics/analytics-zoo.git | ||
``` | ||
|
||
By default, `git clone` will download the development version of Analytics Zoo. If you want a release version, you can use the command `git checkout` to change the specified version. | ||
|
||
|
||
--- | ||
## **Build whl package for pip install** | ||
If you have modified some Python code and want to newly generate the [whl](https://pythonwheels.com/) package for pip install, you can run the following script: | ||
|
||
```bash | ||
bash analytics-zoo/pyzoo/dev/build.sh linux default | ||
``` | ||
|
||
**Arguments:** | ||
|
||
- The first argument is the __platform__ to build for. Either 'linux' or 'mac'. | ||
- The second argument is the analytics-zoo __version__ to build for. 'default' means the default version for the current branch. You can also specify a different version if you wish, e.g., '0.6.0.dev1'. | ||
- You can also add other profiles to build the package, especially Spark and BigDL versions. | ||
For example, under the situation that `pyspark==2.4.3` is a dependency, you need to add profiles `-Dspark.version=2.4.3 -Dbigdl.artifactId=bigdl-SPARK_2.4 -P spark_2.x` to build Analytics Zoo for Spark 2.4.3. | ||
|
||
|
||
After running the above command, you will find a `whl` file under the folder `analytics-zoo/pyzoo/dist/`. You can then directly pip install it to your local Python environment: | ||
```bash | ||
pip install analytics-zoo/pyzoo/dist/analytics_zoo-VERSION-py2.py3-none-PLATFORM_x86_64.whl # for Python 2.7 | ||
pip3 install analytics-zoo/pyzoo/dist/analytics_zoo-VERSION-py2.py3-none-PLATFORM_x86_64.whl # for Python 3.5 and Python 3.6 | ||
``` | ||
|
||
See [here](../PythonUserGuide/install/#install-from-pip-for-local-usage) for more remarks related to pip install. | ||
|
||
See [here](../PythonUserGuide/run/#run-after-pip-install) for more instructions to run analytics-zoo after pip install. | ||
|
||
|
||
--- | ||
## **Run in IDE** | ||
You need to do the following preparations before starting the Integrated Development Environment (IDE) to successfully run an Analytics Zoo Python program in the IDE: | ||
|
||
- Build Analytics Zoo. See [here](../ScalaUserGuide/install/#build-with-script-recommended) for more instructions. | ||
- Prepare Spark environment by either setting `SPARK_HOME` as the environment variable or pip install `pyspark`. Note that the Spark version should match the one you build Analytics Zoo on. | ||
- Set BIGDL_CLASSPATH: | ||
```bash | ||
export BIGDL_CLASSPATH=analytics-zoo/dist/lib/analytics-zoo-*-jar-with-dependencies.jar | ||
``` | ||
|
||
- Prepare BigDL Python environment by either downloading BigDL from [GitHub](https://github.com/intel-analytics/BigDL) or pip install `bigdl`. Note that the BigDL version should match the one you build Analytics Zoo on. | ||
- Add `pyzoo` and `spark-analytics-zoo.conf` to `PYTHONPATH`: | ||
```bash | ||
export PYTHONPATH=analytics-zoo/pyzoo:analytics-zoo/dist/conf/spark-analytics-zoo.conf:$PYTHONPATH | ||
``` | ||
If you download BigDL from [GitHub](https://github.com/intel-analytics/BigDL), you also need to add `BigDL/pyspark` to `PYTHONPATH`: | ||
```bash | ||
export PYTHONPATH=BigDL/pyspark:$PYTHONPATH | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Copyright 2018 Analytics Zoo Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
set -e | ||
RUN_SCRIPT_DIR=$(cd $(dirname $0) ; pwd) | ||
echo $RUN_SCRIPT_DIR | ||
|
||
if (( $# < 2)); then | ||
echo "Usage: build.sh platform version mvn_parameters" | ||
echo "Usage example: bash release.sh linux default" | ||
echo "Usage example: bash release.sh linux 0.6.0.dev0" | ||
echo "If needed, you can also add other profiles such as: -Dspark.version=2.4.3 -Dbigdl.artifactId=bigdl-SPARK_2.4 -P spark_2.x" | ||
exit -1 | ||
fi | ||
|
||
platform=$1 | ||
version=$2 | ||
profiles=${*:3} | ||
|
||
bash ${RUN_SCRIPT_DIR}/release.sh ${platform} ${version} false ${profiles} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the link is broken @hkvision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is working not broken: https://analytics-zoo.github.io/master/#PythonUserGuide/install/#install-from-pip-for-local-usage