You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a bug when trying to copy a model in python v3.13.0. - cobra v0.29. The error message hints at problems copying the GPR. This issue does not happen in python v3.12.7 - cobra v0.29
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 text_book_model.copy()
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/site-packages/cobra/core/model.py:426], in Model.copy(self)
424 for attr, value in reaction.__dict__.items():
425 if attr not in do_not_copy_by_ref:
--> 426 new_reaction.__dict__[attr] = copy(value)
427 new_reaction._model = new
428 new.reactions.append(new_reaction)
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/copy.py:80], in copy(x)
78 copier = getattr(cls, "__copy__", None)
79 if copier is not None:
---> 80 return copier(x)
82 reductor = dispatch_table.get(cls)
83 if reductor is not None:
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/site-packages/cobra/core/gene.py:554], in GPR.__copy__(self)
552 def __copy__(self) -> "GPR":
553 """Ensure a correct shallow copy."""
--> 554 return self.copy()
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/site-packages/cobra/core/gene.py:550], in GPR.copy(self)
548 def copy(self):
549 """Copy a GPR."""
--> 550 return deepcopy(self)
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/copy.py:163], in deepcopy(x, memo, _nil)
161 y = x
162 else:
--> 163 y = _reconstruct(x, memo, *rv)
165 # If is its own copy, don't memoize.
166 if y is not x:
File [~/.conda/envs/cf_prediction/1.1/lib/python3.13/copy.py:254], in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
252 if deep and args:
253 args = (deepcopy(arg, memo) for arg in args)
--> 254 y = func(*args)
255 if deep:
256 memo[id(x)] = y
TypeError: GPR.__init__() takes from 1 to 2 positional arguments but 3 were given
Environment
### Package Information
Package
Version
cobra
0.29.0
Dependency Information
Package
Version
appdirs
1.4.4
black
missing
bumpversion
missing
depinfo
2.2.0
diskcache
5.6.3
future
1.0.0
httpx
0.27.2
importlib-resources
6.4.5
isort
missing
numpy
2.1.3
optlang
1.8.2
pandas
2.2.3
pydantic
2.9.2
python-libsbml
5.20.4
rich
13.9.4
ruamel.yaml
0.18.6
scipy
missing
swiglpk
5.0.10
tox
missing
Build Tools Information
Package
Version
pip
24.3.1
setuptools
75.5.0
Platform Information
Linux
6.1.0-26-amd64-x86_64
CPython
3.13.0
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Problem description
There seems to be a bug when trying to copy a model in python v3.13.0. - cobra v0.29. The error message hints at problems copying the GPR. This issue does not happen in python v3.12.7 - cobra v0.29
Code sample
Code run:
Traceback:
Environment
Dependency Information
Build Tools Information
Platform Information
Anything else?
No response
The text was updated successfully, but these errors were encountered: