Closed mathieuboudreau closed 11 months ago
Here's the list of packages that were installed in my venv:
(nnunet) mathieuboudreau@Mathieus-MacBook-Pro nn-axondeepseg % pip freeze
acvl-utils==0.2
batchgenerators==0.25
certifi==2023.7.22
charset-normalizer==3.3.1
connected-components-3d==3.12.3
contourpy==1.1.1
cycler==0.12.1
dicom2nifti==2.4.8
dynamic-network-architectures==0.2
filelock==3.12.4
fonttools==4.43.1
fsspec==2023.10.0
future==0.18.3
graphviz==0.20.1
idna==3.4
imagecodecs==2023.3.16
imageio==2.31.6
importlib-resources==6.1.0
Jinja2==3.1.2
joblib==1.3.2
kiwisolver==1.4.5
lazy_loader==0.3
linecache2==1.0.0
loguru==0.7.2
MarkupSafe==2.1.3
matplotlib==3.7.3
MedPy==0.4.0
mpmath==1.3.0
networkx==3.1
nibabel==5.1.0
nnunetv2==2.0
numpy==1.24.4
opencv-python==4.8.1.78
packaging==23.2
pandas==2.0.3
Pillow==10.0.1
pydicom==2.4.3
pyparsing==3.1.1
python-dateutil==2.8.2
python-gdcm==3.0.22
pytz==2023.3.post1
PyWavelets==1.4.1
PyYAML==6.0.1
requests==2.31.0
scikit-image==0.21.0
scikit-learn==1.3.2
scipy==1.10.1
seaborn==0.13.0
SimpleITK==2.3.0
six==1.16.0
sympy==1.12
threadpoolctl==3.2.0
tifffile==2023.7.10
torch==2.1.0
tqdm==4.66.1
traceback2==1.4.0
typing_extensions==4.8.0
tzdata==2023.3
unittest2==1.1.0
urllib3==2.0.7
yacs==0.1.8
zipp==3.17.0
(nnunet) mathieuboudreau@Mathieus-MacBook-Pro nn-axondeepseg %
Ahh, yes we need to pin the nnunet version. The problem is that nnUNetPredictor
is a refactored version of the older nnunet inference function and it was only added very recently. I have version 2.2
, but the minor was only released a month ago. Here is an issue from the ivadomed utilities repo mentionning this: https://github.com/ivadomed/utilities/issues/38
The requirements.txt file should instead look like this:
nnunetv2>=2.2
Gotcha! I just tested and got this message:
(nnunet) mathieuboudreau@Mathieus-MacBook-Pro nn-axondeepseg % pip install -r requirements.txt
ERROR: Ignored the following versions that require a different python version: 2.1 Requires-Python >=3.9; 2.1.2 Requires-Python >=3.9; 2.2 Requires-Python >=3.9
ERROR: Could not find a version that satisfies the requirement nnunetv2>=2.2 (from versions: 2.0)
ERROR: No matching distribution found for nnunetv2>=2.2
Seems like I installed python with 3.8, but we'll also need to inform the users that they'll need a venv with python >=3.9 as well
That's why the unrestircted req file didn't install the latest version
Oh well, I forgot about that. As per https://pip.pypa.io/en/stable/reference/requirements-file-format/, we can specify this in the requirements.txt file using something like this:
python_version >= "2.9"
Oh well, I forgot about that. As per https://pip.pypa.io/en/stable/reference/requirements-file-format/, we can specify this in the requirements.txt file using something like this:
python_version >= "2.9"
I didn't know that - neat!
Ahh, but if you do that, it'll just not install the package at all actually:
(nnunet) mathieuboudreau@Mathieus-MacBook-Pro nn-axondeepseg % pip install -r requirements.txt
Ignoring nnunetv2: markers 'python_version >= "3.9"' don't match your environment
Requirement already satisfied: torch in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (2.1.0)
Requirement already satisfied: opencv-python in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (4.8.1.78)
Requirement already satisfied: loguru in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (0.7.2)
Requirement already satisfied: filelock in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (3.12.4)
Requirement already satisfied: typing-extensions in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (4.8.0)
Requirement already satisfied: sympy in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (1.12)
Requirement already satisfied: networkx in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (3.1)
Requirement already satisfied: jinja2 in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (3.1.2)
Requirement already satisfied: fsspec in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from torch->-r requirements.txt (line 2)) (2023.10.0)
Requirement already satisfied: numpy>=1.17.0 in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from opencv-python->-r requirements.txt (line 3)) (1.24.4)
Requirement already satisfied: MarkupSafe>=2.0 in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from jinja2->torch->-r requirements.txt (line 2)) (2.1.3)
Requirement already satisfied: mpmath>=0.19 in /Users/mathieuboudreau/opt/anaconda3/envs/nnunet/lib/python3.8/site-packages (from sympy->torch->-r requirements.txt (line 2)) (1.3.0)
(nnunet) mathieuboudreau@Mathieus-MacBook-Pro nn-axondeepseg %
So we should stick with only setting nnunetv2>=2.2 then
Ah damn. I'll add a note in the README that the user needs python >=3.9 then.
Besides, that, I installed it with the new nnunetv2 condition and this error doesn't occur anymore, but now I'm encountering #5
So I'll make a PR to close this one and we can continue discussing in the next issue
nm - I see you have https://github.com/axondeepseg/nn-axondeepseg/tree/ac/pin_nnunetv2 this branch already, so I'll let you do it!
Closed with #6
OS: MacOS venv tool: conda
I've followed all the installation instructions up to testing the segmentation command (installing both models), and when I run that command I get the following output (for both SEM and TEM images, and both UM and BF models):
Is this missing package not in the requirements.txt file? Or (more likely in my opinion) because the requirements don't have any versions in requirements.txt, and the latest nnunet software does not have that feature (or is renamed)?
https://github.com/axondeepseg/nn-axondeepseg/blob/cf4cfa34c7b0e80320a8f5e348326fdc8d9915d3/requirements.txt#L1