automl / auto-sklearn

Automated Machine Learning with scikit-learn
https://automl.github.io/auto-sklearn
BSD 3-Clause "New" or "Revised" License
7.64k stars 1.28k forks source link

pynisher 1.0 version incompatability with auto-sklearn 0.14.6 #1582

Open teresa-m opened 2 years ago

teresa-m commented 2 years ago

Describe the bug

The AutoSklearnClassifier results in an error concerning pynisher when using versions: pynisher 1.0 and auto-sklearn 0.14.6. Earlier pynisher versions are working fine. I am not sure if this issue is based on my setup. It would be great if you could help me or point out what could go wrong. Thank you a lot for auto-sklearn and your help of course!

To Reproduce

Steps to reproduce the behavior:

  1. Created a conda package
    conda create -n test_autosklearn -c conda-forge scikit-learn numpy auto-sklearn
  2. Then I used the following code snippets from your classification example
    
    import sklearn.datasets
    import autosklearn.classification

loading data:

X, y = sklearn.datasets.load_breast_cancer(return_X_y=True) X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, random_state=1)

-c conda-forge -c bioconda

automl = autosklearn.classification.AutoSklearnClassifier(time_left_for_this_task=120, per_run_time_limit=30, tmp_folder='/vol/scratch/data_storage/test_biofilm/autosklearn_classification_example_tmp', ) automl.fit(X_train, y_train, dataset_name='breast_cancer')

3. This ends up in the following error message:

Traceback (most recent call last): File "/vol/scratch/data_storage/test_biofilm/test_autosklearn.py", line 15, in automl.fit(X_train, y_train, dataset_name='breast_cancer') File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/estimators.py", line 1045, in fit [ERROR] [2022-09-05 12:34:00,111:Client-AutoML(1):breast_cancer] Dummy prediction failed with run state StatusType.CRASHED and additional output: {'traceback': 'Traceback (most recent call last):\n File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/evaluation/init.py", line 349, in run\n obj = pynisher.enforce_limits(arguments)(self.ta)\nAttributeError: module \'pynisher\' has no attribute \'enforce_limits\'\n', 'error': 'AttributeError("module \'pynisher\' has no attribute \'enforce_limits\'")'}. super().fit( File "/vol/scratch/data_storage/software/miniconda3/envs/testautosklearn/lib/python3.9/site-packages/autosklearn/estimators.py", line 375, in fit self.automl.fit(load_models=self.load_models, kwargs) File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/automl.py", line 2056, in fit return super().fit( File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/automl.py", line 808, in fit self.num_run += self._do_dummy_prediction(datamanager, num_run=1) File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/automl.py", line 476, in _do_dummy_prediction raise ValueError( ValueError: Dummy prediction failed with run state StatusType.CRASHED and additional output: {'traceback': 'Traceback (most recent call last):\n File "/vol/scratch/data_storage/software/miniconda3/envs/test_autosklearn/lib/python3.9/site-packages/autosklearn/evaluation/init.py", line 349, in run\n obj = pynisher.enforce_limits(**arguments)(self.ta)\nAttributeError: module \'pynisher\' has no attribute \'enforce_limits\'\n', 'error': 'AttributeError("module \'pynisher\' has no attribute \'enforce_limits\'")'}.



## Expected behavior ##
I am using miniconda version 4.14.0. and by not specifying any versions the creation step of the conda environment ends up with 1.0.0 for pynisher and  0.14.6 for auto-sklearn. Using an environment with this version combination ends up in an error when building a classification model. Once I set pynisher version to 0.6.4 it works fine.  

## Actual behavior, stacktrace or logfile ##
See error message above.

## Environment and installation: ##

Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-89-generic x86_64)
14 cores and 64 GB RAM
python version: 3.9.13
prasad-yashdeep commented 2 years ago

I am facing the same issue as well on version 0.14.7

eddiebergman commented 2 years ago

Hi @teresa-m, @prasad-yashdeep,

Sorry for the delay. In principal with the latest released version 0.14.7, the pip installation should work:

Based on this, the pip install should give you a pynisher version that works, i.e. 0.6.4, but apparently that's not the case.

Therefore giving the versions of autosklearn, smac and pynisher together would be most useful.

Secondly, it seems conda-forge might be the culprit. The version installed from conda-forge is not maintained by us and we only maintain the pip install version. I would hope to remove the need for conda-forge which handles dependencies that have to be compiled. We released these precompiled for Linux but we have some legacy dependancies which are linux only. This is likely not very soon though.

tldr;

Best, Eddie