lorenzo-rovigatti / oxDNA

A new version of the code to simulate the oxDNA/oxRNA models, now equipped with Python bindings
https://dna.physics.ox.ac.uk/
GNU General Public License v3.0
43 stars 28 forks source link

[BUG] error on `make test_run` on WSL to install Python bindings #122

Closed dave-doty closed 1 month ago

dave-doty commented 2 months ago

Describe the bug When I follow the instructions to install the Python bindings for oxDNA (https://lorenzo-rovigatti.github.io/oxDNA/install.html), it seems to install correctly, but when I follow the next suggestion to run make test_run, I get this error:

(base) ddoty@g-quadruplex-24:~/download/oxDNA/build
$ make test_run
[ 92%] Built target oxdna_common
[ 94%] Built target DNAnalysis
[ 96%] Built target confGenerator
[ 98%] Built target oxDNA
[100%] Running build integration tests
/usr/bin/env: ‘python3\r’: No such file or directory
make[3]: *** [CMakeFiles/test_run.dir/build.make:71: CMakeFiles/test_run] Error 127
make[2]: *** [CMakeFiles/Makefile2:294: CMakeFiles/test_run.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/test_run.dir/rule] Error 2
make: *** [Makefile:169: test_run] Error 2

To Reproduce Follow the instructions here: https://lorenzo-rovigatti.github.io/oxDNA/install.html

  1. Clone the oxDNA repo.
  2. On Windows, start a WSL prompt in the local repo folder.
  3. mkdir build
  4. cd build
  5. cmake -DPython=ON -DPYTHON_EXECUTABLE=~/anaconda3/bin/python .. (I tried this when I noticed the error message references /usr/bin/, which has some other python executable that may have come with Ubuntu; I didn't specify -DPYTHON_INCLUDE_DIR because I have no idea what a "Python include directory" is.)
  6. make -j4
  7. make install
  8. make test_run

Expected behavior Tests pass.

Desktop (please complete the following information):

lorenzo-rovigatti commented 2 months ago

I suspect that the issue is due to the different way Linux and Windows handle line endings. Does the code work, regardless of the outcome of make test_run? Can you try running one of the examples? Unfortunately I don't have a working WSL to test the code on, but maybe @zoombya does?

dave-doty commented 2 months ago

Does the code work, regardless of the outcome of make test_run?

What code? I was trying to do make test_run to see if my installation worked. I'm not sure what code you are referring to.

lorenzo-rovigatti commented 2 months ago

The oxDNA binary.

dave-doty commented 2 months ago

It runs although I don't know what input to give it:

$ oxDNA
ERROR: Usage is 'oxDNA input_file'
lorenzo-rovigatti commented 2 months ago

Then the code compiles just fine. Thanks for opening the issue though, I'll try to find a solution for the make test bug on Windows (if I manage to get my hands on a Windows box).

lorenzo-rovigatti commented 1 month ago

I tried installing WSL from scratch and I cannot reproduce the issue. Is it possible that you cloned the repo outside of WSL? If you did so, can you try cloning it directly on WSL?

dave-doty commented 1 month ago

I tried installing WSL from scratch and I cannot reproduce the issue. Is it possible that you cloned the repo outside of WSL? If you did so, can you try cloning it directly on WSL?

I tried twice:

  1. Cloning in Windows using GitHub desktop, then copying that folder into my WSL home directory.
  2. Cloning from a WSL prompt, but within the Windows file system (/mnt/c/Dropbox/git/).

I just now tried a third option (but on a different computer than I was using last week):

  1. Cloning from a WSL prompt, within the "Linux-only" file system (/home/ddoty/git/).

Option 3 worked (in the sense that make test_run successfully ran the tests). However, I have not verified that options 1 and 2 failed on my current machine, only that they failed last week on my laptop while at the oxDNA workshop. Not sure if there is a subtle configuration difference between the machines. But since it appears to work if everything is done inside the WSL "Linux-only" filesystem, perhaps that should be part of the official installation instructions.

lorenzo-rovigatti commented 1 month ago

The problem is due to the different way line endings are handled in windows and linux. If you clone from windows, you'll end up with windows "line endings", and that will make linux's python complain. It makes sense to add it to the docs though, thanks for testing it!