Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy not detected when installing from source #90

Closed
merrygoat opened this issue Jun 28, 2024 · 3 comments
Closed

Numpy not detected when installing from source #90

merrygoat opened this issue Jun 28, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@merrygoat
Copy link

After RodTracking is installed from source on Windows, an error is given when trying to run a detection that indicates that PyTorch cannot find NumPy

To Reproduce
git clone https://github.com/ANP-Granular/ParticleTracking.git .
python -m venv venv
.\venv\Scripts\activate
cd .\RodTracker
pip install -e .
rodtracker

In GUI -> Load images -> Select \RodTracker\src\RodTracker\resources\example_data\images\gp3
In Detection Tab click "Use Example Model"
In detection Tab click "Detect"

"An Unexpected Error Occurred" dialog is shown.

Additional context
pip list shows that numpy 2.0.0 is present in the venv

Logs
Attached because markdown mangles the formatting: log.txt

@merrygoat merrygoat added the bug Something isn't working label Jun 28, 2024
@merrygoat
Copy link
Author

I see now that this seems to be related to an incompatibility between Pytorch and Numpy 2.0.

In stdout for the GUI I see:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

And a traceback which points to torch.

Solution is pip install numpy<2.

This: pytorch/pytorch#107302 seems to suggest pytorch>2.2 should be fine with numpy 2 and my venv has torch 2.3.1, so I don't know what is going on there.

Perhaps just add a numpy<2 restriction to pyproject.toml.

@a-niem a-niem self-assigned this Jul 1, 2024
a-niem added a commit that referenced this issue Jul 1, 2024
Fix version mismatch of numpy with torchvision. Fixes #90.
@a-niem
Copy link
Collaborator

a-niem commented Jul 1, 2024

It appears that the issue stems from the installed version of torchvision being <0.19 (see this issue). As suggested, I've added the additional version restriction in the pyproject.toml.

a-niem added a commit that referenced this issue Jul 1, 2024
Skip any tests requiring GUI interactions when run with GitHub Actions because they don't run properly.
With this the automated testing workflow shall be enabled again to get early hints on issues like #90.
a-niem added a commit that referenced this issue Jul 5, 2024
Fix version mismatch of numpy with torchvision. Fixes #90.
@merrygoat
Copy link
Author

Just installed develop branch from source and that worked well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants