ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
288 stars 184 forks source link

issues with installing warpx on Windows #4645

Open Aleeeeeen opened 7 months ago

Aleeeeeen commented 7 months ago

Dear Warpx: I tried using Conda to install Warpx from a Windows system. I followed the instructions and successfully installed it, but when I tried to run it directly using Python, I encountered some errors. The error code was from pywarpx import picmi but I do have the warpx package. The error message is OSError: [WinError 87] May I know where I went wrong?

Aleeeeeen commented 7 months ago

All error messages are:

 File "D:\Warpx\WarpX-development\WarpX-development\Examples\Physics_applications\plasma_acceleration\PICMI_inputs_plasma_acceleration.py", line 3, in <module>
    from pywarpx import picmi
  File "E:\Conda\envs\warpx\Lib\site-packages\pywarpx\__init__.py", line 23, in <module>
    os.add_dll_directory(p)
  File "<frozen os>", line 1125, in add_dll_directory
OSError: [WinError 87]
Aleeeeeen commented 7 months ago

I tried to downgrade my Python, and now there won't be the previous error, but another error has occurred

(warpx) D:\Warpx\WarpX-development\WarpX-development\Examples\Physics_applications\plasma_acceleration>python PICMI_inputs_plasma_acceleration_1d.py
Failed to load the libwarpx shared object library
Traceback (most recent call last):
  File "PICMI_inputs_plasma_acceleration_1d.py", line 74, in <module>
    sim.step()
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\picmi.py", line 1851, in step
    self.initialize_warpx(mpi_comm)
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\picmi.py", line 1843, in initialize_warpx
    pywarpx.warpx.init(mpi_comm, max_step=self.max_steps, stop_time=self.max_time)
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\WarpX.py", line 95, in init
    libwarpx.initialize(argv, mpi_comm=mpi_comm)
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 451, in initialize
    self.amrex_init(argv, mpi_comm)
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 437, in amrex_init
    self.libwarpx_so.amrex_init(argc, argvC)
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 61, in __getattr__
    self.load_library()
  File "E:\Conda\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 111, in load_library
    self.libwarpx_so = ctypes.CDLL(os.path.join(self._get_package_root(), libname))
  File "E:\Conda\envs\warpx\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'E:\Conda\envs\warpx\lib\site-packages\pywarpx\libwarpx.1d.dll'. Try using the full path with constructor syntax.
ax3l commented 7 months ago

Hi @Aleeeeeen,

Which WarpX and Python versions are you referring to in both cases?

What is your toolchain? Do you install the pre-compiled packages from conda https://warpx.readthedocs.io/en/latest/install/users.html#using-the-conda-package

or compile on your own?

For the latter case, which compiler & version do you use, which CMake commands do you use and what is the detailed output of all install steps?

What is in your PATH environment variable?

Aleeeeeen commented 7 months ago

Hello @ax3l,

Which WarpX and Python versions are you referring to in both cases?_

I only downgraded Python

What is your toolchain? Do you install the pre-compiled packages from conda https://warpx.readthedocs.io/en/latest/install/users.html#using-the-conda-package or compile on your own?

I install the pre-compiled packages from conda https://warpx.readthedocs.io/en/latest/install/users.html#using-the-conda-package

For the latter case, which compiler & version do you use, which CMake commands do you use and what is the detailed output of all install steps?

I use anaconda's built-in terminal prompt for compilation operations. Do I need a compiler like vscode or vs?

What is in your environment variable?

This is all of my environment variables:

E:\Tools\Tecplot\Tecplot Chorus 2017 R3\bin;
E:\Tools\Tecplot\Tecplot 360 EX 2017 R3\bin;
C:\Program Files\Microsoft MPI\Bin\;
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
%SYSTEMROOT%\System32\OpenSSH\;
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;
E:\Tools\LabView\LVinstall\Shared\LabVIEW CLI;
C:\Program Files\CMake\bin;
C:\Program Files\Git\cmd;
E:\Windows Kits\10\Windows Performance Toolkit\;
E:\Conda
;E:\Conda\Scripts;
E:\Conda\Library\bin;

Thank you for your help!

Aleeeeeen commented 7 months ago

Thank you for your previous reply. After trying to add gcc to the environment variable, I was able to successfully run some of the sample files, but there may still be errors in other files

There were the following errors while running file Examples/Physics_applications/laser_acceleration/PICMI_inputs_3d.py:

Traceback (most recent call last):
  File "PICMI_inputs_3d.py", line 113, in <module>
    particle_diag = picmi.ParticleDiagnostic(
TypeError: __init__() missing 1 required positional argument: 'species'

I found the code at the corresponding location, but there was indeed no 'species'. After I added the corresponding substance, it worked normally. Is this a bug in the example program?

ax3l commented 7 months ago

Thanks for the update, great progress! :tada:

Hm, curious. How does your particle_diag = picmi.ParticleDiagnostic( ... ) section in your input file looks like now?

I wonder if your PICMI version is outdated... What does

python3 -c "import picmistandard; print(picmistandard.__version__)"

say for you?

Aleeeeeen commented 6 months ago

Hello @ax3l , my warpx is currently running normally, but there are still some minor issues during operation:

  1. In the previous question, I attempted to run your sample file _laser_acceleration\PICMI_inputs3d.py

2.When I try to run the command python3 -c "import picmistandard; print(picmistandard.version)",it says

(warpx) C:\Users\Dava>python -c "import picmistandard; print(picmistandard.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'picmistandard' has no attribute '__version__'

I don't know how to use picmistandard on my device. By the way, I only configured Python 3 in my runtime environment, so I used "python" instead of "python3". Will this have any impact?

  1. I want to try using Warpx to calculate non-equilibrium plasma. When I tried to run an example of capacitive discharge, I encountered the following problem:
STEP 69 starts ...
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 232, in 'calling callback function'
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\callbacks.py", line 91, in __call__
    tt = self.callfuncsinlist(*args,**kw)
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\callbacks.py", line 242, in callfuncsinlist
    f(*args,**kw)
  File "PICMI_inputs_2d.py", line 166, in _run_solve
    self.rho_wrapper = fields.RhoFPWrapper(0, True)
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\fields.py", line 663, in RhoFPWrapper
    level=level, include_ghosts=include_ghosts)
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\fields.py", line 51, in __init__
    self.overlaps = self.get_nodal_flag()
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 2692, in get_Rho_nodal_flag
    return self._get_nodal_flag(self.libwarpx_so.warpx_getRho_nodal_flag)
  File "C:\ProgramData\anaconda3\envs\warpx\lib\site-packages\pywarpx\_libwarpx.py", line 2631, in _get_nodal_flag
    _libc.free(data)
OSError: exception: access violation reading 0x0000000000000014

This warning is present in every step and may sometimes jump out midway (feeling like the program is killed), with the last line display:

STEP 70 ends. TIME = 1.290560472e-08 DT = 1.843657817e-10
Evolve time = 28.0628182 s; This step = 0.5378916 s; Avg. per step = 0.4008974029 s

STEP 71 starts ...

Snipaste_2024-02-06_18-07-51 Snipaste_2024-02-06_18-07-37

Thank you for your help!!