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

fix: error handle in initial configuration #89

Merged
merged 1 commit into from
Sep 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ The framework is built on top of PyTorch, a widely-used deep learning framework,

## Installation

### Step 1: Install multiworld package

To use the latest official package,

```bash
Expand All @@ -56,12 +54,6 @@ To install the package from source,
pip install .
```

### Step 2: Run post installation script

```bash
m8d-post-setup
```

## Running Examples

The list of all examples that are available can be found in the [`examples`](/examples) folder.
Expand Down
12 changes: 10 additions & 2 deletions multiworld/post_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@


def configure_once():
"""Configure multiworld once when it is used for the first time."""
package_name = __name__.split(".")[0]
path_to_sitepackages = site.getsitepackages()[0]

init_file_path = os.path.join(path_to_sitepackages, package_name, "init.txt")

with open(init_file_path, "r") as file:
patch_applied = file.read()
try:
with open(init_file_path, "r") as file:
patch_applied = file.read()
except FileNotFoundError:
message = "WARNING: initialization check file not found; "
message += f"{package_name} is not installed correctly; "
message += "please reinstall."
print(message)
return

if patch_applied == "true":
return
Expand Down