Skip to content

Simplify pip install process #19

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
# Create the softlink to the workspace as install.sh requires to run from its parent directory
ln -s "${WORKSPACE}" executorch
# Install executorch
source executorch/install.sh
# source executorch/install.sh
sleep 300
python3 -m pip install executorch

# Just print out the list of packages for debugging
pip list
10 changes: 4 additions & 6 deletions docs/website/docs/tutorials/setting_up_executorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,27 @@ pip install --pre torch -i https://download.pytorch.org/whl/nightly/cpu

**Step 2: Set up Executorch**. This will install an `executorch` pip package to your conda environment.
```bash
mkdir -p ~/src/
cd ~/src/

# Do one of these, depending on how your auth is set up
git clone https://github.com/pytorch/executorch.git
git clone [email protected]:pytorch/executorch.git

# Run the following to get all submodules
# [Runtime requirement] Run the following to get all submodules, only need for runtime setup
git submodule update --init --recursive

./executorch/install.sh
pip install executorch

# cd into a directory that doesn't contain a `./executorch/exir` directory, since
# otherwise python will try using it for `import executorch.exir...` instead of using the
# installed pip package.
cd ~/
cd executorch
```

**Step 3: Try it out**

Via python script:
```
python ~/src/executorch/examples/export/export_example.py -m "add"
python ~/executorch/examples/export/export_example.py -m "add"
```

Or via python interpreter:
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ dependencies=[
"sympy",
]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"*" = ["*.fbs", "*.yaml"]

Expand Down
57 changes: 57 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# from setuptools import setup, find_packages
import os
import shutil

from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install


def custom_command():
src_dst_list = [
("schema/scalar_type.fbs", "exir/serialize/scalar_type.fbs"),
("schema/schema.fbs", "exir/serialize/schema.fbs"),
]
for src, dst in src_dst_list:
print(f"copying from {src} to {dst}")
shutil.copyfile(src, dst)

for _, dst in src_dst_list:
if not os.path.isfile(dst):
raise FileNotFoundError(
f"Could not find {dst}, copying file from {src} fails."
)


class CustomInstallCommand(install):
def run(self):
custom_command()
install.run(self)


class CustomDevelopCommand(develop):
def run(self):
custom_command()
develop.run(self)


class CustomEggInfoCommand(egg_info):
def run(self):
custom_command()
egg_info.run(self)


setup(
package_dir={
"executorch/backends": "backends",
"executorch/exir": "exir",
"executorch/schema": "schema",
"executorch/extension": "extension",
},
cmdclass={
"install": CustomInstallCommand,
"develop": CustomDevelopCommand,
"egg_info": CustomEggInfoCommand,
},
)
1 change: 1 addition & 0 deletions third-party/buck2
Submodule buck2 added at 4b1e57