automl / HPOBench

Collection of hyperparameter optimization benchmark problems
Apache License 2.0
136 stars 35 forks source link

module 'os' has no attribute 'getuid' #160

Open tyf0416 opened 2 years ago

tyf0416 commented 2 years ago

When I tested the library on my laptop with the Windows system, the error information is shown below. I searched for the problem, and it seems that os.getuid is only applicable in Unix systems. _> s_elf.container_dir = self.cache_dir / f'hpobench-{os.getuid()}'

AttributeError: module 'os' has no attribute 'getuid'_

So, my question is:

Neeratyoy commented 2 years ago

Which benchmarks are you using? Are they the Raw benchmarks? Are they running on Windows?

tyf0416 commented 2 years ago

I tested the demo code provided in the README on Windows.

from hpobench.container.benchmarks.nas.tabular_benchmarks import SliceLocalizationBenchmark b = SliceLocalizationBenchmark(rng=1) config = b.get_configuration_space(seed=1).sample_configuration() result_dict = b.objective_function(configuration=config, fidelity={"budget": 100}, rng=1)

PhMueller commented 2 years ago

Hi, at the moment, we only support linux os. I am unsure if the used tech stack (singularity, pyro, ...) works on windows. So it is likely that we also will not add windows support in the future.

Have you tried to run it in WSL? I am curious to hear if that works :-)

Meganton commented 1 year ago

I had the same problem, after installing hpobench, i could not import anything from HPOBench on my windows laptop without getting the error. My workaround was to make a local clone of HPOBench and change just the line where the error occured. It is only used to first setup HPOBench, in HPOBench/hpobench/config.py, Line 67, i think to setup a temporary directory for the initialization process. self.container_dir = self.cache_dir / f'hpobench-{os.getuid()}' When i replaced the line with self.container_dir = self.cache_dir / f'hpobench-{Test}' It worked, i could import and run for example the mentioned README-example or the NN-Benchmark from hpobench/benchmarks/ml/. I don't know, wether this could be the base for an easy fix, but it worked for me.

Neeratyoy commented 1 year ago

This seems like an open issue so running our code on Windows would run into this issue. Since we are not offering Windows support as of now, the solution of fixing the directory manually and a local install as suggested by @Meganton should work.

@PhMueller could offer a sanity check and advise on if there might be any downstream effect of such a change.

PhMueller commented 1 year ago

Fixed in #170

PhMueller commented 1 year ago

At least the getuid() one. I don't have tested it with pyro and containers, but it seems like that @Meganton has successfully used it.

I leave that one here open for now. It would be awesome if you could share if it works for you now :-)

Meganton commented 1 year ago

Thank you for the fix @PhMueller ! It works for me now, but i could not test anything with singularity yet, since I don't have it installed. But the ml benchmarks work, so it's perfectly fine for my usecase.