valboz / RTModel

Microlensing modeling: fast and efficient exploration of the parameter space
GNU Lesser General Public License v3.0
10 stars 4 forks source link

wrong file name #4

Closed rpoleski closed 6 months ago

rpoleski commented 6 months ago

I've installed RTModel on linux. When I run it, it fails in RTModel.py line 76 with message:

FileNotFoundError: [Errno 2] No such file or directory: '/.../.local/lib/python3.8/site-packages/RTModel/bin/Reader'

In that directory there is Reader.exe, not Reader. I guess other linux users will have similar issue. @golmschenk, @valboz, can you help?

valboz commented 6 months ago

Hi Radek, have you tried the GitHub installation or the PyPI? The GitHub should be more robust against different operating systems. Which Linux setup are you using?

rpoleski commented 6 months ago

I've tried PyPI on a machine with Rocky Linux 8.7.

I've tried github as well, but that one fails on installation in line 369 of LevMarFit.cpp:

    if (incond >= ninit) nps=nps/0;
valboz commented 6 months ago

Hi Radek, can you please try to install from GitHub now? I have tried a fix.

rpoleski commented 6 months ago

Still fails. I'm skipping the top part of the output, where is says which requirements are satisfied:

Building wheels for collected packages: RTModel
  Building wheel for RTModel (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Building wheel for RTModel (pyproject.toml) did not run successfully.
  exit code: 1

  [55 lines of output]
  *** scikit-build-core 0.8.1 using CMake 3.29.2 (wheel)
  *** Configuring CMake...
  loading initial cache file /tmp/tmp2frm3qk_/build/CMakeInit.txt
  -- The CXX compiler identification is GNU 8.5.0
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done (0.4s)
  -- Generating done (0.0s)
  -- Build files have been written to: /tmp/tmp2frm3qk_/build
  *** Building project with Ninja...
  [1/15] Building CXX object CMakeFiles/Finalizer.dir/RTModel/lib/bumper.cpp.o
  [2/15] Building CXX object CMakeFiles/LevMar.dir/RTModel/lib/bumper.cpp.o
  [3/15] Building CXX object CMakeFiles/ModelSelector.dir/RTModel/lib/bumper.cpp.o
  [4/15] Building CXX object CMakeFiles/LevMar.dir/RTModel/lib/LevMar.cpp.o
  [5/15] Building CXX object CMakeFiles/LevMar.dir/RTModel/lib/VBBinaryLensingLibrary.cpp.o
  [6/15] Building CXX object CMakeFiles/Reader.dir/RTModel/lib/Reader.cpp.o
  [7/15] Linking CXX executable Reader
  FAILED: Reader
  : && /usr/bin/c++ -O3 -DNDEBUG  CMakeFiles/Reader.dir/RTModel/lib/Reader.cpp.o -o Reader   && cd /tmp/tmp2frm3qk_/build && /tmp/pip-build-env-6aaxv5ds/normal/lib64/python3.8/site-packages/cmake/data/bin/cmake -E copy_directory /home/data2/crunch06/rpoleski/RTModel/RTModel/data /tmp/tmp2frm3qk_/wheel/platlib/RTModel/data
  CMakeFiles/Reader.dir/RTModel/lib/Reader.cpp.o: In function `std::filesystem::__cxx11::path::path<char [4], std::filesystem::__cxx11::path>(char const (&) [4], std::filesystem::__cxx11::path::format) [clone .constprop.566]':
  Reader.cpp:(.text+0x7c8): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
  CMakeFiles/Reader.dir/RTModel/lib/Reader.cpp.o: In function `std::filesystem::__cxx11::path::path<char [512], std::filesystem::__cxx11::path>(char const (&) [512], std::filesystem::__cxx11::path::format) [clone .constprop.591]':
  Reader.cpp:(.text+0x808): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
  CMakeFiles/Reader.dir/RTModel/lib/Reader.cpp.o: In function `main':
  Reader.cpp:(.text.startup+0xd1): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0x11d): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
  Reader.cpp:(.text.startup+0x12a): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0x182): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0x25d): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
  Reader.cpp:(.text.startup+0x26a): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0x3ba): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
  Reader.cpp:(.text.startup+0x3d3): undefined reference to `std::filesystem::__cxx11::directory_iterator::directory_iterator(std::filesystem::__cxx11::path const&, std::filesystem::directory_options, std::error_code*)'
  Reader.cpp:(.text.startup+0x455): undefined reference to `std::filesystem::__cxx11::directory_iterator::operator*() const'
  Reader.cpp:(.text.startup+0x5a4): undefined reference to `std::filesystem::__cxx11::directory_iterator::operator++()'
  Reader.cpp:(.text.startup+0x5d8): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0xfd9): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
  Reader.cpp:(.text.startup+0x177d): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
  collect2: error: ld returned 1 exit status
  [8/15] Building CXX object CMakeFiles/Finalizer.dir/RTModel/lib/Finalizer.cpp.o
  [9/15] Building CXX object CMakeFiles/LevMar.dir/RTModel/lib/LevMarFit.cpp.o
  /home/data2/crunch06/rpoleski/RTModel/RTModel/lib/LevMarFit.cpp: In member function 'void LevMar::ReadFiles(int, char**)':
  /home/data2/crunch06/rpoleski/RTModel/RTModel/lib/LevMarFit.cpp:231:34: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
      VBBL->LoadESPLTable("ESPL.tbl");
                                    ^
  /home/data2/crunch06/rpoleski/RTModel/RTModel/lib/LevMarFit.cpp:264:34: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
      VBBL->LoadESPLTable("ESPL.tbl");
                                    ^
  [10/15] Building CXX object CMakeFiles/ModelSelector.dir/RTModel/lib/ModelSelector.cpp.o
  [11/15] Building CXX object CMakeFiles/InitCond.dir/RTModel/lib/InitCond.cpp.o
  ninja: build stopped: subcommand failed.

  *** CMake build failed
  [end of output]
valboz commented 6 months ago

This looks like a linking issue. I leave it to @golmschenk .

golmschenk commented 6 months ago

Sorry for the delay. The issue is that GCC 8 is a bit old and does not link to the part of the C++ standard library for the filesystem by default (GCC 9 or greater does), and RTModel expects this part of the standard library to be available.

@rpoleski, a quick workaround (which I don't have an immediate way to test on my end) would be to tell the build process to link this library during the build. I think this could be done by adding some linking flags to the build. So the updated pip command that installs from the git repository, but also attempts to link the library would be pip install git+https://github.com/valboz/RTModel --config-settings=cmake.args=-DCMAKE_EXE_LINKER_FLAGS=-lstdc++fs. However, assuming that part works, there still may be other libraries that are not linked by default in GCC 8 that might cause more issues). But this, is the quick easy thing to try.

Probably the better approach would be to use an updated version of GCC. My recommended way to do this would be to use a Conda environment, where you can install an updated compiler, but, since it will be in a separate environment, it won't mess with your global system compilers. To do this, you'll first need a version of Conda installed (most people already have this nowadays, but if you don't, miniforge is a good option: https://github.com/conda-forge/miniforge?tab=readme-ov-file#download). Once installed, you create a new environment (e.g., conda create -n rtmodel_env python=3.11). Activate the environment (conda activate rtmodel_env). Install the compilers (conda install -c conda-forge cxx-compiler and conda install -c conda-forge c-compiler). Then you can install RTModel (pip install git+https://github.com/valboz/RTModel). There are many other approaches to updating the compilers as well, but approach has a minimal impact on other projects you have.

@valboz, as for a real fix, there are a couple options. One is simply to disallow users from using older versions of GCC. It's worth noting that the GNU team is no longer continuing to support GCC 8. The other is to have CMake automatically detect the filesystem library when needed, though this will clutter the CMakeLists.txt build script a bit more. Let me know what you think is preferable.

valboz commented 6 months ago

Thanks @golmschenk . Indeed the STL is quite essential in RTModel and I believe it is going to become essential for future codes in general. So I think it makes no point in supporting old versions of gcc that do not link it. @rpoleski do you have any particular reason for not updating your gcc?

rpoleski commented 6 months ago

Instalation works for me now. Thanks.

@rpoleski do you have any particular reason for not updating your gcc?

I haven't written that I don't want to update gcc.