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

Error in pickling and loading mkm setup file in Python 3.10.13 #164

Open
Shahriar58Hossain opened this issue Mar 18, 2024 · 0 comments
Open

Comments

@Shahriar58Hossain
Copy link

I am trying to follow the 'Refining a Microkinetic Model' tutorial for CatMAP, but am getting the following error when I try to run the model -

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File ~\anaconda3\envs\CatMap\lib\site-packages\catmap\model.py:447, in ReactionModel.load_data_file(self, overwrite)
    446 try:
--> 447     pickled_data = catmap.pickle.load(open(self.data_file, 'r'))
    448 except:

TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Cell In[7], line 6
      3 from catmap import ReactionModel
      5 mkm_file = 'CO_oxidation.mkm'
----> 6 model = ReactionModel(setup_file=mkm_file)
      7 model.output_variables += ['production_rate']
      8 model.run()

File ~\anaconda3\envs\CatMap\lib\site-packages\catmap\model.py:124, in ReactionModel.__init__(self, **kwargs)
    120 if hasattr(self,'setup_file'): #parse in setup file.
    121     #Note that the syntax is simply python variable definitions.
    122     #This is NOT idiot proof.
    123     self.model_name = self.setup_file.rsplit('.',1)[0]
--> 124     self.load(self.setup_file)

File ~\anaconda3\envs\CatMap\lib\site-packages\catmap\model.py:431, in ReactionModel.load(self, setup_file)
    428             self.parse_headers += ['coverage']
    429         self.parse() #Automatically parse in data.
--> 431 self.load_data_file()
    433 self.set_rxn_options()
    435 self.generate_echem_TS()

File ~\anaconda3\envs\CatMap\lib\site-packages\catmap\model.py:449, in ReactionModel.load_data_file(self, overwrite)
    447     pickled_data = catmap.pickle.load(open(self.data_file, 'r'))
    448 except:
--> 449     pickled_data = catmap.pickle.load(open(self.data_file, 'rb'))
    450 for attr in pickled_data:
    451     if not overwrite:

File ~\anaconda3\envs\CatMap\lib\site-packages\mpmath\ctx_mp_python.py:134, in _mpf.__setstate__(self, val)
--> 134 def __setstate__(self, val): self._mpf_ = from_pickable(val)

File ~\anaconda3\envs\CatMap\lib\site-packages\mpmath\libmp\libmpf.py:41, in from_pickable(x)
     39 def from_pickable(x):
     40     sign, man, exp, bc = x
---> 41     return (sign, MPZ(man, 16), exp, bc)

ValueError: invalid literal for int() with base 16: 'b4dc72365d1651c8f1dfc42e0203944f430bfb4d74ec2f55c2da2a8ba0f8b21b7d0ddbb05405a538c0668d76ccff04b4a8fc13b3L'

I'm also attaching the list of packages in conda environment.

catmap.txt

What is the potential issue here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant