Social-Evolution-and-Behavior / anTraX

anTraX: high throughput tracking of color-tagged insects
https://antrax.readthedocs.io/
GNU General Public License v3.0
17 stars 3 forks source link

Installation issue on m1 Mac #28

Open dknebel opened 2 years ago

dknebel commented 2 years ago

Hi Asaf, Thanks for publishing your neat code!

I want to use anTraX for tracking ants. However, I run into a problem when trying to open the app. I followed the installation guide on my m1-chipped Mac (OS Big Sur), but upon launching either "antrax configure" or "antrax track" I get the following message in terminal:

zsh: illegal hardware instruction antrax configure

or:

zsh: illegal hardware instruction antrax track

A google search raised a suspicion that it has to do with the m1 chip. Did you encounter this issue before? any ideas? Thanks!!

asafgal commented 2 years ago

Hey Daniel,

I'm afraid I don't have experience with M1 myself, so I can only guess what the issues are.

I think your problem is with tensorflow, which needs to be specifically compiled to M1. To make sure this is indeed the issue, try launching a python console and import tensorflow, and see if you get the same error as when launching antrax.

A full solution to this issue might be tricky. But we can try a temporary workaround:

Follow one of the online cheatsheets for installing tensorflow on M1 (e.g. here).

After you install the M1 version of tensorflow, try installing antrax into the same environment. Before you do, remove the tensorflow dependency line from the setup.py file of antrax.

Now try to launch antrax.

This will allow you to start using the configuration gui and the first tracking step. You might have more issues down the road because of incompatibility between the M1 version of tensorflow and the TF code in antrax, which was developed with an old version of TF. We'll have to see about that.

Good luck

dknebel commented 2 years ago

Hi Asaf, Following your suggestion, I got a bit further with the installation. Now the track function seems to work, however the configure function seems to have problems associating with MATLAB. I am not sure if this is still a m1 issue. Here is the error I get:

File .../antrax.mlapp, line 3567, in antrax.antrax Unable to resolve the name vision.BlobAnalysis.

I did add the repository to my MATLAB search path. Any idea what might cause it?

Thanks!

asafgal commented 2 years ago

Hey Daniel,

vision.blob analysis is a matlab function that is part of the computer vision toolbox. Make sure that you have it installed. You can try running this function directly from the matlab command line to make sure.

On Oct 16, 2021, at 11:44 AM, dknebel @.***> wrote:

 Hi Asaf, Following your suggestion, I got a bit further with the installation. Now the track function seems to work, however the configure function seems to have problems associating with MATLAB. I am not sure if this is still a m1 issue. Here is the error I get:

File .../antrax.mlapp, line 3567, in antrax.antrax Unable to resolve the name vision.BlobAnalysis.

I did add the repository to my MATLAB search path. Any idea what might cause it?

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

dknebel commented 2 years ago

Hi again, Thanks for the quick reply - indeed computer vision toolbox wasn't install. Now the configure function runs ok. However, when running the train and classify function I get the following message:

AttributeError: 'Sequential' object has no attribute '_make_predict_function'

I guess it has to do with me trying to run anTraX with a new version of TensorFlow (which works with the m1 Mac). Do you think there's a way to work around it?

Once again, thanks a lot for the support!

asafgal commented 2 years ago

Yeah, I was expecting this compatibility as anTraX uses an old TF version. The solution is to update anTraX to use latest TF, but it will take some time until I'll get to actually doing it. My suggestion is for now to do the these steps on some linux server, as anyhow they do not include a graphical interface.

dknebel commented 2 years ago

OK, will leave the Mac for now. Thanks for the support till now, and looking forward for the update.

Thanks!