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

Solve chip confilct in import.util package #89

Closed
ShiqiYang2022 opened this issue Oct 19, 2023 · 8 comments · Fixed by #90
Closed

Solve chip confilct in import.util package #89

ShiqiYang2022 opened this issue Oct 19, 2023 · 8 comments · Fixed by #90
Assignees

Comments

@ShiqiYang2022
Copy link
Collaborator

Follows gslab-econ/gslab_make#65 (comment).

This issue aims to solve the conflict arising the from the Mac M2 chip on @snairdesai's local machine. The standard template run into an error in import.util package, and is no longer compiling on his updated conda environment local machine (though it did previously, and succeed on @jc-cisneros @ShiqiYang2022 end).

This suggests import.util package was updated in the conda environment no longer supported by Apple Silicon. A hot fix which manually installed the import.util package to his local computer before building the conda environment worked. This issue aim to explore and compare other methods, currently the potential candidates includes:

  • Frozen the version of package in conda_env.yaml.
  • Edit codes in check_setup.py and run_all.py to solve the conflict when compiling.
@ShiqiYang2022
Copy link
Collaborator Author

ShiqiYang2022 commented Oct 21, 2023

Per my investigation, I think it's rather a problem due to python package, instead of chips.

In Python versions 3.10.11+ through 3.12.0a7+, importlib.util is not referenced in importlib/__init__.py, so by directly import importlib, it will throw an AttributeError. If you intend to use importlib.util in a regular Python environment, you should directly import importlib.util instead of trying to import .util from importlib. Details could be referred per threads here.

I removed the conda env template on my local machine and re-run template. Initially I failed in the same error in gslab-econ/gslab_make#65 (comment). After I edit the code to import importlib.util directly in f12dcd2, the template can successfully compiled again.

@ShiqiYang2022
Copy link
Collaborator Author

ShiqiYang2022 commented Oct 21, 2023

@snairdesai See this comment, could you please edit run_all.py in the same commit f12dcd2 and re-construct the template? Once the template worked on your end, I will open a new pull request. Thanks!

@snairdesai
Copy link
Contributor

Will do!

@snairdesai
Copy link
Contributor

@ShiqiYang2022 Confirming this ran on my end, great work! One comment, I am getting these odd warning lines in terminal when running this:


Screenshot 2023-10-20 at 5 53 05 PM
Screenshot 2023-10-20 at 5 53 20 PM

Do we think the way we are handling the escape characters might be linked to importlib.util in some way? Is this also appearing on your end?

cc @jc-cisneros

@ShiqiYang2022
Copy link
Collaborator Author

@snairdesai Thanks! Same warning on my end and I am investigating it!

ShiqiYang2022 added a commit that referenced this issue Oct 21, 2023
@ShiqiYang2022
Copy link
Collaborator Author

ShiqiYang2022 commented Oct 21, 2023

@snairdesai Maybe give it another shot after a6f828c, I think per f12dcd2 we lose some function in original importlib but not in importlib.util. It showed to be a right fix on my end. Thanks!

@snairdesai
Copy link
Contributor

Looks perfect, thanks @ShiqiYang2022! Good to port to a PR -- feel free to assign me (I'll get to this sometime over the weekend).

@ShiqiYang2022 ShiqiYang2022 linked a pull request Oct 21, 2023 that will close this issue
ShiqiYang2022 added a commit that referenced this issue Oct 23, 2023
* #89 Fix import.util error

* #89 Address small warning
@ShiqiYang2022
Copy link
Collaborator Author

ShiqiYang2022 commented Oct 23, 2023

Summary

In this issue we fixed the error when running import.util package, described in #89 (comment). The solution was to import import.util directly instead import .util under the importlib module (more details in #89 (comment)).

The fixes were brought to master in #90.
Final stage of the branch before merge is here.

cc: @snairdesai @jc-cisneros

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

Successfully merging a pull request may close this issue.

3 participants