How to use python to run openmc code?

Hello everyone,

I’m trying to run the openmc examples that is displayed in jupyter notebook but I don’t understand where to type the code? I have openmc on docker and I’m using windows and I have python installed. Should I create a text and use the openmc.run() line in python? but how would I specify a certain text? I understand I should use python API but I don’t understand how or where to get it?

Thank you so much for your help.

Dear Dalia, if you want to run the jupyter notebook example, it would be easier to do by installing anaconda or mamba. You can also copy the codes in jupyter notebook example from each boxes and paste it sequentially as in the notebook in a python text file try run it. I never done the latter so let us see how things going.

I tried both methods and I got the same error as that no module named "openmc’ though I’m leaving the openmc container running on docker, how can I fix this? Thank you so much for your help.

and this, too:
image

I am using Linux, so I am not sure how you install it in windows. What I did was that I installed mamba first, and then created a virtual environment, e.g.:

mamba create -n <environment_name>

activate the virtual environment:

mamba activate <environment_name>

and install openmc and the necessary package like pandas and matplotlib as well as jupyter in the virtual environment.

You may want to see how this can be applied in windows

Got it thank you really so much for your help!