yngtdd / hyperspace

Distributed Bayesian Optimization
23 stars 8 forks source link

error importing module #18

Closed jdakka closed 5 years ago

jdakka commented 5 years ago

When I do from hyperspace.space.skopt.mapping_space import check_dimension, fold_spaces, the hyperband module appears to have a syntax issue:

.../hyperband.py", line 69
    print(f'Rank {rank} Iteration number: {i}, Func value: {result.fun}')
yngtodd commented 5 years ago

Huh, that is interesting. Which Python version are you using?

jdakka commented 5 years ago

Python 3.5.2

yngtodd commented 5 years ago

Ahh yeah, I am using f-strings there. Those came out in Python 3.6.

I just tested it out with a conda environment using Python 3.5.2. Oddly, I don't get that error when I just import check_dimension and fold_spaces, but I do hit it when I run an example using hyperband.py:

SyntaxError: invalid syntax
Traceback (most recent call last):
  File "hyperbelt.py", line 18, in <module>
    from hyperspace import hyperbelt
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/youngtodd/anaconda3/envs/python352/lib/python3.5/site-packages/hyperspaces-0.2.3-py3.5.egg/hyperspace/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/youngtodd/anaconda3/envs/python352/lib/python3.5/site-packages/hyperspaces-0.2.3-py3.5.egg/hyperspace/hyperdrive/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/youngtodd/anaconda3/envs/python352/lib/python3.5/site-packages/hyperspaces-0.2.3-py3.5.egg/hyperspace/hyperdrive/hyperbelt/__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 896, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1139, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1115, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1096, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 444, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 533, in spec_from_file_location
  File "/Users/youngtodd/anaconda3/envs/python352/lib/python3.5/site-packages/hyperspaces-0.2.3-py3.5.egg/hyperspace/hyperdrive/hyperbelt/hyperband.py", line 69
    print(f'Rank {rank} Iteration number: {i}, Func value: {result.fun}')

Would it be much of a hassle to run Python >= 3.6? If it is, I could look into how much would have to change to support 3.5.

jdakka commented 5 years ago

Using Python 3.6.6 (miniconda3 installation) it was able to import correctly on PSC Bridges. Note however that I could not install using pip but had to do a python setup.py install. Not sure if you face such issues with 3.6 and pip

yngtodd commented 5 years ago

Cool, I am glad that it is working with Python 3.6.

I am not sure what happened with the pip install. I just tested pip install . and it seemed to work fine on my end.

yngtodd commented 5 years ago

Cool if I close this? Feel free to open it back up if anything comes up!