Skip to content
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

Use python -m pip instead of the pip executable #605

Merged
merged 3 commits into from Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/pythonapp.yml
Expand Up @@ -30,21 +30,21 @@ jobs:
- name: Lint with flake8
run: |
python -m pip install --upgrade pip
pip install flake8
python -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
# PyTorch for Mac has different pip syntax wrt Win and Linux.
- name: Install pytorch 1.12.0 if mac
if: ${{ matrix.os == 'macos-11' }}
run: pip install torch==1.12.0
run: python -m pip install torch==1.12.0
- name: Install pytorch 1.12.0+cpu if not mac
if: ${{ matrix.os != 'macos-11' }}
run: pip install torch==1.12.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
run: python -m pip install torch==1.12.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install basic dependencies
run: |
pip install -e .[tests] -f https://download.pytorch.org/whl/torch_stable.html
python -m pip install -e .[tests] -f https://download.pytorch.org/whl/torch_stable.html
# Compile (but not push) documentation only for one of the runs (Linux py3.8).
- name: Generate Documentation
if: ${{ matrix.python-version == '3.8' && matrix.os == 'ubuntu-18.04' }}
Expand All @@ -54,7 +54,7 @@ jobs:
find ../. -type f -exec sed -i 's/torch.__version__/"1.12.0"/g' {} +
make sphinx-site -C website/
# now refresh the code
git checkout . && pip install -e .[tests] -f https://download.pytorch.org/whl/torch_stable.html
git checkout . && python -m pip install -e .[tests] -f https://download.pytorch.org/whl/torch_stable.html
- name: Run basic tests without extra
run: pytest
- name: Coverage on basic tests without extra
Expand All @@ -73,10 +73,10 @@ jobs:
export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp"
- name: Install extra dependencies
run: |
pip install .[extra,onnx,sparkml]
pip install pandas
- name: pip list
run: pip list
python -m pip install .[extra,onnx,sparkml]
python -m pip install pandas
- name: python -m pip list
run: python -m pip list
- uses: actions/cache@v1
# TVM takes forever, we try to cache it.
if: ${{ matrix.os != 'windows-2019' }}
Expand Down Expand Up @@ -129,8 +129,8 @@ jobs:
working-directory: ../../../tvm/python
run: |
python setup.py install
- name: pip list
run: pip list
- name: python -m pip list
run: python -m pip list
# We don't run pytest for Linux py3.8 since we do coverage for that case.
- name: Test with pytest
if: ${{ matrix.python-version != '3.8' || matrix.os != 'ubuntu-18.04' }}
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -35,7 +35,7 @@ The simplest setup (assuming you have PyTorch already installed) is:
mkdir hummingbird
cd hummingbird
git clone https://github.com/microsoft/hummingbird.git .
pip install -e .[tests,extra]
python -m pip install -e .[tests,extra]
```

If you do not have pytorch installed, please [install it](https://pytorch.org/get-started/locally/) first.
Expand All @@ -51,7 +51,7 @@ For a light-weight, web-based experience, we provide the configuration ([.devcon

### Tools
#### Pre-commit
This project uses [pre-commit](https://pre-commit.com/) hooks. Run `pip install pre-commit` if you don't already have this in your machine. Afterward, run `pre-commit install` to install pre-commit into your git hooks.
This project uses [pre-commit](https://pre-commit.com/) hooks. Run `python -m pip install pre-commit` if you don't already have this in your machine. Afterward, run `pre-commit install` to install pre-commit into your git hooks.

And before you commit, you can run it like this `pre-commit run --all-files` and should see output such as:

Expand Down Expand Up @@ -84,7 +84,7 @@ flake8 . --count --max-complexity=10 --max-line-length=127 --statistics

#### Coverage

For coverage, we use [coverage.py](https://coverage.readthedocs.io/en/coverage-5.0.4/) in our Github Actions. Run `pip install coverage` if you don't already have this, and any code you commit should generally not significantly impact coverage.
For coverage, we use [coverage.py](https://coverage.readthedocs.io/en/coverage-5.0.4/) in our Github Actions. Run `python -m pip install coverage` if you don't already have this, and any code you commit should generally not significantly impact coverage.

We strive to not let check-ins decrease coverage. To run all unit tests:
```
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -14,7 +14,7 @@ RUN cd /home/hb-dev && git clone https://github.com/microsoft/hummingbird.git
WORKDIR /home/hb-dev/hummingbird

# Install HB (Note: you may not need all of these packages and can remove some)
RUN sudo pip install -e .[docs,tests,extra,onnx]
RUN sudo python -m pip install -e .[docs,tests,extra,onnx]

# Install precommit hooks
RUN pre-commit install
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -70,12 +70,12 @@ Hummingbird requires PyTorch >= 1.6.0. Please go [here](https://pytorch.org/) fo

Once PyTorch is installed, you can get Hummingbird from pip with:
```
pip install hummingbird-ml
python -m pip install hummingbird-ml
```

If you require the optional dependencies lightgbm and xgboost, you can use:
```
pip install hummingbird-ml[extra]
python -m pip install hummingbird-ml[extra]
```


Expand Down
2 changes: 1 addition & 1 deletion TROUBLESHOOTING.md
Expand Up @@ -2,7 +2,7 @@

### Running PyTorch on GPU:

In order to run Hummingbird on PyTorch with GPU, you will need to `pip uninstall torch` and re-install pytorch using the CUDA version of your machine.
In order to run Hummingbird on PyTorch with GPU, you will need to `python -m pip uninstall torch` and re-install pytorch using the CUDA version of your machine.

### Installation Issues with External Libraries:

Expand Down
4 changes: 2 additions & 2 deletions hummingbird/ml/_utils.py
Expand Up @@ -120,7 +120,7 @@ def lightgbm_installed():
def assert_lightgbm_installed():
assert (
lightgbm_installed()
), "To convert LightGBM models you need to install LightGBM (or `pip install hummingbird-ml[extra]`)."
), "To convert LightGBM models you need to install LightGBM (or `python -m pip install hummingbird-ml[extra]`)."


def xgboost_installed():
Expand Down Expand Up @@ -151,7 +151,7 @@ def xgboost_installed():
def assert_xgboost_installed():
assert (
xgboost_installed()
), "To convert XGBoost models you need to install XGBoost (or `pip install hummingbird-ml[extra]`)."
), "To convert XGBoost models you need to install XGBoost (or `python -m pip install hummingbird-ml[extra]`)."


def tvm_installed():
Expand Down
18 changes: 9 additions & 9 deletions notebooks/LGBM-ONNX-example.ipynb
@@ -1,11 +1,11 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### This notebook shows how to convert from LGBM to ONNX"
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "code",
Expand All @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"# Uncomment and run this cell if you need to install Hummingbird and ONNX\n",
"#!pip install hummingbird_ml[extra,onnx]"
"#!python -m pip install hummingbird_ml[extra,onnx]"
]
},
{
Expand Down Expand Up @@ -42,14 +42,14 @@
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"LGBMClassifier()"
]
},
"execution_count": 3,
"metadata": {},
"execution_count": 3
"output_type": "execute_result"
}
],
"source": [
Expand All @@ -64,8 +64,8 @@
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"Finished loading model, total used 100 iterations\n"
]
Expand All @@ -84,8 +84,8 @@
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"502 ms ± 17.2 ms per loop (mean ± std. dev. of 3 runs, 1 loop each)\n"
]
Expand Down Expand Up @@ -120,4 +120,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
16 changes: 8 additions & 8 deletions notebooks/LGBM-ONNXML-example.ipynb
@@ -1,11 +1,11 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### This notebook shows how to convert from LGBM to ONNX and provides an example of the ONNXML converter"
],
"cell_type": "markdown",
"metadata": {}
]
},
{
"cell_type": "code",
Expand All @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"# Uncomment and run this cell if you need to install Hummingbird and ONNX\n",
"#!pip install hummingbird_ml[extra,onnx]"
"#!python -m pip install hummingbird_ml[extra,onnx]"
]
},
{
Expand Down Expand Up @@ -46,14 +46,14 @@
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"LGBMClassifier()"
]
},
"execution_count": 3,
"metadata": {},
"execution_count": 3
"output_type": "execute_result"
}
],
"source": [
Expand Down Expand Up @@ -93,8 +93,8 @@
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"output_type": "stream",
"text": [
"507 ms ± 16.8 ms per loop (mean ± std. dev. of 3 runs, 1 loop each)\n"
]
Expand Down Expand Up @@ -129,4 +129,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
2 changes: 1 addition & 1 deletion notebooks/LGBM-example.ipynb
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install hummingbird_ml[extra]"
"!python -m pip install hummingbird_ml[extra]"
]
},
{
Expand Down