materialsinnovation / pymks

Materials Knowledge System in Python
https://pymks.readthedocs.io/
Other
115 stars 77 forks source link

Some of the functions from the "pymks" module do not work. #582

Open cheongw opened 2 years ago

cheongw commented 2 years ago

Hi,

When the script is run with the functions "PrimitiveBasis( )", "MKSHomogenizationModel( )", and etc., it keeps giving me the error messages as the following:

Warning (from warnings module): File "C:..., line 4 prim_basis=PrimitiveBasis(n_states=2, domain=[0,1]) DeprecationWarning: Call to deprecated method wrapper. (Use pymks.fmks instead.) -- Deprecated since version 0.4.

Where do I find the user documentation for pymks.fmks? or Which modules should I import to use the functions such as PrimitiveBasis( )", "MKSHomogenizationModel( )", and etc.?

Thank you in advance, Woo-Jae

wd15 commented 2 years ago

Hi @cheongw: PrimitiveBasis and MKSHomegnizationModel and going to be deprecated in future versions of PyMKS. They are basically no longer supported. The PrimitiveTransformer replaces the functionality of the PrimitiveBasis class. The functionality for the MKSHomegizationModel has now been replaced with a Scikit-learn pipeline with the functionality exposed to the user, see this example.

Of course, older versions of PyMKS are available, but reconstructing the environment would be tough. We're no longer testing the deprecated functions and classes in the CI so those most likely won't work at all now with the latest versions of the Scipy stack.

I hope that helps example what's going on. Please do follow up if you need more help.

cheongw commented 2 years ago

Hi Dr. Wheeler, Thank you for your explanations. I have been trying the examples in one of your paper, "Materials Knowledge Systems in Python...", which (I think) explains very difficult concepts in an easy-to-understand manner.
I will try those examples in your hyperlink.
Thank you again for your kind responses. Best regards, Woo-Jae

cheongw commented 2 years ago

Hi Dr. Wheeler, While following the example in the hyperlink in Conda environment, a strange error seems to appear:

"ImportError: cannot import name 'extension_to_fileype' from 'meshio._helpers'.

The error occurs when the defined "generate_data" function is executed at the line: "x_train, y_train = generate_data(300, 50)"

Would it require another module to run the examples?

Also, I tried the same example in the Google CoLab, and it did not seem to work since "sfepy" could not be installed in the Google CoLab environment for some reason.

wd15 commented 1 year ago

Hi @cheongw: could you perhaps post a working code snippet (with library imports)? I'm not sure why you're getting this error. Remember that Sfepy isn't necessary to use PyMKS, but only to generate some data for the examples.

cheongw commented 1 year ago

Hi Dr. Wheeler, I just tried your python code examples. The following is the snap-shot of the code: image

The error starts to appear in the last three lines from the bottom. The results of the execution of the code are as follows: image image

I was not sure why the training and the prediction steps did not work. Thank you in advance. Best regards, Woo-Jae

wd15 commented 1 year ago

Could you post the version of PyMKS that you're using and the version of Sfepy?

wd15 commented 1 year ago

Your problem is probably related to this. I would recommend reverting Sfepy to version 2022.1 for now.

cheongw commented 1 year ago

Here are some of the version numbers. (1) Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) (2) pymks==0.4.1 (3) sfepy==2022.3

I thought that I can only update the module with pip command.
Would you kindly inform me how to revert it from "sfepy 2022.3" to "sfepy 2022.1"? Thank you in advance.

wd15 commented 1 year ago

You could try pip install sfepy==2022.1 or if you're using conda conda install sfepy=2022.1 or similar. You may need to use the --force-reinstall with pip, but (I think) conda automatically does a reinstall. With conda though it's probably just best to fire up a new environment (likewise if you're using virtualenv with pip).

Note that PyMKS has a shell.nix so you can use Nix to run your environment if you want to give that a go. It's quite different from Conda and Pip, but I really like it for Python environments. It has a steep learning curve, but keeps things locked down much better.

cheongw commented 1 year ago

Based on the below error messages, sfepy==2022.1 does not seemed to be available in the resource location.

image

I may need to wait for the bug fix. Thank you in advance.

wd15 commented 1 year ago

Based on the below error messages, sfepy==2022.1 does not seemed to be available in the resource location.

It looks like pip doesn't have older versions. You would have to clone the sfepy repository or get the tarball from here and install it from there. Also, this might work

$ pip install https://github.com/sfepy/sfepy/archive/refs/tags/release_2022.1.tar.gz
cheongw commented 1 year ago

I was able to install the 2022.1 version of the sfepy module with the help of your command line. sfepy_version

However, the problem still persists. I obtain a similar error message as below: Error_msg_2023-01-04

Thank you in advance.

wd15 commented 1 year ago

Double check that you have actually installed the correct version.

$ python -c "import sfepy; print(sfepy.__version__)"
cheongw commented 1 year ago

I believe that it is the correct version. Please, refer to the below snapshot:

image

Thank you in advance.

wd15 commented 1 year ago

Sorry for the slow response. Try with version 2020.4 of Sfepy. I have a working environment with 2020.4 of Sfepy and PyMKS version 0.4.1.