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

Powertrain module import issues on install #23

Open
nataliejschultz opened this issue Jun 25, 2024 · 3 comments
Open

Powertrain module import issues on install #23

nataliejschultz opened this issue Jun 25, 2024 · 3 comments

Comments

@nataliejschultz
Copy link

In installing powertrain for the first time, I ran into some issues with running the notebooks. After cloning the repo and installing the environment + rust per install instructions:

Screenshot 2024-06-20 at 9 41 16 AM Screenshot 2024-06-20 at 10 27 27 AM

I made sure that powertrain was pip3 installed in both my base and powertrain envs.

base
Screenshot 2024-06-25 at 9 56 48 AM

powertrain conda env
Screenshot 2024-06-25 at 10 02 35 AM

I installed the powertrain scikit in the routee env:

Screenshot 2024-06-25 at 10 09 42 AM

and chose the routee env as my kernel to run. However, trying to run the notebook results in a module not found error.

Screenshot 2024-06-25 at 10 14 32 AM

So, I tried running the same command in a python REPL (activated in the exact same directory as the model_training.ipynb), and it worked just fine:

Screenshot 2024-06-25 at 10 21 40 AM

I believe the issue is due to relative import complications with ipynb specifically. It may be resolved by moving the notebook to a new location, or adding a small path script to the top of the notebook.

@nataliejschultz
Copy link
Author

nataliejschultz commented Jun 25, 2024

Another potential solution is to have users run a start script that activates the environment and runs a .py version of these notebooks, given that they've set values properly. For example, the path to the CSV could be set as an environment variable prior to running, or used as an argument.

ie:

bash ./start-model-training.sh path-to-csv

or, without a start script:

export $CSV_PATH=path-to-csv
python ./model-training-notebook.py

where model-training-notebook.py uses
CSV_PATH = os.environ.get(CSV_PATH)
and
df = pd.read_csv(str(CSV_PATH))

@jakeholden
Copy link
Collaborator

@nataliejschultz - after giving this more thought, I am starting to converge on the idea that we discussed with Nick last week, where our demo notebooks and scripts live in a separate repo. This mainly appeals to me because most users will not be installing powertrain from source, rather they will just install from PyPi or similar, so they will not readily have access to the demos that are buried in the package source code, right?

@nataliejschultz
Copy link
Author

nataliejschultz commented Jun 27, 2024

our demo notebooks and scripts live in a separate repo.

I think this is a good idea!

they will not readily have access to the demos that are buried in the package source code, right?

Nope, not if it's in a different repo and isn't integrated into the powertrain module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants