Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sympy test suite fails on FileNotFoundError because path to temporary directory has symlinks #17593

Closed
robogast opened this issue Mar 22, 2023 · 2 comments · Fixed by #18428
Closed
Milestone

Comments

@robogast
Copy link
Contributor

I was getting many errors in sympy's test suite because of failed shutil cp calls, such as:

__ sympy/codegen/tests/test_algorithms.py:test_newtons_method_function__ccode __
Traceback (most recent call last):
  File "/gpfs/nvme1/1/robertsc/EasyBuild/ebbuildpath/sympy/1.11.1/foss-2022a/sympy-1.11.1/sympy/utilities/_compilation/compilation.py", line 516, in compile_link_import_py_ext
    mod = import_module_from_file(os.path.join(build_dir, extname), sources)
  File "/gpfs/nvme1/1/robertsc/EasyBuild/ebbuildpath/sympy/1.11.1/foss-2022a/sympy-1.11.1/sympy/utilities/_compilation/util.py", line 249, in import_module_from_file
    raise ImportError("Failed to import: '%s'" % filename)
ImportError: Failed to import: '/home/robertsc/eb-workdir/ebtmpdir/eb-omfzk4u0/tmpct97j9ge/_newton'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/robertsc/eb-workdir/easybuild/generic/software/Python/3.10.4-GCCcore-11.3.0/lib/python3.10/shutil.py", line 813, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/home/robertsc/eb-workdir/ebtmpdir/eb-omfzk4u0/tmpct97j9ge/_newton.c' -> './_newton.c'

Fixed by getting the abspath with readlink -f /home/robertsc/eb-workdir, which got me /gpfs/nvme1/1/robertsc/EasyBuild, and after setting eb's tmpdir to this abspath / ebtmpdir, the test suite passed.

@casparvl
Copy link
Contributor

I had the same problem in #17467

The old patch here would fix that by calling os.path.realpath() in some places in the code. I did not manage to recreate a patch for the version used in #17467 however

Maybe the easier solution from a maintenance perspective is just to have the EasyBlock do what @robogast did above: take the current EasyBuild tmpdir in an early stage, call a realpath on it, and overwrite the EasyBuild tmpdir with that realpath. I don't really see any downsides to that approach, but I might be missing something...?

@boegel
Copy link
Member

boegel commented Mar 29, 2023

@casparvl I think that approach makes sense. Are you up for opening a pull request for this?

@boegel boegel changed the title [Solved] sympy test suite fails on FileNotFoundError sympy test suite fails on FileNotFoundError because path to temporary directory has symlinks Mar 29, 2023
@boegel boegel modified the milestones: 4.8.0, release after 4.8.0 Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants