DEICODE throwing 'numpy' has no attribute 'int' error

Hello,

I am attempting to use the DEICODE plugin, but I am getting what appears to be an incompatibility error.

I am running the qiime2-2023.7 version that was installed in a conda environment for the new (M2) mac. I haven't had any issues running this version of QIIME2 for other analyses/plugins. For DEICODE, I did the pip install, as directed on the qiime plugins page, and when I run the 'qiime deicode rpca --help' code, there does not appear to be any issues (all flag options populate with no errors).

However, when I attempt the full command:

qiime deicode rpca
--i-table table.qza
--o-biplot deicode-bioplot.qza
--o-distance-matrix deicode-dm.qza
--verbose

I get this error:

"Traceback (most recent call last):
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/q2cli/commands.py", line 478, in call
results = self._execute_action(
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/q2cli/commands.py", line 539, in _execute_action
results = action(**arguments)
File "", line 2, in rpca
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/qiime2/sdk/action.py", line 566, in callable_executor
output_views = self._callable(**view_args)
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/deicode/rpca.py", line 52, in rpca
opt = MatrixCompletion(n_components=n_components,
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/deicode/matrix_completion.py", line 94, in fit
self._fit()
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/deicode/matrix_completion.py", line 131, in _fit
self.U, self.s, self.V = OptSpace(n_components=self.n_components,
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/deicode/optspace.py", line 109, in solve
mask = (np.abs(obs) > 0).astype(np.int)
File "/Users/megan/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.0.dev0 Manual

Plugin error from deicode:

module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.0.dev0 Manual

See above for debug info."

I then installed an older version of numpy to keep this error from occurring with:

pip install "numpy<1.20.0"

This resulted in some dependency issues with QIIME2, so I uninstalled and reinstalled numpy to get back to the most updated version. This resolved the QIIME2 issues more generally, but now I am back at square one with DEICODE not working.

Thanks for any help!

Megan

Hello, @msthoemmes,
could you please describe you problem with more details.
I can not reproduce your problem on q2 VM.
Try - -verbose flag and give us an output.
Regards, sn

Hi Sergey,

Unfortunately, I do not have additional information. This was the error output I received when I used the --verbose flag.

Not specific to Qiime 2 but we encountered that error in a bunch of other projects. Numpy deprecated the common type aliases like np.int which affects a lot of packages that haven't received regular updates. Looking at the DEICODE source, there is at least one instance where the alias is used and 2023.7 installs numpy 1.24 so this line will fail. It should work with an older Qiime 2 version with a numpy<1.20.

4 Likes

@msthoemmes, are you able to try this with an older version of QIIME 2?

@cmartino, are you still maintaining DEICODE? If so, would you like us to create an issue for this on your issue tracker?

Thanks for the tag @gregcaporaso and for bringing up the issue @msthoemmes!

We have depreciated DEICODE and the up-to-date code for RPCA and further extensions like phylogenetically informed RPCA or time-informed dimensionality reduction all live here in Gemelli. It is being maintained so it would be great to put an issue in there since I think this issue might also be found there, and we will work on putting a patch ASAP. Thanks!

2 Likes

Issue created @cmartino.

It sounds like you would recommend that @msthoemmes install and use gemelli to access the rpca functionality - is that correct? And do you know what the most recent version of QIIME 2 is that can be used with gemelli? (Note that we have a release coming out this week, or possibly Monday, so if you want to update gemelli that's the best release to target.)

Adding onto the discussion. I installed gamelli plugin as well but still seeing the same error. Here is the command I ran:-
qiime gemelli rpca
--i-table DADA2_denoising_output/table_filtered_v2.qza
--p-min-feature-count 10
--p-min-sample-count 47500
--o-biplot core_metrics_47500/Aitchison_ordination.qza
--o-distance-matrix core_metrics_47500/Aitchison_distance.qza
--verbose
&> core_metrics_47500_Aitchison_samples.log

and here is the error I got:-

Traceback (most recent call last):
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/q2cli/commands.py", line 478, in call
results = self._execute_action(
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/q2cli/commands.py", line 539, in _execute_action
results = action(**arguments)
File "", line 2, in rpca
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/qiime2/sdk/action.py", line 566, in callable_executor
output_views = self._callable(**view_args)
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/gemelli/rpca.py", line 380, in rpca
ord_res, dist_res = optspace_helper(rclr_table,
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/gemelli/rpca.py", line 398, in optspace_helper
opt = MatrixCompletion(n_components=n_components,
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/gemelli/matrix_completion.py", line 102, in fit
self._fit()
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/gemelli/matrix_completion.py", line 139, in _fit
self.U, self.s, self.V = OptSpace(n_components=self.n_components,
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/gemelli/optspace.py", line 118, in solve
mask = (np.abs(obs) > 0).astype(np.int)
File "/home/anaqib/miniconda3/envs/qiime2-2023.7/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.0.dev0 Manual

Plugin error from gemelli:

module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.0.dev0 Manual

See above for debug info.

1 Like

Hi @ankurnaqib,
Seems like they are aware of this error in Gemelli
Greg created an issue here if you want to track process: possible numpy-related issue · Issue #71 · biocore/gemelli · GitHub
It looks like at this point the only work around in is downgrading your QIIME 2
Hope that helps!

1 Like

Thank you, Chloe. I understand. I will wait for the resolution. Is there a version you suggest to downgrade to that would not have this issue? Would qiime2-2023.5 be ok to downgrade to? Any suggestion would be appreciated.

Hello @ankurnaqib,

It looks like you have to go all the way back to 2021.2 to get numpy <1.20.

1 Like

Hi Colin,

Thank you for you response. I just downgraded to qiime2-2023.5 and was able to install and run through deicode. Am I doing anything wrong?

Hello @ankurnaqib,

Not that I'm aware of. You may have gotten a solve with less than 1.2 I guess?

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.

Hi all,
@cmartino informed us that this issue been fixed as of the new release of Gemelli that was released today! :tada:
For more info see this github issue!

Thanks for the update @cmartino :pray:

3 Likes