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

zsh: illegal hardware instruction python (mac m1 silicon) #310

Closed
JiaqiHu2021 opened this issue Jan 19, 2022 · 6 comments
Closed

zsh: illegal hardware instruction python (mac m1 silicon) #310

JiaqiHu2021 opened this issue Jan 19, 2022 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@JiaqiHu2021
Copy link

I run the following code in the terminal, I get the error "zsh: illegal hardware instruction python"

Python 3.9.7 (default, Sep 16 2021, 08:50:36) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from abess.linear import abessLogistic
>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.pipeline import Pipeline
>>> from sklearn.metrics import make_scorer, roc_auc_score
>>> from sklearn.preprocessing import PolynomialFeatures
>>> from sklearn.model_selection import GridSearchCV
>>> pipe = Pipeline([('poly', PolynomialFeatures(include_bias=False)), ('alogistic', abessLogistic())])
>>> param_grid = {'poly__interaction_only': [True, False],'poly__degree': [1, 2, 3]}
>>> scorer = make_scorer(roc_auc_score, greater_is_better=True)
>>> grid_search = GridSearchCV(pipe, param_grid, scoring=scorer, cv=5)
>>> X, y = load_breast_cancer(return_X_y=True)
>>> grid_search.fit(X, y)
@Mamba413
Copy link
Collaborator

Can you give me more details about your system info?

You can get them by running:

import platform
print("Platform Version: {0}, {1}".format(platform.platform(), platform.architecture()[0]))
print("Python Version:", platform.python_version())
import abess
print("Package Version:", abess.__version__)

@Mamba413 Mamba413 added bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Jan 19, 2022
@JiaqiHu2021
Copy link
Author

Platform Version: macOS-10.16-x86_64-i386-64bit, 64bit
Python Version: 3.9.7
Package Version: 0.3.6

@Mamba413
Copy link
Collaborator

Mamba413 commented Jan 19, 2022

Thanks.

It is a tough issue. We have to pay some time to fix it. If you are urgent to use abess on Mac with M1 chip, you can refer to: tensorflow/tensorflow#45404, tensorflow/tensorflow#46044, or https://www.tensorflow.org/install/source#bazel_build_options, https://stackoverflow.com/questions/65770132/python3-install-of-tensorflow-on-apple-silicon-m1. Another option is using it in Windows or Linux.

@Mamba413
Copy link
Collaborator

Mamba413 commented Jan 20, 2022

The following is a step-by-step procedure for solving this issue.

  1. Download miniforge from github: https://github.com/conda-forge/miniforge
    image

  2. Install it in terminal by commands:

mv Miniforge3-MacOSX-arm64.sh ~/
Chmod +x Miniforge3-MacOSX-arm64.sh
./Miniforge3-MacOSX-arm64.sh
  1. Activate and start a new environment named abess in terminal via:
conda create --name abess python=3.8
conda activate abess
  1. Follow the instruction to install the latest version of abess Python package.

After executing these steps, I believe the illegal hardware instruction python would be resolved.

If you meet any questions, feel free to contact us.

Mamba413 added a commit to Mamba413/abess that referenced this issue Jan 20, 2022
Mamba413 added a commit that referenced this issue Jan 20, 2022
@Mamba413 Mamba413 added documentation Improvements or additions to documentation and removed bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Jan 24, 2022
@Mamba413
Copy link
Collaborator

Hi @JiaqiHu2021 ,we have updated a new version in Pypi. We believe the newest version can successfully executed the following code:

>>> from abess.linear import abessLogistic
>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.pipeline import Pipeline
>>> from sklearn.metrics import make_scorer, roc_auc_score
>>> from sklearn.preprocessing import PolynomialFeatures
>>> from sklearn.model_selection import GridSearchCV
>>> pipe = Pipeline([('poly', PolynomialFeatures(include_bias=False)), ('alogistic', abessLogistic())])
>>> param_grid = {'poly__interaction_only': [True, False],'poly__degree': [1, 2, 3]}
>>> scorer = make_scorer(roc_auc_score, greater_is_better=True)
>>> grid_search = GridSearchCV(pipe, param_grid, scoring=scorer, cv=5)
>>> X, y = load_breast_cancer(return_X_y=True)
>>> grid_search.fit(X, y)

You can run

pip uninstall abess
pip install --no-cache-dir abess==0.4.2

to reinstall the latest abess library.

If you still meet any problem, feel free to contact us.

@JiaqiHu2021
Copy link
Author

After upgrading to the latest version, I successfully ran the above code.
Thank you very much for your help!

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

No branches or pull requests

4 participants