HPOBench icon indicating copy to clipboard operation
HPOBench copied to clipboard

module 'os' has no attribute 'getuid'

Open tyf0416 opened this issue 3 years ago • 8 comments

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:

  • Can I use the HPOBench library on Windows? Or I need to use it on a Linux system. Regards

tyf0416 avatar Sep 19 '22 17:09 tyf0416

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

Neeratyoy avatar Sep 20 '22 16:09 Neeratyoy

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)

tyf0416 avatar Sep 21 '22 17:09 tyf0416

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 :-)

PhMueller avatar Sep 27 '22 14:09 PhMueller

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.

Meganton avatar Feb 18 '23 16:02 Meganton

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.

Neeratyoy avatar Feb 20 '23 00:02 Neeratyoy

Fixed in #170

PhMueller avatar Feb 22 '23 08:02 PhMueller

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 :-)

PhMueller avatar Feb 22 '23 08:02 PhMueller

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.

Meganton avatar Feb 23 '23 20:02 Meganton