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

Problem while running example. #13

Open
OOF-dura opened this issue Jun 30, 2021 · 2 comments
Open

Problem while running example. #13

OOF-dura opened this issue Jun 30, 2021 · 2 comments

Comments

@OOF-dura
Copy link

Traceback (most recent call last):
  File "/media/frank/easystore/Code/P2S/mlopt/test.py", line 2, in <module>
    from mlopt.sampling import uniform_sphere_sample
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/__init__.py", line 1, in <module>
    from mlopt.optimizer import Optimizer
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/optimizer.py", line 4, in <module>
    from mlopt.learners import LEARNER_MAP, installed_learners
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/__init__.py", line 1, in <module>
    from mlopt.learners.pytorch.pytorch import PytorchNeuralNet
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/pytorch/pytorch.py", line 2, in <module>
    import mlopt.learners.pytorch.settings as pts
AttributeError: module 'mlopt' has no attribute 'learners'

Process finished with exit code 1

@Chen0917
Copy link

Same issue here. It seems this is relevant to the way to import sub-packages with absolute path info. Would the author consider experimenting on a fresh Python without existing original package code?

Thanks!

@Chen0917
Copy link

Traceback (most recent call last):
  File "/media/frank/easystore/Code/P2S/mlopt/test.py", line 2, in <module>
    from mlopt.sampling import uniform_sphere_sample
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/__init__.py", line 1, in <module>
    from mlopt.optimizer import Optimizer
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/optimizer.py", line 4, in <module>
    from mlopt.learners import LEARNER_MAP, installed_learners
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/__init__.py", line 1, in <module>
    from mlopt.learners.pytorch.pytorch import PytorchNeuralNet
  File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/pytorch/pytorch.py", line 2, in <module>
    import mlopt.learners.pytorch.settings as pts
AttributeError: module 'mlopt' has no attribute 'learners'

Process finished with exit code 1

It's the circular import. Check this commit (https://github.com/laf070810/mlopt.git). Many thanks to @laf070810 !

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

No branches or pull requests

2 participants