Unable to import deepreg into other python applications, using the 0.1.2 release.
>> import deepreg
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\__init__.py", line 2, in <module>
import deepreg.dataset
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\dataset\__init__.py", line 2, in <module>
import deepreg.dataset.loader
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\dataset\loader\__init__.py", line 2, in <module>
from deepreg.dataset.loader.grouped_loader import GroupedDataLoader
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\dataset\loader\grouped_loader.py", line 11, in <module>
from deepreg.dataset.loader.interface import (
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\dataset\loader\interface.py", line 12, in <module>
from deepreg.dataset.preprocess import resize_inputs
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\dataset\preprocess.py", line 11, in <module>
from deepreg.model.layer_util import (
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\model\__init__.py", line 2, in <module>
import deepreg.model.backbone
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\model\backbone\__init__.py", line 2, in <module>
from deepreg.model.backbone.global_net import GlobalNet
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\model\backbone\global_net.py", line 8, in <module>
from deepreg.model import layer, layer_util
File "C:\Users\zac_b\AppData\Local\NA-MIC\Slicer 4.13.0-2021-01-05\lib\Python\Lib\site-packages\deepreg\model\layer.py", line 6, in <module>
import deepreg.model.layer_util as layer_util
AttributeError: module 'deepreg' has no attribute 'model'
I suspect this has to do with the fact that layer_util is a module and not an attribute, which is why the import deepreg.model.layer_util as layer_util error is thrown.
This should be able to be resolved by replacing that code with from deepreg.model import layer_util.
If the bug is confirmed, would you be willing to submit a PR? _(Help can be provided if
you need assistance submitting a PR)_
Yes
See above; call import deepreg.
deepreg should import, and then allow the user to make calls from within the API.
See above.
@YipengHu @mathpluscode - thoughts?
@YipengHu @mathpluscode - thoughts?
I installed via pip and did following
(deepreg) mathpluscode@mathpluscode-XPS-13-9300:~/Git/DeepReg$ python
Python 3.7.9 (default, Aug 31 2020, 12:42:55)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import deepreg
2021-02-01 10:36:50.961043: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
>>>
I got no problem in Linux, btw we officially require py3.7 on Linux only.
Will check more later.
@YipengHu @mathpluscode - thoughts?
I installed via pip and did following
(deepreg) mathpluscode@mathpluscode-XPS-13-9300:~/Git/DeepReg$ python Python 3.7.9 (default, Aug 31 2020, 12:42:55) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import deepreg 2021-02-01 10:36:50.961043: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1 >>>I got no problem in Linux, btw we officially require py3.7 on Linux only.
Will check more later.
Yes - no problem for me on Linux either; just a windows issue. But we need to try and find something if we want to be able to make the slicer extension work :)
Actually, I wonder if we can do CI on win/mac os, https://github.com/actions/virtual-environments.
Regarding this error, can you at least try on py3.7 LOL... it's just a random guess if py version can be the reason.
Regarding this error, can you at least try on py3.7 LOL... it's just a random guess if py version can be the reason.
Can't use any python other than 3.6.7 - That's what's built-in to 3D Slicer in the latest versions. It may increase in the future, but that's not something we can bank on.
Regarding this error, can you at least try on py3.7 LOL... it's just a random guess if py version can be the reason.
Can't use any python other than 3.6.7 - That's what's built-in to 3D Slicer in the latest versions. It may increase in the future, but that's not something we can bank on.
I see! Then maybe we need two issues:
I'm closing this before raising another ticket reporting for a specific bug #664.
@YipengHu this issue is not related to #664?
@zacbaum see if you would like to close this in favour of adding a doc to avoid others to go through what you experienced?
Without a change to the code, things can't be solved - I'd rather find a fix that didn't involve users needing to edit code manually
@zacbaum is this still blocking you?
@zacbaum is this still blocking you?
SInce nothing has been changed... I'd suspect yes. Right now, this requires a change to the source code after pip installing in slicer (messy and not good practice). I haven't had a chance to try this workaround in a Linux system to check if tests pass with it.
@zacbaum is this still blocking you?
SInce nothing has been changed... I'd suspect yes. Right now, this requires a change to the source code after pip installing in slicer (messy and not good practice). I haven't had a chance to try this workaround in a Linux system to check if tests pass with it.
Sure, I guess the solution should be supporting multiple python versions.
I think I've managed to recreate this issue https://github.com/DeepRegNet/DeepReg/pull/684/checks?check_run_id=2044176171
It was due to
https://github.com/DeepRegNet/DeepReg/blob/main/deepreg/model/layer.py#L9
where is should be from deepreg.model import layer_util
closing this as @zacbaum confirmed that the bug was fixed.