ANTsPy
ANTsPy copied to clipboard
Importing antspynet error
Describe the bug Error importing antspynet. Install is from either pip or from github source (same error)
To Reproduce
(base) stark@Titan:~$ conda activate antspy
(antspy) stark@Titan:~$ python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ants
>>> import antspynet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/craig/anaconda3/envs/antspy/lib/python3.9/site-packages/antspynet-0.1.2-py3.9.egg/antspynet/__init__.py", line 7, in <module>
from .architectures import *
File "/home/craig/anaconda3/envs/antspy/lib/python3.9/site-packages/antspynet-0.1.2-py3.9.egg/antspynet/architectures/__init__.py", line 8, in <module>
from .create_simple_classification_with_spatial_transformer_network_model import create_simple_classification_with_spatial_transformer_network_model_2d, create_simple_classification_with_spatial_transformer_network_model_3d
File "/home/craig/anaconda3/envs/antspy/lib/python3.9/site-packages/antspynet-0.1.2-py3.9.egg/antspynet/architectures/create_simple_classification_with_spatial_transformer_network_model.py", line 7, in <module>
from ..utilities import (SpatialTransformer2D, SpatialTransformer3D)
File "/home/craig/anaconda3/envs/antspy/lib/python3.9/site-packages/antspynet-0.1.2-py3.9.egg/antspynet/utilities/__init__.py", line 74, in <module>
from .quality_assessment import tid_neural_image_assessment
File "/home/craig/anaconda3/envs/antspy/lib/python3.9/site-packages/antspynet-0.1.2-py3.9.egg/antspynet/utilities/quality_assessment.py", line 182
(*tuple(not_padded_image_size)), number_of_channels))
^
SyntaxError: can't use starred expression here
>>>
Expected behavior No error
Desktop (please complete the following information):
- Ubuntu 20.04
- Python 3.9
- Clean install in new environment
Other I've also tried building up a totally clean singularity image based on Ubuntu 18.04 & miniconda-latest and having it only install antspyx and antspynet in here. Same error. Relevant bit from singularity recipe (derived from neurodocker):
export PATH="/opt/miniconda-latest/bin:$PATH"
echo "Downloading Miniconda installer ..."
conda_installer="/tmp/miniconda.sh"
curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash "$conda_installer" -b -p /opt/miniconda-latest
rm -f "$conda_installer"
conda update -yq -nbase conda
conda config --system --prepend channels conda-forge
conda config --system --set auto_update_conda false
conda config --system --set show_channel_urls true
sync && conda clean -y --all && sync
conda install -y -q --name base \
"pip"
sync && conda clean -y --all && sync
bash -c "source activate base
pip install --no-cache-dir \
"antspyx" \
"antspynet""
Runtime:
(base) craig@biomarker:~/singularity$ singularity shell antspy.sif
Singularity> python
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ants
>>> import antspynet
2021-10-21 13:52:22.347788: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /.singularity.d/libs
2021-10-21 13:52:22.347843: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/miniconda-latest/lib/python3.9/site-packages/antspynet/__init__.py", line 7, in <module>
from .architectures import *
File "/opt/miniconda-latest/lib/python3.9/site-packages/antspynet/architectures/__init__.py", line 8, in <module>
from .create_simple_classification_with_spatial_transformer_network_model import create_simple_classification_with_spatial_transformer_network_model_2d, create_simple_classification_with_spatial_transformer_network_model_3d
File "/opt/miniconda-latest/lib/python3.9/site-packages/antspynet/architectures/create_simple_classification_with_spatial_transformer_network_model.py", line 7, in <module>
from ..utilities import (SpatialTransformer2D, SpatialTransformer3D)
File "/opt/miniconda-latest/lib/python3.9/site-packages/antspynet/utilities/__init__.py", line 71, in <module>
from .quality_assessment import tid_neural_image_assessment
File "/opt/miniconda-latest/lib/python3.9/site-packages/antspynet/utilities/quality_assessment.py", line 182
(*tuple(not_padded_image_size)), number_of_channels))
^
SyntaxError: can't use starred expression here
I'm guessing it's a Python 3.9 issue.
That'd been my thought too -- did a singularity based on a Python 3.7 (https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh) and we seem good.