Hello everyone,
I’m having a similar problem running this example when I try to plot the image.
plot.to_ipython_image()
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[9], line 3
1 plot = openmc.Plot.from_geometry(geometry)
2 plot.pixels = (250, 250)
----> 3 plot.to_ipython_image()
File ~/anaconda3/envs/openmc-env/lib/python3.11/site-packages/openmc/plots.py:800, in Plot.to_ipython_image(self, openmc_exec, cwd)
797 Plots([self]).export_to_xml(cwd)
799 # Run OpenMC in geometry plotting mode
--> 800 openmc.plot_geometry(False, openmc_exec, cwd)
802 # Return produced image
803 return _get_plot_image(self, cwd)
File ~/anaconda3/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py:139, in plot_geometry(output, openmc_exec, cwd)
121 def plot_geometry(output=True, openmc_exec='openmc', cwd='.'):
122 """Run OpenMC in plotting mode
123
124 Parameters
(...)
137
138 """
--> 139 _run([openmc_exec, '-p'], output, cwd)
File ~/anaconda3/envs/openmc-env/lib/python3.11/site-packages/openmc/executor.py:90, in _run(args, output, cwd)
88 def _run(args, output, cwd):
89 # Launch a subprocess
---> 90 p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
91 stderr=subprocess.STDOUT, universal_newlines=True)
93 # Capture and re-print OpenMC output in real-time
94 lines = []
File ~/anaconda3/envs/openmc-env/lib/python3.11/subprocess.py:1022, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
1018 if self.text_mode:
1019 self.stderr = io.TextIOWrapper(self.stderr,
1020 encoding=encoding, errors=errors)
-> 1022 self._execute_child(args, executable, preexec_fn, close_fds,
1023 pass_fds, cwd, env,
1024 startupinfo, creationflags, shell,
1025 p2cread, p2cwrite,
1026 c2pread, c2pwrite,
1027 errread, errwrite,
1028 restore_signals,
1029 gid, gids, uid, umask,
1030 start_new_session, process_group)
1031 except:
1032 # Cleanup if the child failed starting.
1033 for f in filter(None, (self.stdin, self.stdout, self.stderr)):
File ~/anaconda3/envs/openmc-env/lib/python3.11/subprocess.py:1899, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group)
1897 if errno_num != 0:
1898 err_msg = os.strerror(errno_num)
-> 1899 raise child_exception_type(errno_num, err_msg, err_filename)
1900 raise child_exception_type(err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'openmc'
I reviewed the path variable, but it seems to be okay.
import sys
sys.path
['/home/maxi/OpenMC/Excercises',
'/home/maxi/anaconda3/envs/openmc-env/lib/python311.zip',
'/home/maxi/anaconda3/envs/openmc-env/lib/python3.11',
'/home/maxi/anaconda3/envs/openmc-env/lib/python3.11/lib-dynload',
'',
'/home/maxi/anaconda3/envs/openmc-env/lib/python3.11/site-packages']
This is the location of the OpenMC module:
/home/maxi/anaconda3/envs/openmc-env/lib/python3.11/site-packages/openmc/__init__.py
I’m running jupyter notebook from the Terminal, and then changing to the openmc-env environment inside the notebook, so I don’t believe this is the problem. Could you help me? Thanks!