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

Clean up handling of path-related environment variables #1578

Merged
merged 33 commits into from
Jul 1, 2020

Conversation

jougs
Copy link
Contributor

@jougs jougs commented May 4, 2020

This fixes #1586 and fixes #1331 by

  • removing all code handling the environment variables NEST_DOC_DIR and NEST_DATA_DIR from SLIStartup
  • removing the setting of NEST_DOC_DIR, NEST_DATA_DIR and NEST_INSTALL_DIR from nest_vars.sh and
  • replacing all code involving NEST_DOC_DIR, NEST_DATA_DIR and NEST_INSTALL_DIR in PyNEST and do_tests.py by code achieving the same based on entries in the kernel status dictionary
  • adding the NEST library install directory to the dynamic loader's searchpath as suggested by @clinssen in Instructions for custom modules are incomplete/outdated(?) #1331.

Along the way, I've

  • fixed pertaining documentation
  • removed the old ReadData example for SLI and
  • renamed slihomepath to slilibdir in SLIStartup.

See the discussion in #1586 for more details.

@jougs jougs added T: Bug Wrong statements in the code or documentation S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels May 4, 2020
@jougs jougs added this to the NEST 3.0 milestone May 4, 2020
@jougs jougs requested review from terhorstd and clinssen May 4, 2020 20:50
@jougs jougs self-assigned this May 4, 2020
extras/nest_vars.sh.in Outdated Show resolved Hide resolved
extras/nest_vars.sh.in Outdated Show resolved Hide resolved
extras/nest_vars.sh.in Outdated Show resolved Hide resolved
extras/nest_vars.sh.in Outdated Show resolved Hide resolved
@jougs jougs requested review from clinssen and removed request for terhorstd May 5, 2020 14:53
@clinssen
Copy link
Contributor

clinssen commented May 5, 2020

This PR removes NEST_INSTALL_DIR from the exported variables, but it is still used in

if 'NEST_INSTALL_DIR' not in os.environ:

The same goes for some of the other variables that would disappear. What to do with this code—should it be systematically removed?

@jougs
Copy link
Contributor Author

jougs commented May 5, 2020

Good catch!

Can you please also point me to the other places in the code for the other variables? I'll check what can be do about this.

@clinssen
Copy link
Contributor

clinssen commented May 5, 2020

Sure! More systematically:

Variables to be removed:

  • NEST_DOC_DIR
  • NEST_INSTALL_DIR
  • NEST_DATA_DIR
  • NEST_PYTHON_PREFIX

Files affected:

  • sli/slistartup.cc
  • pynest/nest/lib/hl_api_info.py
  • pynest/nest/lib/hl_api_helper.py
  • testsuite/do_tests.sh.in
  • examples/nest/ReadData_demo.sli

Copy link
Contributor Author

@jougs jougs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clinssen: I've investigated some more. Please find my assessment for usage of the different variables as inline comments below. Please let me know what you think!

extras/nest_vars.sh.in Show resolved Hide resolved
extras/nest_vars.sh.in Show resolved Hide resolved
extras/nest_vars.sh.in Show resolved Hide resolved
@jougs jougs marked this pull request as draft May 7, 2020 16:53
@jougs jougs changed the title Don't export variables that can confuse NEST Clean up handling of path-related environment variables May 7, 2020
jougs added 4 commits May 8, 2020 02:36
This commit removes the possibility to set NEST_DOC_DIR as
this did more harm than good. All uses of the variable have
been replaced by appropriate queries to the NEST kernel. It
also removes the ancient data reading example for SLI, which
used the variable to find an example file.
This commit removes the possibility to set NEST_DATA_DIR as this did
more harm than good. All uses of the variable have also been removed.
It also renames slihomepath to a more appropriate slilibdir.
@jougs
Copy link
Contributor Author

jougs commented Jun 17, 2020

@heplesser: apparently I have overlooked that #1587 also removed the possibility to run our custom PyNEST test harness (which I think is a good thing!). I have thus removed do_tests.py and all references to it in 62c1f17 contained in this PR and hope that this is fine with you, although that change does not strictly belong here.

If you prefer the perfectly clean solution, I can cherry-pick that commit to another branch, remove it from this one and file an additional PR.

@jougs jougs force-pushed the unpollute_environment branch from 62c1f17 to 157426d Compare June 17, 2020 23:31
@jougs
Copy link
Contributor Author

jougs commented Jun 17, 2020

On second thought, I came to the conclusion that it's probably really better to create another PR to clean up the PyNEST testsuite. I have thus removed 62c1f17 from the history of this branch. As if it never happened. Sorry for the noise!

@heplesser
Copy link
Contributor

@jougs I am confused. As long as this PR now will not re-introduce things that #1587 cleaned up, I am all for it.

@jougs jougs force-pushed the unpollute_environment branch from 8fa9d33 to 157426d Compare June 18, 2020 23:41
@jougs
Copy link
Contributor Author

jougs commented Jun 19, 2020

@heplesser: no worries and sorry for the confusion. I leave this now for a re-review.

@heplesser
Copy link
Contributor

Thanks @jougs, I am still happy 👍.

Copy link
Contributor

@clinssen clinssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting the following on make installcheck:

Phase 8: Running C++ tests (experimental)
-----------------------------------------
  Not running C++ tests because NEST was compiled without Boost.
Traceback (most recent call last):
  File "/home/archels/nest-simulator-fork-unpollute-environment-build/share/nest/extras/summarize_tests.py", line 30, in <module>
    import junitparser as jp
ImportError: No module named 'junitparser'
CMakeFiles/installcheck.dir/build.make:57: recipe for target 'CMakeFiles/installcheck' failed

doc/guides/spatial/guide_spatially_structured_networks.rst Outdated Show resolved Hide resolved
sli/slistartup.cc Outdated Show resolved Hide resolved
# Make nest/sli/... executables visible.
export PATH="${NEST_INSTALL_DIR}/bin:${PATH}"
# Make NEST executables available by prepending their path to PATH.
export PATH="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@:${PATH}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jochen, I fully trust your definition of "reasonable", it's just that I wouldn't trust this in the general case!

@heplesser
Copy link
Contributor

I'm getting the following on make installcheck:

Phase 8: Running C++ tests (experimental)
-----------------------------------------
  Not running C++ tests because NEST was compiled without Boost.
Traceback (most recent call last):
  File "/home/archels/nest-simulator-fork-unpollute-environment-build/share/nest/extras/summarize_tests.py", line 30, in <module>
    import junitparser as jp
ImportError: No module named 'junitparser'
CMakeFiles/installcheck.dir/build.make:57: recipe for target 'CMakeFiles/installcheck' failed

@clinssen Since the transition to the new test summary generator, the testsuite requires the Python junitparser package to be available. We should probably find a way to specify these requirements properly. Could you create a separate issue for that?

@clinssen
Copy link
Contributor

This PR should also update the description of nest_vars.sh on the installation instructions page: https://github.com/nest/nest-simulator/blob/master/doc/installation/linux_install.rst#environment-variables

@jougs
Copy link
Contributor Author

jougs commented Jun 24, 2020

@clinssen: I've addressed all your comments in my recent commits.

Copy link
Contributor

@clinssen clinssen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

@jougs
Copy link
Contributor Author

jougs commented Jun 24, 2020

@heplesser: would you click the button? I have more in the pipeline :-)

@jougs jougs marked this pull request as draft June 25, 2020 09:15
@jougs
Copy link
Contributor Author

jougs commented Jun 25, 2020

@heplesser: sorry for converting to draft again. I have found a problem with custom module loading. A fix for that should still go into this one.

@jougs
Copy link
Contributor Author

jougs commented Jun 25, 2020

The problem mentioned earlier was that with this PR in place dynamic modules were again not found without manually setting environment variables. The reason was that this PR removes the setting of (DY)LD_LIBRARY_PATH from nest_vars.sh as I was under the impression that this would not be needed anymore as #1513 already cleaned up the library paths used by NEST.

It turned out that paths defined in R(UN)PATH are actually not considered by the dynamic runtime linker after application startup and some additional measures are indeed necessary.

0c39c0a now fixes the problem by adding the library installation directory to the search path for the dynamic loader. This now means that in a default situation, everything just works. If users decide to install their custom extension modules to non-standard directories, they can still set (DY)LD_LIBRARY_PATH to make things found.

Can you please have another look?

@jougs jougs marked this pull request as ready for review June 25, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Bug Wrong statements in the code or documentation
Projects
Status: Done
4 participants