WarpX icon indicating copy to clipboard operation
WarpX copied to clipboard

Issue with 3D dimensionality despite specifying -DWarpX_DIMS=3 flag

Open DrakeWhu opened this issue 2 years ago • 4 comments
trafficstars

Hello WarpX team,

After successfully compiling WarpX on my VM with Arch Linux, I've encountered an issue when trying to run a 3D PICMI script, specifically the LWFA one. Despite specifying the -DWarpX_DIMS=3 flag during the CMake configuration, I receive an error message indicating that the 3D dimensionality hasn't been compiled.

To provide more context, I've attached the logs from both the cmake and make processes:

cmake_log.txt make_log.txt

I followed the standard installation steps and ensured that the necessary flags were set during the configuration. I'm unsure why the 3D dimensionality isn't recognized.

Any guidance or suggestions on how to resolve this would be greatly appreciated.

Thank you for your continued support.

Best regards,

Juan

DrakeWhu avatar Sep 19 '23 16:09 DrakeWhu

Hi @DrakeWhu,

thank you for the question.

In #4308, I see you compiled with

cmake .. -DWarpX_PYTHON=ON -DWarpX_DIMS=3
make -j$(nproc)

This does not yet install the Python module via pip.

Can you please try like this?

# cd to the WarpX source directory
rm -rf build_py

cmake -S . -B build_py -DWarpX_PYTHON=ON -DWarpX_DIMS=3 -DWarpX_APP=OFF
cmake --build build_py -j 4 --target pip_install

as documented here?

ax3l avatar Sep 25 '23 23:09 ax3l

Hi @ax3l,

Followed your commands, but the compilation still didn't go through. Here's the log for your review: build_output.log

I'll give it another shot tomorrow morning; it's quite late here in Spain. Also planning to delve into the dev documentation you recommended. I've mostly been on the user side of things, but it might be useful for future projects.

Thanks for the help.

Best, Juan

DrakeWhu avatar Sep 26 '23 02:09 DrakeWhu

Hi @DrakeWhu , I think the error message in this log on your Arch Linux is:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

I would follow this step: create a virtual environment, activate it, and install WarpX into it?

Does that work?

ax3l avatar Oct 02 '23 23:10 ax3l

Hi @ax3l , sorry for the delay answering this.

What did the trick was using the developer instructions for the installation. In more detail, what I did is:

  1. Create a python virtual enviroment
  2. Download WarpX from source
  3. Activate the enviroment
  4. Compile and install all the dependencies using the pip installation of the given enviroment (instead of python3 -m pip I just use pip as the venv is already active)
  5. Then, compile WarpX binaries with the desired flags

Another thing I did is that we use enviroment modules in our cluster, so after the compilation and installation has been done, I just copy and paste the binaries to my apps folder and create the module. This makes it super clean to keep various versions of the code, even same version compiled with different flags! Really recommend it.

Also I believe using a virtual enviroment is key. If the compilation gets corrupted for some reason, I just delete the enviroment and then compile and install the dependencies again.

Maybe we could add some info about working with a python virtual enviroment? Because right now the developer part tells you to install directly into the base Python installation and I know for a fact that this can be troublesome because it can mess with the dependencies of other libraries.

Thanks for the help, Juan

DrakeWhu avatar Jun 11 '24 12:06 DrakeWhu