gschramm / pyapetnet

a CNN for anatomy-guided deconvolution and denoising of PET images
https://gschramm.github.io/pyapetnet/
MIT License
16 stars 5 forks source link

pyapetnet test fails #8

Closed gkotek closed 8 months ago

gkotek commented 9 months ago

Hi Georg, Making the first steps ...installation and test...I run into the following error. Do you have any advice?

my environment: Ubuntu 22.04.3 LTS, No GPU Python 3.11.7 $ conda list | grep tensorflow tensorflow 2.13.0 pypi_0 pypi tensorflow-estimator 2.13.0 pypi_0 pypi $ conda list | grep pyapetnet pyapetnet 1.5.1 pypi_0 pypi

running the command: $ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i

output: 2024-02-14 11:10:35.535062: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2024-02-14 11:10:35.536186: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-02-14 11:10:35.560794: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-02-14 11:10:35.561065: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-02-14 11:10:36.011034: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model. Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), NOT tf.saved_model.save(). To confirm, there should be a file named "keras_metadata.pb" in the SavedModel directory. /home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/layers/core/lambda_layer.py:327: UserWarning: tensorflow.python.keras.utils.multi_gpu_utils is not loaded, but a Lambda layer uses it. It may cause errors. function = cls._parse_function_from_config( Traceback (most recent call last): File "/home/gkotek/anaconda3/envs/pyap/bin/pyapetnet_predict_from_nifti", line 8, in sys.exit(main()) ^^^^^^ File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 124, in main pred = model.predict(x).squeeze() ^^^^^^^^^^^^^^^^ File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_2' defined at (most recent call last): File "/home/gkotek/anaconda3/envs/pyap/bin/pyapetnet_predict_from_nifti", line 8, in sys.exit(main()) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 124, in main pred = model.predict(x).squeeze() File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 2554, in predict tmp_batch_outputs = self.predict_function(iterator) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 2341, in predict_function return step_function(self, iterator) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 2327, in step_function outputs = model.distribute_strategy.run(run_step, args=(data,)) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 2315, in run_step outputs = model.predict_step(data) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 2283, in predict_step return self(x, training=False) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, *kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 569, in call return super().call(args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1150, in call outputs = call_fn(inputs, *args, *kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler return fn(args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/functional.py", line 512, in call return self._run_internal_graph(inputs, training=training, mask=mask) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/functional.py", line 669, in _run_internal_graph outputs = node.layer(*args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, *kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/training.py", line 569, in call return super().call(args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1150, in call outputs = call_fn(inputs, *args, *kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler return fn(args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/functional.py", line 512, in call return self._run_internal_graph(inputs, training=training, mask=mask) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/functional.py", line 669, in _run_internal_graph outputs = node.layer(*args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler return fn(*args, *kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1150, in call outputs = call_fn(inputs, args, kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler return fn(*args, **kwargs) File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 597, in call outputs = self._fused_batch_norm( File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 990, in _fused_batch_norm output, mean, variance = control_flow_util.smart_cond( File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/utils/control_flow_util.py", line 108, in smart_cond return tf.internal.smart_cond.smart_cond( File "/home/gkotek/anaconda3/envs/pyap/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 979, in _fused_batch_norm_inference return tf.compat.v1.nn.fused_batch_norm( Node: 'functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_2' scale must have the same number of elements as the channels of x, got 15 and 1 [[{{node functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_2}}]] [Op:__inference_predict_function_14236]

gschramm commented 9 months ago

Hi Gyula,

my first guess is that is because of incompatibilities in the new TF versions. Can you try downgrading the TF version (to 2.2 or 2.3) and re-running the example?

Right now, the the dependency says TF>=2.2 because I was assuming that TF uses semantic versioning, but that might be incorrect.

Georg

gkotek commented 9 months ago

Hi Georg, It seems that I needed to downgrade my python too then to <3.8. I downgraded it to 3.8.18 Now I could install tensorflow 2.2.0 I had to reinstall pyapetnet. Done so successfully. and now I have further incompatibility:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.2.0 requires scipy==1.4.1; python_version >= "3", but you have scipy 1.10.1 which is incompatible. tensorflow 2.2.0 requires tensorboard<2.3.0,>=2.2.0, but you have tensorboard 2.13.0 which is incompatible. tensorflow 2.2.0 requires tensorflow-estimator<2.3.0,>=2.2.0, but you have tensorflow-estimator 2.13.0 which is incompatible.

I can go step by step eliminating dependency incompatibilities. Or: maybe you have a list of a working environment? The Ubuntu version I can not change.

gschramm commented 9 months ago

I suggest the following:

  1. create a new and fresh python virtual env. e.g. using conda with tensorflow <2.5
    conda create -n pyapetnet-tf_test -c conda-forge tensorflow=2.4
  2. activate the env and install pyapetnet via pip
    conda activate pyapetnet-tf_test
    pip install pyapetnet

    By doing that all the dependencies should be ok.

gkotek commented 9 months ago

Thanks, I am on it...it may take a while for conda-forge (it is very slow), I will report back when it is done.

Now just waiting: $ conda create -n pyapetnet-tf_test -c conda-forge tensorflow=2.4 Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source. Collecting package metadata (repodata.json): done Solving environment: -

gkotek commented 9 months ago

Hi, up to pip install pyapetnet it went OK. unfortunately that gives error, so did not manage to get a clean installation this way either:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.4.3 requires absl-py~=0.10, but you have absl-py 2.1.0 which is incompatible. tensorflow 2.4.3 requires flatbuffers~=1.12.0, but you have flatbuffers 23.5.26 which is incompatible. tensorflow 2.4.3 requires tensorflow-estimator<2.5.0,>=2.4.0, but you have tensorflow-estimator 2.15.0 which is incompatible. tensorflow 2.4.3 requires termcolor~=1.1.0, but you have termcolor 2.4.0 which is incompatible. tensorflow 2.4.3 requires wrapt~=1.12.1, but you have wrapt 1.14.1 which is incompatible.

I run to check: $ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show Traceback (most recent call last): File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/bin/pyapetnet_predict_from_nifti", line 8, in sys.exit(main()) File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/pyapetnet/predict_from_nifti.py", line 53, in main import tensorflow as tf File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/init.py", line 48, in from tensorflow._api.v2 import internal File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/_api/v2/internal/init.py", line 8, in from tensorflow._api.v2.internal import autograph File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/_api/v2/internal/autograph/init.py", line 8, in from tensorflow.python.autograph.core.ag_ctx import control_status_ctx # line: 34 File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/python/autograph/core/ag_ctx.py", line 21, in from tensorflow.python.autograph.utils import ag_logging File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/python/autograph/utils/init.py", line 17, in from tensorflow.python.autograph.utils.context_managers import control_dependency_on_returns File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/python/autograph/utils/context_managers.py", line 19, in from tensorflow.python.framework import ops File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/python/framework/ops.py", line 29, in from tensorflow.core.framework import attr_value_pb2 File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 5, in from google.protobuf.internal import builder as _builder File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/google/protobuf/internal/builder.py", line 18, in from google.protobuf.internal import python_message File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 36, in from google.protobuf import descriptor as descriptor_mod File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 17, in from google.protobuf.internal import api_implementation File "/home/gkotek/anaconda3/envs/pyapetnet-tf_test/lib/python3.9/site-packages/google/protobuf/internal/api_implementation.py", line 81, in from google.protobuf.pyext import _message TypeError: bases must be types

gschramm commented 9 months ago

Very annoying. One more try:

I suggest the following:

  1. create a new and fresh python virtual env. and only install python 3.8
    conda create -n pyapetnet-tf_test2 -c conda-forge python=3.8
  2. activate the env and install tf=2.4 and pyapetnet via pip
    conda activate pyapetnet-tf_test2
    pip install tensorflow==2.4
    pip install pyapetnet

This will install TF from pip and hopefully get around the dependecy problems ... All very messy and annoying ...

gkotek commented 9 months ago

Hm...still stuck with pyapetnet install

After successfully installing tensorflow 2.4.0 the pyapetnet pip install is not successful. It seems that the pyapetnet pip install uninstalls packages that came with tensorflow pip install, and then installs newer versions. These break tensorflow dependencies.

Here is only the error message: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.4.0 requires absl-py~=0.10, but you have absl-py 2.1.0 which is incompatible. tensorflow 2.4.0 requires flatbuffers~=1.12.0, but you have flatbuffers 23.5.26 which is incompatible. tensorflow 2.4.0 requires grpcio~=1.32.0, but you have grpcio 1.60.1 which is incompatible. tensorflow 2.4.0 requires numpy~=1.19.2, but you have numpy 1.24.3 which is incompatible. tensorflow 2.4.0 requires tensorflow-estimator<2.5.0,>=2.4.0rc0, but you have tensorflow-estimator 2.13.0 which is incompatible.

Here below is the output, where the uninstallation of absl-py and the other packages are captured: Attempting uninstall: flatbuffers Found existing installation: flatbuffers 1.12 Uninstalling flatbuffers-1.12: Successfully uninstalled flatbuffers-1.12 Attempting uninstall: tensorflow-estimator Found existing installation: tensorflow-estimator 2.4.0 Uninstalling tensorflow-estimator-2.4.0: Successfully uninstalled tensorflow-estimator-2.4.0 Attempting uninstall: tensorboard-data-server Found existing installation: tensorboard-data-server 0.6.1 Uninstalling tensorboard-data-server-0.6.1: Successfully uninstalled tensorboard-data-server-0.6.1 Attempting uninstall: numpy Found existing installation: numpy 1.19.5 Uninstalling numpy-1.19.5: Successfully uninstalled numpy-1.19.5 Attempting uninstall: grpcio Found existing installation: grpcio 1.32.0 Uninstalling grpcio-1.32.0: Successfully uninstalled grpcio-1.32.0 Attempting uninstall: absl-py Found existing installation: absl-py 0.15.0 Uninstalling absl-py-0.15.0: Successfully uninstalled absl-py-0.15.0 Attempting uninstall: google-auth-oauthlib Found existing installation: google-auth-oauthlib 0.4.6 Uninstalling google-auth-oauthlib-0.4.6: Successfully uninstalled google-auth-oauthlib-0.4.6 Attempting uninstall: tensorboard Found existing installation: tensorboard 2.11.2 Uninstalling tensorboard-2.11.2: Successfully uninstalled tensorboard-2.11.2

Here is the entire output: $ pip install pyapetnet Collecting pyapetnet Using cached pyapetnet-1.3.2-py3-none-any.whl (11.6 MB) Collecting tensorflow-cpu>=2.2 (from pyapetnet) Using cached tensorflow_cpu-2.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.4 kB) Collecting pymirc>=0.22 (from pyapetnet) Using cached pymirc-0.29-py3-none-any.whl.metadata (896 bytes) Collecting nibabel>=3.0 (from pyapetnet) Using cached nibabel-5.2.0-py3-none-any.whl.metadata (8.8 kB) Collecting matplotlib>=3.1 (from pyapetnet) Using cached matplotlib-3.7.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (5.7 kB) Collecting pydicom>=2.0 (from pyapetnet) Using cached pydicom-2.4.4-py3-none-any.whl.metadata (7.8 kB) Collecting contourpy>=1.0.1 (from matplotlib>=3.1->pyapetnet) Using cached contourpy-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.9 kB) Collecting cycler>=0.10 (from matplotlib>=3.1->pyapetnet) Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB) Collecting fonttools>=4.22.0 (from matplotlib>=3.1->pyapetnet) Using cached fonttools-4.48.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (158 kB) Collecting kiwisolver>=1.0.1 (from matplotlib>=3.1->pyapetnet) Using cached kiwisolver-1.4.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.metadata (6.4 kB) Collecting numpy<2,>=1.20 (from matplotlib>=3.1->pyapetnet) Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB) Collecting packaging>=20.0 (from matplotlib>=3.1->pyapetnet) Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB) Collecting pillow>=6.2.0 (from matplotlib>=3.1->pyapetnet) Using cached pillow-10.2.0-cp38-cp38-manylinux_2_28_x86_64.whl.metadata (9.7 kB) Collecting pyparsing>=2.3.1 (from matplotlib>=3.1->pyapetnet) Using cached pyparsing-3.1.1-py3-none-any.whl.metadata (5.1 kB) Collecting python-dateutil>=2.7 (from matplotlib>=3.1->pyapetnet) Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting importlib-resources>=3.2.0 (from matplotlib>=3.1->pyapetnet) Using cached importlib_resources-6.1.1-py3-none-any.whl.metadata (4.1 kB) Collecting scipy>=1.1 (from pymirc>=0.22->pyapetnet) Using cached scipy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.5 MB) Collecting scikit-image>=0.14 (from pymirc>=0.22->pyapetnet) Using cached scikit_image-0.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (14 kB) Collecting numba>=0.39 (from pymirc>=0.22->pyapetnet) Using cached numba-0.58.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.7 kB) Collecting absl-py>=1.0.0 (from tensorflow-cpu>=2.2->pyapetnet) Using cached absl_py-2.1.0-py3-none-any.whl.metadata (2.3 kB) Requirement already satisfied: astunparse>=1.6.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (1.6.3) Collecting flatbuffers>=23.1.21 (from tensorflow-cpu>=2.2->pyapetnet) Using cached flatbuffers-23.5.26-py2.py3-none-any.whl.metadata (850 bytes) Requirement already satisfied: gast<=0.4.0,>=0.2.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (0.3.3) Requirement already satisfied: google-pasta>=0.1.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (0.2.0) Requirement already satisfied: grpcio<2.0,>=1.24.3 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (1.32.0) Requirement already satisfied: h5py>=2.9.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (2.10.0) Collecting keras<2.14,>=2.13.1 (from tensorflow-cpu>=2.2->pyapetnet) Using cached keras-2.13.1-py3-none-any.whl.metadata (2.4 kB) Collecting libclang>=13.0.0 (from tensorflow-cpu>=2.2->pyapetnet) Using cached libclang-16.0.6-py2.py3-none-manylinux2010_x86_64.whl.metadata (5.2 kB) Collecting numpy<2,>=1.20 (from matplotlib>=3.1->pyapetnet) Downloading numpy-1.24.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB) Requirement already satisfied: opt-einsum>=2.3.2 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (3.3.0) Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (3.20.3) Requirement already satisfied: setuptools in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (69.0.3) Requirement already satisfied: six>=1.12.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (1.15.0) Collecting tensorboard<2.14,>=2.13 (from tensorflow-cpu>=2.2->pyapetnet) Using cached tensorboard-2.13.0-py3-none-any.whl.metadata (1.8 kB) Collecting tensorflow-estimator<2.14,>=2.13.0 (from tensorflow-cpu>=2.2->pyapetnet) Using cached tensorflow_estimator-2.13.0-py2.py3-none-any.whl.metadata (1.3 kB) Requirement already satisfied: termcolor>=1.1.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (1.1.0) Requirement already satisfied: typing-extensions<4.6.0,>=3.6.6 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (3.7.4.3) Requirement already satisfied: wrapt>=1.11.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorflow-cpu>=2.2->pyapetnet) (1.12.1) Collecting tensorflow-io-gcs-filesystem>=0.23.1 (from tensorflow-cpu>=2.2->pyapetnet) Using cached tensorflow_io_gcs_filesystem-0.34.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (14 kB) Requirement already satisfied: wheel<1.0,>=0.23.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from astunparse>=1.6.0->tensorflow-cpu>=2.2->pyapetnet) (0.42.0) Requirement already satisfied: zipp>=3.1.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from importlib-resources>=3.2.0->matplotlib>=3.1->pyapetnet) (3.17.0) Collecting llvmlite<0.42,>=0.41.0dev0 (from numba>=0.39->pymirc>=0.22->pyapetnet) Using cached llvmlite-0.41.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.8 kB) Requirement already satisfied: importlib-metadata in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from numba>=0.39->pymirc>=0.22->pyapetnet) (7.0.1) Collecting networkx>=2.8 (from scikit-image>=0.14->pymirc>=0.22->pyapetnet) Using cached networkx-3.1-py3-none-any.whl (2.1 MB) Collecting imageio>=2.27 (from scikit-image>=0.14->pymirc>=0.22->pyapetnet) Using cached imageio-2.34.0-py3-none-any.whl.metadata (4.9 kB) Collecting tifffile>=2022.8.12 (from scikit-image>=0.14->pymirc>=0.22->pyapetnet) Using cached tifffile-2023.7.10-py3-none-any.whl.metadata (31 kB) Collecting PyWavelets>=1.1.1 (from scikit-image>=0.14->pymirc>=0.22->pyapetnet) Using cached PyWavelets-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.9 MB) Collecting lazy_loader>=0.2 (from scikit-image>=0.14->pymirc>=0.22->pyapetnet) Using cached lazy_loader-0.3-py3-none-any.whl.metadata (4.3 kB) Collecting grpcio<2.0,>=1.24.3 (from tensorflow-cpu>=2.2->pyapetnet) Using cached grpcio-1.60.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB) Requirement already satisfied: google-auth<3,>=1.6.3 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (2.27.0) Collecting google-auth-oauthlib<1.1,>=0.5 (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) Using cached google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB) Requirement already satisfied: markdown>=2.6.8 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (3.5.2) Requirement already satisfied: requests<3,>=2.21.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (2.31.0) Collecting tensorboard-data-server<0.8.0,>=0.7.0 (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) Using cached tensorboard_data_server-0.7.2-py3-none-manylinux_2_31_x86_64.whl.metadata (1.1 kB) Requirement already satisfied: werkzeug>=1.0.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (3.0.1) Requirement already satisfied: cachetools<6.0,>=2.0.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (5.3.2) Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (0.3.0) Requirement already satisfied: rsa<5,>=3.1.4 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (4.9) Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from google-auth-oauthlib<1.1,>=0.5->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (1.3.1) Requirement already satisfied: charset-normalizer<4,>=2 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (3.3.2) Requirement already satisfied: idna<4,>=2.5 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (3.6) Requirement already satisfied: urllib3<3,>=1.21.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (2.2.0) Requirement already satisfied: certifi>=2017.4.17 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (2024.2.2) Requirement already satisfied: MarkupSafe>=2.1.1 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from werkzeug>=1.0.1->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (2.1.5) Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (0.5.1) Requirement already satisfied: oauthlib>=3.0.0 in /home/gkotek/anaconda3/envs/pyapetnet-tf_test2/lib/python3.8/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard<2.14,>=2.13->tensorflow-cpu>=2.2->pyapetnet) (3.2.2) Using cached matplotlib-3.7.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (9.2 MB) Using cached nibabel-5.2.0-py3-none-any.whl (3.3 MB) Using cached pydicom-2.4.4-py3-none-any.whl (1.8 MB) Using cached pymirc-0.29-py3-none-any.whl (52 kB) Using cached tensorflow_cpu-2.13.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.5 MB) Using cached absl_py-2.1.0-py3-none-any.whl (133 kB) Using cached contourpy-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301 kB) Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB) Using cached flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB) Using cached fonttools-4.48.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB) Using cached importlib_resources-6.1.1-py3-none-any.whl (33 kB) Using cached keras-2.13.1-py3-none-any.whl (1.7 MB) Using cached kiwisolver-1.4.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.2 MB) Using cached libclang-16.0.6-py2.py3-none-manylinux2010_x86_64.whl (22.9 MB) Using cached numba-0.58.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.7 MB) Using cached numpy-1.24.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB) Using cached packaging-23.2-py3-none-any.whl (53 kB) Using cached pillow-10.2.0-cp38-cp38-manylinux_2_28_x86_64.whl (4.5 MB) Using cached pyparsing-3.1.1-py3-none-any.whl (103 kB) Using cached scikit_image-0.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.9 MB) Using cached tensorboard-2.13.0-py3-none-any.whl (5.6 MB) Using cached grpcio-1.60.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB) Using cached tensorflow_estimator-2.13.0-py2.py3-none-any.whl (440 kB) Using cached tensorflow_io_gcs_filesystem-0.34.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.4 MB) Using cached imageio-2.34.0-py3-none-any.whl (313 kB) Using cached lazy_loader-0.3-py3-none-any.whl (9.1 kB) Using cached llvmlite-0.41.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (43.6 MB) Using cached tensorboard_data_server-0.7.2-py3-none-manylinux_2_31_x86_64.whl (6.6 MB) Using cached tifffile-2023.7.10-py3-none-any.whl (220 kB) Installing collected packages: libclang, flatbuffers, tensorflow-io-gcs-filesystem, tensorflow-estimator, tensorboard-data-server, python-dateutil, pyparsing, pydicom, pillow, packaging, numpy, networkx, llvmlite, lazy_loader, kiwisolver, keras, importlib-resources, grpcio, fonttools, cycler, absl-py, tifffile, scipy, PyWavelets, numba, nibabel, imageio, contourpy, scikit-image, matplotlib, google-auth-oauthlib, tensorboard, pymirc, tensorflow-cpu, pyapetnet Attempting uninstall: flatbuffers Found existing installation: flatbuffers 1.12 Uninstalling flatbuffers-1.12: Successfully uninstalled flatbuffers-1.12 Attempting uninstall: tensorflow-estimator Found existing installation: tensorflow-estimator 2.4.0 Uninstalling tensorflow-estimator-2.4.0: Successfully uninstalled tensorflow-estimator-2.4.0 Attempting uninstall: tensorboard-data-server Found existing installation: tensorboard-data-server 0.6.1 Uninstalling tensorboard-data-server-0.6.1: Successfully uninstalled tensorboard-data-server-0.6.1 Attempting uninstall: numpy Found existing installation: numpy 1.19.5 Uninstalling numpy-1.19.5: Successfully uninstalled numpy-1.19.5 Attempting uninstall: grpcio Found existing installation: grpcio 1.32.0 Uninstalling grpcio-1.32.0: Successfully uninstalled grpcio-1.32.0 Attempting uninstall: absl-py Found existing installation: absl-py 0.15.0 Uninstalling absl-py-0.15.0: Successfully uninstalled absl-py-0.15.0 Attempting uninstall: google-auth-oauthlib Found existing installation: google-auth-oauthlib 0.4.6 Uninstalling google-auth-oauthlib-0.4.6: Successfully uninstalled google-auth-oauthlib-0.4.6 Attempting uninstall: tensorboard Found existing installation: tensorboard 2.11.2 Uninstalling tensorboard-2.11.2: Successfully uninstalled tensorboard-2.11.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 2.4.0 requires absl-py~=0.10, but you have absl-py 2.1.0 which is incompatible. tensorflow 2.4.0 requires flatbuffers~=1.12.0, but you have flatbuffers 23.5.26 which is incompatible. tensorflow 2.4.0 requires grpcio~=1.32.0, but you have grpcio 1.60.1 which is incompatible. tensorflow 2.4.0 requires numpy~=1.19.2, but you have numpy 1.24.3 which is incompatible. tensorflow 2.4.0 requires tensorflow-estimator<2.5.0,>=2.4.0rc0, but you have tensorflow-estimator 2.13.0 which is incompatible. Successfully installed PyWavelets-1.4.1 absl-py-2.1.0 contourpy-1.1.1 cycler-0.12.1 flatbuffers-23.5.26 fonttools-4.48.1 google-auth-oauthlib-1.0.0 grpcio-1.60.1 imageio-2.34.0 importlib-resources-6.1.1 keras-2.13.1 kiwisolver-1.4.5 lazy_loader-0.3 libclang-16.0.6 llvmlite-0.41.1 matplotlib-3.7.4 networkx-3.1 nibabel-5.2.0 numba-0.58.1 numpy-1.24.3 packaging-23.2 pillow-10.2.0 pyapetnet-1.3.2 pydicom-2.4.4 pymirc-0.29 pyparsing-3.1.1 python-dateutil-2.8.2 scikit-image-0.21.0 scipy-1.10.1 tensorboard-2.13.0 tensorboard-data-server-0.7.2 tensorflow-cpu-2.13.1 tensorflow-estimator-2.13.0 tensorflow-io-gcs-filesystem-0.34.0 tifffile-2023.7.10

gkotek commented 9 months ago

Maybe a way forward: Mixing conda and pip may not be a good idea. A cleaner install could be leaving Conda out of this and use python -m venv and then install everything from requirements.txt ...?

gschramm commented 9 months ago

That is definitely sth to try. Indeed mixing conda and pip can cause problems. Let me me know if that works better. (make sure that you adapt the req.txt to have tensorflow <=2.4)

gkotek commented 9 months ago

OK, I was actually expecting that you will send me a requirements.txt file from a working virtual environment with: $ pip freeze > requirements.txt

I would also need the info:

Then I can start debugging the pyapetnet installation procedure, ie why is it broken as is. And then I can start repair the dependencies step by step. (Ie: What I tried so far was with the last few suggested solutions, but I got into circular reference of mutually excluding dependency requirements)

Best, Gyula

gschramm commented 9 months ago

Ah sorry, the requirements are listed in the setup.py here: https://github.com/gschramm/pyapetnet/blob/2d73b89c1912d39eed03bee6f8d0390470eaaf9a/setup.py#L32

tensorflow should be <=2.4 and python=3.8 (probably)

Georg

gkotek commented 9 months ago

Hi Georg, I used only python -m venv to create virtual environment. The requirements you pointed out were all satisfied, installation was smooth. Last step of installation of pyapetnet worked out (mostly "requirement already satisfied"). All seems to be in place, BUT test run fails: $ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show

Last output (same as in any installation so far): File "/home/gkotek/AGrecon/demo_data/p38/lib/python3.8/site-packages/keras/src/layers/normalization/batch_normalization.py", line 979, in _fused_batch_norm_inference return tf.compat.v1.nn.fused_batch_norm( Node: 'functional_3/functional_1/batchnorm_ind_0_1/FusedBatchNormV3' scale must have the same number of elements as the channels of x, got 15 and 1

I tried with Python3.10, also python3.8

At this point I have no further idea how to fix this....

gschramm commented 9 months ago

That is indeed very frustrating. Can you do you last test and try with tensorflow==2.2?

gkotek commented 9 months ago

If I install: $ pip install pyapetnet I get the same problem.

Just to be exact, my environment: Ubuntu 22.04.3 LTS Python 3.8.18

and with pip list: Package Version


absl-py 2.1.0 astunparse 1.6.3 cachetools 5.3.2 certifi 2024.2.2 charset-normalizer 3.3.2 contourpy 1.1.1 cycler 0.12.1 flatbuffers 23.5.26 fonttools 4.49.0 gast 0.4.0 google-auth 2.28.0 google-auth-oauthlib 1.0.0 google-pasta 0.2.0 grpcio 1.60.1 h5py 3.10.0 idna 3.6 imageio 2.34.0 importlib-metadata 7.0.1 importlib-resources 6.1.1 keras 2.13.1 kiwisolver 1.4.5 lazy_loader 0.3 libclang 16.0.6 llvmlite 0.41.1 Markdown 3.5.2 MarkupSafe 2.1.5 matplotlib 3.7.5 networkx 3.1 nibabel 5.2.0 numba 0.58.1 numpy 1.24.3 oauthlib 3.2.2 opt-einsum 3.3.0 packaging 23.2 pillow 10.2.0 pip 24.0 protobuf 4.25.3 pyapetnet 1.3.2 pyasn1 0.5.1 pyasn1-modules 0.3.0 pydicom 2.4.4 pymirc 0.29 pyparsing 3.1.1 python-dateutil 2.8.2 PyWavelets 1.4.1 requests 2.31.0 requests-oauthlib 1.3.1 rsa 4.9 scikit-image 0.21.0 scipy 1.10.1 setuptools 56.0.0 six 1.16.0 tensorboard 2.13.0 tensorboard-data-server 0.7.2 tensorflow-cpu 2.13.1 tensorflow-estimator 2.13.0 tensorflow-io-gcs-filesystem 0.34.0 termcolor 2.4.0 tifffile 2023.7.10 typing_extensions 4.5.0 urllib3 2.2.1 Werkzeug 3.0.1 wheel 0.42.0 wrapt 1.16.0 zipp 3.17.0

gschramm commented 9 months ago

I finally had time to try myself on a linux GPU server. For me the following works without problems

mamba create -n pyapetnet pyapetnet
mamba activate pyapetnet
pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show

If you don't have mamba, use conda -c conda-forge Can you try the same?

LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:    20.04
Codename:   focal
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
absl-py                   2.1.0              pyhd8ed1ab_0    conda-forge
aiohttp                   3.9.3           py311h459d7ec_0    conda-forge
aiosignal                 1.3.1              pyhd8ed1ab_0    conda-forge
aom                       3.8.1                h59595ed_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
attrs                     23.2.0             pyh71513ae_0    conda-forge
blinker                   1.7.0              pyhd8ed1ab_0    conda-forge
blosc                     1.21.5               h0f2a231_0    conda-forge
brotli                    1.1.0                hd590300_1    conda-forge
brotli-bin                1.1.0                hd590300_1    conda-forge
brotli-python             1.1.0           py311hb755f60_1    conda-forge
brunsli                   0.1                  h9c3ff4c_0    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.26.0               hd590300_0    conda-forge
c-blosc2                  2.13.2               hb4ffafa_0    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                5.3.2              pyhd8ed1ab_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py311hb3a22ac_0    conda-forge
charls                    2.4.2                h59595ed_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
contourpy                 1.2.0           py311h9547e67_0    conda-forge
cryptography              42.0.3          py311h63ff55d_0    conda-forge
cuda-crt-tools            12.3.107             ha770c72_0    conda-forge
cuda-cudart               12.3.101             hd3aeb46_0    conda-forge
cuda-cudart_linux-64      12.3.101             h59595ed_0    conda-forge
cuda-nvcc-tools           12.3.107             hd3aeb46_0    conda-forge
cuda-nvrtc                12.3.107             hd3aeb46_0    conda-forge
cuda-nvtx                 12.3.101             h59595ed_0    conda-forge
cuda-nvvm-tools           12.3.107             h59595ed_0    conda-forge
cuda-version              12.3                 h32bc705_2    conda-forge
cudnn                     8.8.0.121            h264754d_4    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
dav1d                     1.2.1                hd590300_0    conda-forge
eigen                     3.4.0                h00ab1b0_0    conda-forge
expat                     2.5.0                hcb278e6_1    conda-forge
fftw                      3.3.10          nompi_hc118613_108    conda-forge
flatbuffers               23.5.26              h59595ed_1    conda-forge
fonttools                 4.49.0          py311h459d7ec_0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
frozenlist                1.4.1           py311h459d7ec_0    conda-forge
gast                      0.5.4              pyhd8ed1ab_0    conda-forge
giflib                    5.2.1                h0b41bf4_3    conda-forge
google-auth               2.28.0             pyhca7485f_0    conda-forge
google-auth-oauthlib      1.2.0              pyhd8ed1ab_0    conda-forge
google-pasta              0.2.0              pyh8c360ce_0    conda-forge
grpcio                    1.59.3          py311ha6695c7_0    conda-forge
h5py                      3.10.0          nompi_py311hebc2b07_101    conda-forge
hdf5                      1.14.3          nompi_h4f84152_100    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
imagecodecs               2024.1.1        py311h089f87a_0    conda-forge
imageio                   2.34.0             pyh4b66e23_0    conda-forge
importlib-metadata        7.0.1              pyha770c72_0    conda-forge
importlib_resources       6.1.1              pyhd8ed1ab_0    conda-forge
jxrlib                    1.1                  hd590300_3    conda-forge
keras                     2.15.0             pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.5           py311h9547e67_1    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lazy_loader               0.3                pyhd8ed1ab_0    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20230802.1      cxx17_h59595ed_0    conda-forge
libaec                    1.1.2                h59595ed_1    conda-forge
libavif16                 1.0.4                h1dcd450_0    conda-forge
libblas                   3.9.0           21_linux64_openblas    conda-forge
libbrotlicommon           1.1.0                hd590300_1    conda-forge
libbrotlidec              1.1.0                hd590300_1    conda-forge
libbrotlienc              1.1.0                hd590300_1    conda-forge
libcblas                  3.9.0           21_linux64_openblas    conda-forge
libcublas                 12.3.4.1             hd3aeb46_0    conda-forge
libcufft                  11.0.12.1            hd3aeb46_0    conda-forge
libcurand                 10.3.4.107           hd3aeb46_0    conda-forge
libcurl                   8.5.0                hca28451_0    conda-forge
libcusolver               11.5.4.101           hd3aeb46_0    conda-forge
libcusparse               12.2.0.103           hd3aeb46_0    conda-forge
libdeflate                1.19                 hd590300_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libgfortran-ng            13.2.0               h69a702a_5    conda-forge
libgfortran5              13.2.0               ha4646dd_5    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
libgrpc                   1.59.3               hd6c4280_0    conda-forge
libhwloc                  2.9.3           default_h554bfaf_1009    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libitk                    5.3.0                h26001f5_8    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           21_linux64_openblas    conda-forge
libllvm14                 14.0.6               hcd5def8_4    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libnvjitlink              12.3.101             hd3aeb46_0    conda-forge
libopenblas               0.3.26          pthreads_h413a1c8_0    conda-forge
libpng                    1.6.42               h2797004_0    conda-forge
libprotobuf               4.24.4               hf27288f_0    conda-forge
libre2-11                 2023.06.02           h7a70373_0    conda-forge
libsqlite                 3.45.1               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libtiff                   4.6.0                ha9c0a0a_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libwebp-base              1.3.2                hd590300_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxml2                   2.12.5               h232c23b_0    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
libzopfli                 1.0.3                h9c3ff4c_0    conda-forge
llvmlite                  0.42.0          py311ha6695c7_1    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
markdown                  3.5.2              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.5           py311h459d7ec_0    conda-forge
matplotlib-base           3.8.3           py311h54ef318_0    conda-forge
ml_dtypes                 0.2.0           py311h320fe9a_2    conda-forge
multidict                 6.0.5           py311h459d7ec_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nccl                      2.20.3.1             h3a97aeb_0    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
networkx                  3.2.1              pyhd8ed1ab_0    conda-forge
nibabel                   5.2.0              pyha770c72_0    conda-forge
numba                     0.59.0          py311h96b013e_1    conda-forge
numpy                     1.26.4          py311h64a7726_0    conda-forge
oauthlib                  3.2.2              pyhd8ed1ab_0    conda-forge
openjpeg                  2.5.0                h488ebb8_3    conda-forge
openssl                   3.2.1                hd590300_0    conda-forge
opt_einsum                3.3.0              pyhc1e730c_2    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pillow                    10.2.0          py311ha6c5da5_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
protobuf                  4.24.4          py311h46cbc50_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pyapetnet                 1.5.1              pyhd8ed1ab_0    conda-forge
pyasn1                    0.5.1              pyhd8ed1ab_0    conda-forge
pyasn1-modules            0.3.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydicom                   2.4.4              pyhd8ed1ab_0    conda-forge
pyjwt                     2.8.0              pyhd8ed1ab_1    conda-forge
pymirc                    0.29               pyhd8ed1ab_0    conda-forge
pyopenssl                 24.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.8          hab00c5b_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-flatbuffers        23.5.26            pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pywavelets                1.4.1           py311h1f0f07a_1    conda-forge
rav1e                     0.6.6                he8a937b_2    conda-forge
re2                       2023.06.02           h2873b5e_0    conda-forge
readline                  8.2                  h8228510_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
requests-oauthlib         1.3.1              pyhd8ed1ab_0    conda-forge
rsa                       4.9                pyhd8ed1ab_0    conda-forge
scikit-image              0.22.0          py311h320fe9a_2    conda-forge
scipy                     1.12.0          py311h64a7726_2    conda-forge
setuptools                69.1.0             pyhd8ed1ab_0    conda-forge
simpleitk                 2.3.1           py311hb755f60_2    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.10               h9fff704_0    conda-forge
svt-av1                   1.8.0                h59595ed_0    conda-forge
tbb                       2021.11.0            h00ab1b0_1    conda-forge
tensorboard               2.15.2             pyhd8ed1ab_0    conda-forge
tensorboard-data-server   0.7.0           py311h63ff55d_1    conda-forge
tensorflow                2.15.0          cuda120py311h5cbd639_3    conda-forge
tensorflow-base           2.15.0          cuda120py311h43b5e44_3    conda-forge
tensorflow-estimator      2.15.0          cuda120py311hf663016_3    conda-forge
termcolor                 2.4.0              pyhd8ed1ab_0    conda-forge
tifffile                  2024.2.12          pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
typing_extensions         4.9.0              pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
werkzeug                  3.0.1              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
wrapt                     1.14.1          py311hd4cff14_1    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yarl                      1.9.4           py311h459d7ec_0    conda-forge
zfp                       1.0.1                h59595ed_0    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zlib-ng                   2.0.7                h0b41bf4_0    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge
gkotek commented 9 months ago

OK, I tried this with conda: (after this I will try to install mamba)

$ conda create -n pyapetnet -c conda-forge tensorflow=2.2

Then

$ conda activate pyapetnet

Then

$ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i —show

Output: Traceback (most recent call last): File "/home/gkotek/.local/bin/pyapetnet_predict_from_nifti", line 8, in sys.exit(main()) File "/home/gkotek/.local/lib/python3.10/site-packages/pyapetnet/predict_from_nifti.py", line 49, in main from pyapetnet.utils import load_nii_in_ras File "/home/gkotek/.local/lib/python3.10/site-packages/pyapetnet/utils.py", line 5, in from pymirc.fileio import write_3d_static_dicom File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/init.py", line 1, in from . import fileio File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/fileio/init.py", line 5, in from .labelvol_to_rtstruct import labelvol_to_rtstruct File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/fileio/labelvol_to_rtstruct.py", line 1, in import pymirc.image_operations as pymi File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/image_operations/init.py", line 6, in from .binary_2d_image_to_contours import binary_2d_image_to_contours File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/image_operations/binary_2d_image_to_contours.py", line 6, in from skimage import measure File "/home/gkotek/.local/lib/python3.10/site-packages/skimage/init.py", line 122, in from ._shared import geometry File "geometry.pyx", line 1, in init skimage._shared.geometry ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

On 19 Feb 2024, at 17:19, Georg Schramm @.***> wrote:

pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show

gkotek commented 9 months ago

Hi, Could you pls make a requirements file and send it? Like this: $ conda list -e > requirements.txt

Then the requirements.txt file has a format like this: _libgcc_mutex=0.1=conda_forge _openmp_mutex=4.5=2_gnu _tflow_select=2.3.0=mkl absl-py=2.1.0=pyhd8ed1ab_0 ...

And then it is easy to install it for me like this: $ conda install --yes --file requirements.txt

I.e.: My list is nowhere near your list.

Gyula

On 19 Feb 2024, at 17:19, Georg Schramm @.***> wrote:

I finally had time to try myself on a linux GPU server. For me the following works without problems

mamba create -n pyapetnet pyapetnet mamba activate pyapetnet pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show If you don't have mamba, use conda -c conda-forge Can you try the same?

LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge absl-py 2.1.0 pyhd8ed1ab_0 conda-forge aiohttp 3.9.3 py311h459d7ec_0 conda-forge aiosignal 1.3.1 pyhd8ed1ab_0 conda-forge aom 3.8.1 h59595ed_0 conda-forge astunparse 1.6.3 pyhd8ed1ab_0 conda-forge attrs 23.2.0 pyh71513ae_0 conda-forge blinker 1.7.0 pyhd8ed1ab_0 conda-forge blosc 1.21.5 h0f2a231_0 conda-forge brotli 1.1.0 hd590300_1 conda-forge brotli-bin 1.1.0 hd590300_1 conda-forge brotli-python 1.1.0 py311hb755f60_1 conda-forge brunsli 0.1 h9c3ff4c_0 conda-forge bzip2 1.0.8 hd590300_5 conda-forge c-ares 1.26.0 hd590300_0 conda-forge c-blosc2 2.13.2 hb4ffafa_0 conda-forge ca-certificates 2024.2.2 hbcca054_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 5.3.2 pyhd8ed1ab_0 conda-forge certifi 2024.2.2 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py311hb3a22ac_0 conda-forge charls 2.4.2 h59595ed_0 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge click 8.1.7 unix_pyh707e725_0 conda-forge contourpy 1.2.0 py311h9547e67_0 conda-forge cryptography 42.0.3 py311h63ff55d_0 conda-forge cuda-crt-tools 12.3.107 ha770c72_0 conda-forge cuda-cudart 12.3.101 hd3aeb46_0 conda-forge cuda-cudart_linux-64 12.3.101 h59595ed_0 conda-forge cuda-nvcc-tools 12.3.107 hd3aeb46_0 conda-forge cuda-nvrtc 12.3.107 hd3aeb46_0 conda-forge cuda-nvtx 12.3.101 h59595ed_0 conda-forge cuda-nvvm-tools 12.3.107 h59595ed_0 conda-forge cuda-version 12.3 h32bc705_2 conda-forge cudnn 8.8.0.121 h264754d_4 conda-forge cycler 0.12.1 pyhd8ed1ab_0 conda-forge dav1d 1.2.1 hd590300_0 conda-forge eigen 3.4.0 h00ab1b0_0 conda-forge expat 2.5.0 hcb278e6_1 conda-forge fftw 3.3.10 nompi_hc118613_108 conda-forge flatbuffers 23.5.26 h59595ed_1 conda-forge fonttools 4.49.0 py311h459d7ec_0 conda-forge freetype 2.12.1 h267a509_2 conda-forge frozenlist 1.4.1 py311h459d7ec_0 conda-forge gast 0.5.4 pyhd8ed1ab_0 conda-forge giflib 5.2.1 h0b41bf4_3 conda-forge google-auth 2.28.0 pyhca7485f_0 conda-forge google-auth-oauthlib 1.2.0 pyhd8ed1ab_0 conda-forge google-pasta 0.2.0 pyh8c360ce_0 conda-forge grpcio 1.59.3 py311ha6695c7_0 conda-forge h5py 3.10.0 nompi_py311hebc2b07_101 conda-forge hdf5 1.14.3 nompi_h4f84152_100 conda-forge icu 73.2 h59595ed_0 conda-forge idna 3.6 pyhd8ed1ab_0 conda-forge imagecodecs 2024.1.1 py311h089f87a_0 conda-forge imageio 2.34.0 pyh4b66e23_0 conda-forge importlib-metadata 7.0.1 pyha770c72_0 conda-forge importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge jxrlib 1.1 hd590300_3 conda-forge keras 2.15.0 pyhd8ed1ab_0 conda-forge keyutils 1.6.1 h166bdaf_0 conda-forge kiwisolver 1.4.5 py311h9547e67_1 conda-forge krb5 1.21.2 h659d440_0 conda-forge lazy_loader 0.3 pyhd8ed1ab_0 conda-forge lcms2 2.16 hb7c19ff_0 conda-forge ld_impl_linux-64 2.40 h41732ed_0 conda-forge lerc 4.0.0 h27087fc_0 conda-forge libabseil 20230802.1 cxx17_h59595ed_0 conda-forge libaec 1.1.2 h59595ed_1 conda-forge libavif16 1.0.4 h1dcd450_0 conda-forge libblas 3.9.0 21_linux64_openblas conda-forge libbrotlicommon 1.1.0 hd590300_1 conda-forge libbrotlidec 1.1.0 hd590300_1 conda-forge libbrotlienc 1.1.0 hd590300_1 conda-forge libcblas 3.9.0 21_linux64_openblas conda-forge libcublas 12.3.4.1 hd3aeb46_0 conda-forge libcufft 11.0.12.1 hd3aeb46_0 conda-forge libcurand 10.3.4.107 hd3aeb46_0 conda-forge libcurl 8.5.0 hca28451_0 conda-forge libcusolver 11.5.4.101 hd3aeb46_0 conda-forge libcusparse 12.2.0.103 hd3aeb46_0 conda-forge libdeflate 1.19 hd590300_0 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 hd590300_2 conda-forge libexpat 2.5.0 hcb278e6_1 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.2.0 h807b86a_5 conda-forge libgfortran-ng 13.2.0 h69a702a_5 conda-forge libgfortran5 13.2.0 ha4646dd_5 conda-forge libgomp 13.2.0 h807b86a_5 conda-forge libgrpc 1.59.3 hd6c4280_0 conda-forge libhwloc 2.9.3 default_h554bfaf_1009 conda-forge libiconv 1.17 hd590300_2 conda-forge libitk 5.3.0 h26001f5_8 conda-forge libjpeg-turbo 3.0.0 hd590300_1 conda-forge liblapack 3.9.0 21_linux64_openblas conda-forge libllvm14 14.0.6 hcd5def8_4 conda-forge libnghttp2 1.58.0 h47da74e_1 conda-forge libnsl 2.0.1 hd590300_0 conda-forge libnvjitlink 12.3.101 hd3aeb46_0 conda-forge libopenblas 0.3.26 pthreads_h413a1c8_0 conda-forge libpng 1.6.42 h2797004_0 conda-forge libprotobuf 4.24.4 hf27288f_0 conda-forge libre2-11 2023.06.02 h7a70373_0 conda-forge libsqlite 3.45.1 h2797004_0 conda-forge libssh2 1.11.0 h0841786_0 conda-forge libstdcxx-ng 13.2.0 h7e041cc_5 conda-forge libtiff 4.6.0 ha9c0a0a_2 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libwebp-base 1.3.2 hd590300_0 conda-forge libxcb 1.15 h0b41bf4_0 conda-forge libxcrypt 4.4.36 hd590300_1 conda-forge libxml2 2.12.5 h232c23b_0 conda-forge libzlib 1.2.13 hd590300_5 conda-forge libzopfli 1.0.3 h9c3ff4c_0 conda-forge llvmlite 0.42.0 py311ha6695c7_1 conda-forge lz4-c 1.9.4 hcb278e6_0 conda-forge markdown 3.5.2 pyhd8ed1ab_0 conda-forge markupsafe 2.1.5 py311h459d7ec_0 conda-forge matplotlib-base 3.8.3 py311h54ef318_0 conda-forge ml_dtypes 0.2.0 py311h320fe9a_2 conda-forge multidict 6.0.5 py311h459d7ec_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge nccl 2.20.3.1 h3a97aeb_0 conda-forge ncurses 6.4 h59595ed_2 conda-forge networkx 3.2.1 pyhd8ed1ab_0 conda-forge nibabel 5.2.0 pyha770c72_0 conda-forge numba 0.59.0 py311h96b013e_1 conda-forge numpy 1.26.4 py311h64a7726_0 conda-forge oauthlib 3.2.2 pyhd8ed1ab_0 conda-forge openjpeg 2.5.0 h488ebb8_3 conda-forge openssl 3.2.1 hd590300_0 conda-forge opt_einsum 3.3.0 pyhc1e730c_2 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge pillow 10.2.0 py311ha6c5da5_0 conda-forge pip 24.0 pyhd8ed1ab_0 conda-forge protobuf 4.24.4 py311h46cbc50_0 conda-forge pthread-stubs 0.4 h36c2ea0_1001 conda-forge pyapetnet 1.5.1 pyhd8ed1ab_0 conda-forge pyasn1 0.5.1 pyhd8ed1ab_0 conda-forge pyasn1-modules 0.3.0 pyhd8ed1ab_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydicom 2.4.4 pyhd8ed1ab_0 conda-forge pyjwt 2.8.0 pyhd8ed1ab_1 conda-forge pymirc 0.29 pyhd8ed1ab_0 conda-forge pyopenssl 24.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.1.1 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge python 3.11.8 hab00c5b_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-flatbuffers 23.5.26 pyhd8ed1ab_0 conda-forge python_abi 3.11 4_cp311 conda-forge pyu2f 0.1.5 pyhd8ed1ab_0 conda-forge pywavelets 1.4.1 py311h1f0f07a_1 conda-forge rav1e 0.6.6 he8a937b_2 conda-forge re2 2023.06.02 h2873b5e_0 conda-forge readline 8.2 h8228510_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge requests-oauthlib 1.3.1 pyhd8ed1ab_0 conda-forge rsa 4.9 pyhd8ed1ab_0 conda-forge scikit-image 0.22.0 py311h320fe9a_2 conda-forge scipy 1.12.0 py311h64a7726_2 conda-forge setuptools 69.1.0 pyhd8ed1ab_0 conda-forge simpleitk 2.3.1 py311hb755f60_2 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h9fff704_0 conda-forge svt-av1 1.8.0 h59595ed_0 conda-forge tbb 2021.11.0 h00ab1b0_1 conda-forge tensorboard 2.15.2 pyhd8ed1ab_0 conda-forge tensorboard-data-server 0.7.0 py311h63ff55d_1 conda-forge tensorflow 2.15.0 cuda120py311h5cbd639_3 conda-forge tensorflow-base 2.15.0 cuda120py311h43b5e44_3 conda-forge tensorflow-estimator 2.15.0 cuda120py311hf663016_3 conda-forge termcolor 2.4.0 pyhd8ed1ab_0 conda-forge tifffile 2024.2.12 pyhd8ed1ab_0 conda-forge tk 8.6.13 noxft_h4845f30_101 conda-forge typing_extensions 4.9.0 pyha770c72_0 conda-forge tzdata 2024a h0c530f3_0 conda-forge urllib3 2.2.1 pyhd8ed1ab_0 conda-forge werkzeug 3.0.1 pyhd8ed1ab_0 conda-forge wheel 0.42.0 pyhd8ed1ab_0 conda-forge wrapt 1.14.1 py311hd4cff14_1 conda-forge xorg-libxau 1.0.11 hd590300_0 conda-forge xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge yarl 1.9.4 py311h459d7ec_0 conda-forge zfp 1.0.1 h59595ed_0 conda-forge zipp 3.17.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 hd590300_5 conda-forge zlib-ng 2.0.7 h0b41bf4_0 conda-forge zstd 1.5.5 hfc55251_0 conda-forge — Reply to this email directly, view it on GitHub https://github.com/gschramm/pyapetnet/issues/8#issuecomment-1952801584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHU7WAOSM67OZLKEQPORO4LYUN3QDAVCNFSM6AAAAABDIAQ33KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSHAYDCNJYGQ. You are receiving this because you authored the thread.

gschramm commented 9 months ago

Hi Gyula,

  1. your package list will never be close to mine since we are running on different OS versions and we also have a mismatch in GPU presence. But if everything works as it should (not sure if it does) these three lines should also work for you:
conda create -c conda-forge -n pyapetnet pyapetnet
conda activate pyapetnet
pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show

If this does not work for your system, can you please send me the error messages?

  1. I am working on 1.5.2 release that fixes install bugs, but for that I need the answer to 1.
gkotek commented 9 months ago

Here it is:

$ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show
2024-02-19 17:59:25.265216: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
2024-02-19 17:59:25.284127: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE4.1 SSE4.2 AVX AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model. Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), NOT tf.saved_model.save(). To confirm, there should be a file named "keras_metadata.pb" in the SavedModel directory.
/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/layers/core/lambda_layer.py:327: UserWarning: tensorflow.python.keras.utils.multi_gpu_utils is not loaded, but a Lambda layer uses it. It may cause errors.
function = cls._parse_function_from_config(
Traceback (most recent call last):
File "/home/gkotek/anaconda3/envs/pyapetnet/bin/pyapetnet_predict_from_nifti", line 10, in
sys.exit(main())
^^^^^^
File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 124, in main
pred = model.predict(x).squeeze()
^^^^^^^^^^^^^^^^
File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_1 defined at (most recent call last): File "/home/gkotek/anaconda3/envs/pyapetnet/bin/pyapetnet_predict_from_nifti", line 10, in

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 124, in main

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 2655, in predict

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 2440, in predict_function

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 2425, in step_function

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 2413, in run_step

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 2381, in predict_step

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 590, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/functional.py", line 515, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graph

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/training.py", line 590, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/functional.py", line 515, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graph

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 597, in call

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 990, in _fused_batch_norm

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/utils/control_flow_util.py", line 108, in smart_cond

File "/home/gkotek/anaconda3/envs/pyapetnet/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 979, in _fused_batch_norm_inference

scale must have the same number of elements as the channels of x, got 15 and 1 [[{{node functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_1}}]] [Op:__inference_predict_function_14236]

gschramm commented 9 months ago

Hi,

yesterday night, I released v1.5.2 on conda-forge which is supposed to fix all dependency issues. Note that there is no pypi version more. The new build also include automatic tests of predictions on the latest ubuntu versions (which all passed). I also tested on a local Ubuntu 22.04 machine without GPU.

Can you please try the three liner below in a fresh conda env? (should install pyapetnet v1.5.2 and all dependencies)

conda create -c conda-forge -n pyapetnet-152 pyapetnet
conda activate pyapetnet-152
pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show
gkotek commented 9 months ago

I hardly dare after all this to post the error message - but here it is:

$ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show Traceback (most recent call last): File "/home/gkotek/.local/bin/pyapetnet_predict_from_nifti", line 8, in sys.exit(main()) File "/home/gkotek/.local/lib/python3.10/site-packages/pyapetnet/predict_from_nifti.py", line 49, in main from pyapetnet.utils import load_nii_in_ras File "/home/gkotek/.local/lib/python3.10/site-packages/pyapetnet/utils.py", line 5, in from pymirc.fileio import write_3d_static_dicom File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/init.py", line 1, in from . import fileio File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/fileio/init.py", line 5, in from .labelvol_to_rtstruct import labelvol_to_rtstruct File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/fileio/labelvol_to_rtstruct.py", line 1, in import pymirc.image_operations as pymi File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/image_operations/init.py", line 6, in from .binary_2d_image_to_contours import binary_2d_image_to_contours File "/home/gkotek/.local/lib/python3.10/site-packages/pymirc/image_operations/binary_2d_image_to_contours.py", line 6, in from skimage import measure File "/home/gkotek/.local/lib/python3.10/site-packages/skimage/init.py", line 122, in from ._shared import geometry File "geometry.pyx", line 1, in init skimage._shared.geometry ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

gkotek commented 9 months ago

My Python version is: Python 3.11.8

gkotek commented 9 months ago

To add more info, here is the output from conda list:

$ conda list

packages in environment at /home/gkotek/miniconda3/envs/pyapetnet-152:

#

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge absl-py 2.1.0 pyhd8ed1ab_0 conda-forge aiohttp 3.9.3 py311h459d7ec_0 conda-forge aiosignal 1.3.1 pyhd8ed1ab_0 conda-forge aom 3.8.1 h59595ed_0 conda-forge astunparse 1.6.3 pyhd8ed1ab_0 conda-forge attrs 23.2.0 pyh71513ae_0 conda-forge blinker 1.7.0 pyhd8ed1ab_0 conda-forge blosc 1.21.5 h0f2a231_0 conda-forge brotli 1.1.0 hd590300_1 conda-forge brotli-bin 1.1.0 hd590300_1 conda-forge brotli-python 1.1.0 py311hb755f60_1 conda-forge brunsli 0.1 h9c3ff4c_0 conda-forge bzip2 1.0.8 hd590300_5 conda-forge c-ares 1.26.0 hd590300_0 conda-forge c-blosc2 2.13.2 hb4ffafa_0 conda-forge ca-certificates 2024.2.2 hbcca054_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 5.3.2 pyhd8ed1ab_0 conda-forge certifi 2024.2.2 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py311hb3a22ac_0 conda-forge charls 2.4.2 h59595ed_0 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge click 8.1.7 unix_pyh707e725_0 conda-forge contourpy 1.2.0 py311h9547e67_0 conda-forge cryptography 42.0.3 py311h63ff55d_0 conda-forge cycler 0.12.1 pyhd8ed1ab_0 conda-forge dav1d 1.2.1 hd590300_0 conda-forge eigen 3.4.0 h00ab1b0_0 conda-forge expat 2.5.0 hcb278e6_1 conda-forge fftw 3.3.10 nompi_hc118613_108 conda-forge flatbuffers 23.5.26 h59595ed_1 conda-forge fonttools 4.49.0 py311h459d7ec_0 conda-forge freetype 2.12.1 h267a509_2 conda-forge frozenlist 1.4.1 py311h459d7ec_0 conda-forge gast 0.5.4 pyhd8ed1ab_0 conda-forge giflib 5.2.1 h0b41bf4_3 conda-forge google-auth 2.28.0 pyhca7485f_0 conda-forge google-auth-oauthlib 1.2.0 pyhd8ed1ab_0 conda-forge google-pasta 0.2.0 pyh8c360ce_0 conda-forge grpcio 1.59.3 py311ha6695c7_0 conda-forge h5py 3.10.0 nompi_py311hebc2b07_101 conda-forge hdf5 1.14.3 nompi_h4f84152_100 conda-forge icu 73.2 h59595ed_0 conda-forge idna 3.6 pyhd8ed1ab_0 conda-forge imagecodecs 2024.1.1 py311h089f87a_0 conda-forge imageio 2.34.0 pyh4b66e23_0 conda-forge importlib-metadata 7.0.1 pyha770c72_0 conda-forge importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge jxrlib 1.1 hd590300_3 conda-forge keras 2.15.0 pyhd8ed1ab_0 conda-forge keyutils 1.6.1 h166bdaf_0 conda-forge kiwisolver 1.4.5 py311h9547e67_1 conda-forge krb5 1.21.2 h659d440_0 conda-forge lazy_loader 0.3 pyhd8ed1ab_0 conda-forge lcms2 2.16 hb7c19ff_0 conda-forge ld_impl_linux-64 2.40 h41732ed_0 conda-forge lerc 4.0.0 h27087fc_0 conda-forge libabseil 20230802.1 cxx17_h59595ed_0 conda-forge libaec 1.1.2 h59595ed_1 conda-forge libavif16 1.0.4 h1dcd450_0 conda-forge libblas 3.9.0 21_linux64_openblas conda-forge libbrotlicommon 1.1.0 hd590300_1 conda-forge libbrotlidec 1.1.0 hd590300_1 conda-forge libbrotlienc 1.1.0 hd590300_1 conda-forge libcblas 3.9.0 21_linux64_openblas conda-forge libcurl 8.5.0 hca28451_0 conda-forge libdeflate 1.19 hd590300_0 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 hd590300_2 conda-forge libexpat 2.5.0 hcb278e6_1 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.2.0 h807b86a_5 conda-forge libgfortran-ng 13.2.0 h69a702a_5 conda-forge libgfortran5 13.2.0 ha4646dd_5 conda-forge libgomp 13.2.0 h807b86a_5 conda-forge libgrpc 1.59.3 hd6c4280_0 conda-forge libhwloc 2.9.3 default_h554bfaf_1009 conda-forge libiconv 1.17 hd590300_2 conda-forge libitk 5.3.0 h26001f5_8 conda-forge libjpeg-turbo 3.0.0 hd590300_1 conda-forge liblapack 3.9.0 21_linux64_openblas conda-forge libllvm14 14.0.6 hcd5def8_4 conda-forge libnghttp2 1.58.0 h47da74e_1 conda-forge libnsl 2.0.1 hd590300_0 conda-forge libopenblas 0.3.26 pthreads_h413a1c8_0 conda-forge libpng 1.6.42 h2797004_0 conda-forge libprotobuf 4.24.4 hf27288f_0 conda-forge libre2-11 2023.06.02 h7a70373_0 conda-forge libsqlite 3.45.1 h2797004_0 conda-forge libssh2 1.11.0 h0841786_0 conda-forge libstdcxx-ng 13.2.0 h7e041cc_5 conda-forge libtiff 4.6.0 ha9c0a0a_2 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libwebp-base 1.3.2 hd590300_0 conda-forge libxcb 1.15 h0b41bf4_0 conda-forge libxcrypt 4.4.36 hd590300_1 conda-forge libxml2 2.12.5 h232c23b_0 conda-forge libzlib 1.2.13 hd590300_5 conda-forge libzopfli 1.0.3 h9c3ff4c_0 conda-forge llvmlite 0.42.0 py311ha6695c7_1 conda-forge lz4-c 1.9.4 hcb278e6_0 conda-forge markdown 3.5.2 pyhd8ed1ab_0 conda-forge markupsafe 2.1.5 py311h459d7ec_0 conda-forge matplotlib-base 3.8.3 py311h54ef318_0 conda-forge ml_dtypes 0.2.0 py311h320fe9a_2 conda-forge multidict 6.0.5 py311h459d7ec_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge ncurses 6.4 h59595ed_2 conda-forge networkx 3.2.1 pyhd8ed1ab_0 conda-forge nibabel 5.2.0 pyha770c72_0 conda-forge numba 0.59.0 py311h96b013e_1 conda-forge numpy 1.26.4 py311h64a7726_0 conda-forge oauthlib 3.2.2 pyhd8ed1ab_0 conda-forge openjpeg 2.5.0 h488ebb8_3 conda-forge openssl 3.2.1 hd590300_0 conda-forge opt_einsum 3.3.0 pyhc1e730c_2 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge pillow 10.2.0 py311ha6c5da5_0 conda-forge pip 24.0 pyhd8ed1ab_0 conda-forge protobuf 4.24.4 py311h46cbc50_0 conda-forge pthread-stubs 0.4 h36c2ea0_1001 conda-forge pyapetnet 1.5.2 pyhd8ed1ab_0 conda-forge pyasn1 0.5.1 pyhd8ed1ab_0 conda-forge pyasn1-modules 0.3.0 pyhd8ed1ab_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydicom 2.4.4 pyhd8ed1ab_0 conda-forge pyjwt 2.8.0 pyhd8ed1ab_1 conda-forge pymirc 0.29 pyhd8ed1ab_0 conda-forge pyopenssl 24.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.1.1 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge python 3.11.8 hab00c5b_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-flatbuffers 23.5.26 pyhd8ed1ab_0 conda-forge python_abi 3.11 4_cp311 conda-forge pyu2f 0.1.5 pyhd8ed1ab_0 conda-forge pywavelets 1.4.1 py311h1f0f07a_1 conda-forge rav1e 0.6.6 he8a937b_2 conda-forge re2 2023.06.02 h2873b5e_0 conda-forge readline 8.2 h8228510_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge requests-oauthlib 1.3.1 pyhd8ed1ab_0 conda-forge rsa 4.9 pyhd8ed1ab_0 conda-forge scikit-image 0.22.0 py311h320fe9a_2 conda-forge scipy 1.12.0 py311h64a7726_2 conda-forge setuptools 69.1.0 pyhd8ed1ab_1 conda-forge simpleitk 2.3.1 py311hb755f60_2 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h9fff704_0 conda-forge svt-av1 1.8.0 h59595ed_0 conda-forge tbb 2021.11.0 h00ab1b0_1 conda-forge tensorboard 2.15.2 pyhd8ed1ab_0 conda-forge tensorboard-data-server 0.7.0 py311h63ff55d_1 conda-forge tensorflow 2.15.0 cpu_py311hd3d7757_2 conda-forge tensorflow-base 2.15.0 cpu_py311h6aa969b_2 conda-forge tensorflow-estimator 2.15.0 cpu_py311ha26c8b9_2 conda-forge termcolor 2.4.0 pyhd8ed1ab_0 conda-forge tifffile 2024.2.12 pyhd8ed1ab_0 conda-forge tk 8.6.13 noxft_h4845f30_101 conda-forge typing_extensions 4.9.0 pyha770c72_0 conda-forge tzdata 2024a h0c530f3_0 conda-forge urllib3 2.2.1 pyhd8ed1ab_0 conda-forge werkzeug 3.0.1 pyhd8ed1ab_0 conda-forge wheel 0.42.0 pyhd8ed1ab_0 conda-forge wrapt 1.14.1 py311hd4cff14_1 conda-forge xorg-libxau 1.0.11 hd590300_0 conda-forge xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge yarl 1.9.4 py311h459d7ec_0 conda-forge zfp 1.0.1 h59595ed_0 conda-forge zipp 3.17.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 hd590300_5 conda-forge zlib-ng 2.0.7 h0b41bf4_0 conda-forge zstd 1.5.5 hfc55251_0 conda-forge

gschramm commented 9 months ago

Sorry to hear that (please always dare to report bugs / unexpected behavior ...)

  1. Two things that immediately jumps to my eyes: /home/gkotek/.local/lib/python3.10/site-packages/skimage/init.py seems to indicate you should be using python 3.10, but you says 3.11.8
  2. /home/gkotek/.local/lib is a very "uncoventional" place for storing mamba python envs. Your posted package list also says: /home/gkotek/miniconda3/envs/pyapetnet-152 When running things in the pyapetnet-152 env, no libs of /home/gkotek/.local should be used

So I think that your are mixing different python envs (maybe some from mamba, some from pip ...).

To debug this, I suggets:

  1. check you PYTHONPATH environment variable (this should be empty, but it could contain things that link to /home/gkotek/.local which it should not). If it is not empty, clear it.
  2. if 1, did not work, uninstall miniforge / conda (make sure to remove mamba/conda related things from your .bashrc)
  3. re-install miniforge from here
  4. initialize miniforge and re-check your .bashrc, and check that PYTHONPATH is empty
gkotek commented 9 months ago

OK, thanks, it was indeed a mess...so followed your comments:

  1. 1st option did not work (could not get rid of undesired paths in sys.path), had to follow uninstallation, reinstallation miniforge also did: conda create -c conda-forge -n pyapetnet-152 pyapetnet conda activate pyapetnet-152

  2. echo $PYTHONPATH is empty - nothing comes in from .bashrc

  3. checking sys.path - looks OK to me: $ python Python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:53:32) [GCC 12.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

    import sys sys.path ['', '/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python311.zip', '/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11', '/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/lib-dynload', '/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages']

  4. running estimation gives an error (same old) - but uses the right packages I believe: $ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show 2024-02-20 17:18:35.545212: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2024-02-20 17:18:35.564247: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: SSE4.1 SSE4.2 AVX AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model. Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), NOT tf.saved_model.save(). To confirm, there should be a file named "keras_metadata.pb" in the SavedModel directory. /home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/layers/core/lambda_layer.py:327: UserWarning: tensorflow.python.keras.utils.multi_gpu_utils is not loaded, but a Lambda layer uses it. It may cause errors. function = cls._parse_function_from_config( Traceback (most recent call last): File "/home/gkotek/miniforge3/envs/pyapetnet-152/bin/pyapetnet_predict_from_nifti", line 10, in sys.exit(main()) ^^^^^^ File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 130, in main pred = model.predict(x).squeeze() ^^^^^^^^^^^^^^^^ File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_1 defined at (most recent call last): File "/home/gkotek/miniforge3/envs/pyapetnet-152/bin/pyapetnet_predict_from_nifti", line 10, in

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/pyapetnet/predict_from_nifti.py", line 130, in main

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 2655, in predict

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 2440, in predict_function

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 2425, in step_function

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 2413, in run_step

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 2381, in predict_step

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 590, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/functional.py", line 515, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graph

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/training.py", line 590, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/functional.py", line 515, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graph

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/engine/base_layer.py", line 1149, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 597, in call

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 990, in _fused_batch_norm

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/utils/control_flow_util.py", line 108, in smart_cond

File "/home/gkotek/miniforge3/envs/pyapetnet-152/lib/python3.11/site-packages/keras/src/layers/normalization/batch_normalization.py", line 979, in _fused_batch_norm_inference

scale must have the same number of elements as the channels of x, got 15 and 1 [[{{node functional_3/functional_1/batchnorm_ind_0_0/FusedBatchNormV3_1}}]] [Op:__inference_predict_function_14236]

gschramm commented 9 months ago

at least we are back to the initial error :) what I don't understand: I am able to run it on:

so I am getting lost here ...

what kind of CPUs are you using?

gkotek commented 9 months ago

Indeed :) It is maddening...especially with all the caution of using virtual environment... (I will also try on my Mac and on a RHEL later ... after my return from holiday.)

But for now on the CPU question:

$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 16 On-line CPU(s) list: 0-15 Vendor ID: GenuineIntel Model name: 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz CPU family: 6 Model: 167 Thread(s) per core: 2 Core(s) per socket: 8 Socket(s): 1 Stepping: 1 CPU max MHz: 4900,0000 CPU min MHz: 800,0000 BogoMIPS: 4992.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm c onstant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cp uid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 e rms invpcid mpx avx512f avx512dq rdseed adx smap avx512ifma clflushopt intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves dther m ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bi talg avx512_vpopcntdq rdpid fsrm md_clear flush_l1d arch_capabilities Virtualization features: Virtualization: VT-x Caches (sum of all):
L1d: 384 KiB (8 instances) L1i: 256 KiB (8 instances) L2: 4 MiB (8 instances) L3: 16 MiB (1 instance) NUMA:
NUMA node(s): 1 NUMA node0 CPU(s): 0-15 Vulnerabilities:
Gather data sampling: Mitigation; Microcode Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable Retbleed: Mitigation; Enhanced IBRS Spec rstack overflow: Not affected Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Srbds: Not affected Tsx async abort: Not affected

gschramm commented 9 months ago

One last thing to try on this system:

  1. locate where the pre-trained models are stored in your env by running pyapetnet_list_models
  2. unzip the attached zipped "test_model" in this directory test_model.zip
  3. re-run pyapet_list_models to see if it recognized your new test_model
  4. re-run the prediction test with the new test model (which is an old model, but re-saved in tf v2.15) pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii test_model --show
gkotek commented 8 months ago

Hi Georg, Hi Georg, Thanks for the support so far. I need to take a break, need to get on the road. When I am back I will clean up my Ubuntu and go from scratch again. I will report back next week.

PS: It seems that my python environment is really messed up now. ~/.local pops up again... See: $ pyapetnet_list_models Traceback (most recent call last): File "/home/gkotek/.local/bin/pyapetnet_list_models", line 5, in from pyapetnet.list_models import main ModuleNotFoundError: No module named 'pyapetnet'

gkotek commented 8 months ago

Hi Georg, Success with nifti: I successfully installed and run test with nifti demo data on a different machine (RHEL 8) The steps I followed: install miniforge3 from 'https://github.com/conda-forge/miniforge?tab=readme-ov-file' $ conda create -c conda-forge -n pyapetnet-152 pyapetnet $ conda activate pyapetnet-152 $ pyapetnet_predict_from_nifti brainweb_06_osem.nii brainweb_06_t1.nii S2_osem_b10_fdg_pe2i --show

Trouble with dicom: $ pyapetnet_predict_from_dicom brainweb_06_osem_dcm brainweb_06_t1_dcm S2_osem_b10_fdg_pe2i --show 2024-03-07 12:18:25.747898: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. Traceback (most recent call last): File "/home/r471670/miniforge3/envs/pyapetnet-152/bin/pyapetnet_predict_from_dicom", line 10, in sys.exit(predict_from_dicom()) File "/home/r471670/miniforge3/envs/pyapetnet-152/lib/python3.10/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home/r471670/miniforge3/envs/pyapetnet-152/lib/python3.10/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home/r471670/miniforge3/envs/pyapetnet-152/lib/python3.10/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/r471670/miniforge3/envs/pyapetnet-152/lib/python3.10/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/home/r471670/miniforge3/envs/pyapetnet-152/lib/python3.10/site-packages/pyapetnet/scripts/predict_from_dicom.py", line 97, in predict_from_dicom series_description_suffix = f"m{model_name}_v{pyapetnet.version}" AttributeError: module 'pyapetnet' has no attribute 'version__'

the version I use: $ conda list | grep pyapetnet pyapetnet 1.5.3 pyhd8ed1ab_0 conda-forge

gschramm commented 8 months ago

Glad to hear that the nifti prediction works. "version" was indeed removed in 1.5.3 which resulted in this bug. I will try to fix this asap and release v1.5.4

gkotek commented 8 months ago

Thanks! I have a student starting in a few weeks. Hopefully all will work fine. We have 25+ glioma patients' data and more will be secured soon (ethical approval, data is there). Will you let me know on this issue page if the new version is available?

Thanks for the support! After all the problems were caused by my physical Ubuntu machine's setup...I migrated to RHEL for now.

Gyula

gschramm commented 8 months ago

v1.5.4 is available on conda-forge and pypi. pyapetnet.version is now availalbe again. Note that currently with the conda-forge version the returned value is not correct, but that should not matter.

Can you try again?

gschramm commented 8 months ago

@gkotek could you close this issue, if eveything works as expected in v1.5.4? I just double checked, and even in the conda-forge package "version" should be correct :)

gkotek commented 8 months ago

Yes, everything works as expected with the demo data! It works both with nifti and dice. Thanks for the last update ... and ongoing support.

Gyula