Closed HaimAshk closed 1 year ago
Hi @HaimAshk - what a silly numpy bug. The simplest fix would be to install an older version of numpy- for example with the command pip install numpy==1.23
Best, Matt
Dear @MrOlm,
Thanks a lot for the quick response! I now installed an older version of numpy as you suggested. inStrain -h seems to run now, but I get a different error when analyzing the dataset (a metagenomic sample against a single isolate genome):
inStrain profile S1MetagenomicR1R2_vs_isolate_ONT.sam isolate.fasta -o S1MetagenomicR1R2_vs_isolate_ONT.IS -p 6
Traceback (most recent call last):
File "InStrain_1.75/bin/inStrain", line 31, in <module>
inStrain.controller.Controller().main(args)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 54, in main
self.profile_operation(args)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 86, in profile_operation
ProfileController(args).main()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 149, in main
self.validate_arguments()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 187, in validate_arguments
ISP = inStrain.SNVprofile.SNVprofile(outbase)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/SNVprofile.py", line 44, in __init__
self._initialize_attributes()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/SNVprofile.py", line 580, in _initialize_attributes
self.store('location', self.location, 'value', 'Location of SNVprofile object')
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/SNVprofile.py", line 58, in store
adb = pd.DataFrame({'value':value, 'type':type, 'description':description}, index=[name])
File ".local/lib/python3.8/site-packages/pandas/core/frame.py", line 435, in __init__
mgr = init_dict(data, index, columns, dtype=dtype)
File ".local/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 254, in init_dict
return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
File ".local/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 69, in arrays_to_mgr
arrays = _homogenize(arrays, index, dtype)
File ".local/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 322, in _homogenize
val = sanitize_array(
File ".local/lib/python3.8/site-packages/pandas/core/construction.py", line 465, in sanitize_array
subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype)
File ".local/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1452, in construct_1d_arraylike_from_scalar
subarr = np.empty(length, dtype=dtype)
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
Is it related to the numpy error? Anything I did wrong (I followed the tutorial) ?
Thanks! Haim
Hi @HaimAshk - that seems to be a pandas error. Try upgrading pandas with pip install pandas --upgrade
Thanks, Did it now (to panda version: 2.0.2) Still (a different) error:
Traceback (most recent call last):
File "InStrain_1.75/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3652, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'version'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "InStrain_1.75/bin/inStrain", line 31, in <module>
inStrain.controller.Controller().main(args)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 54, in main
self.profile_operation(args)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 86, in profile_operation
ProfileController(args).main()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 149, in main
self.validate_arguments()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/controller.py", line 187, in validate_arguments
ISP = inStrain.SNVprofile.SNVprofile(outbase)
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/SNVprofile.py", line 44, in __init__
self._initialize_attributes()
File "InStrain_1.75/lib/python3.8/site-packages/inStrain/SNVprofile.py", line 595, in _initialize_attributes
if not same_versions(Adb.loc['version', 'value'], __version__):
File "InStrain_1.75/lib/python3.8/site-packages/pandas/core/indexing.py", line 1096, in __getitem__
return self.obj._get_value(*key, takeable=self._takeable)
File "InStrain_1.75/lib/python3.8/site-packages/pandas/core/frame.py", line 3877, in _get_value
row = self.index.get_loc(index)
File "InStrain_1.75/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3654, in get_loc
raise KeyError(key) from err
KeyError: 'version'
Hopefully, we make progress ;-)
Thanks for the support!
It seems like you're running the program on a previously-failed inStrain output directory. Delete all inStrain output and try again. If that doesn't work, lmk the command you're running
Thanks a lot!!! You were correct; sorry, my bad. Using an empty output directory solved the issue. Thanks!!
Hi,
Following installation using either pip or conda I get the following error:
My env is as follow:
Can you please suggest a solution?
Thanks! Haim