2

Whenever I use Tensorflow (a python library) from within a tmux or screen session, I have to manually change the environmental variables. Specifically, I have to type export PATH blah blah blah and export LD_LIBRARY_PATH blah blah blah. Normally (outside of tmux and screen) I don't need to do this, because my .bashrc contains exactly these lines.

The weird part is that for some reason, running source ~/.bashrc from with tmux or screen DOES NOT update the path variables. I have also tried adding source ~/.bashrc to my .profile. So, my question is, what do I need to do in order for tmux and screen to automatically run my two export lines?

EDIT: After running set -x; source ~/.bashrc, the end of the printout reads:

    ++ export 'PATH=/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ PATH='/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ bind TAB:menu-complete
++ export 'PATH=/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ PATH='/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}'
++ export 'PATH=/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}}'
++ PATH='/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/home/ajherman/anaconda3/bin:/home/ajherman/anaconda3/bin:/usr/local/cuda-9.0/bin/usr/local/cuda-9.0/bin/home/ajherman/bin:/home/ajherman/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin}}}}'
++ export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
++ LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64/usr/local/cuda-9.0/lib64:/home/ajherman/arrayfire-3/lib:/home/ajherman/arrayfire-3/lib
  • What shell are you running in tmux and screen? – Kusalananda Aug 16 '18 at 18:52
  • 2
    That is indeed strange. Run set -x; source ~/.bashrc ; set +x. – RalfFriedl Aug 16 '18 at 18:52
  • also check env in and out of TMUX, also your .bashrc likely has some conditionals so make sure your LD_LIBRARY_PATH is actually run – user1133275 Aug 16 '18 at 19:34
  • 1
    @Ari I approved your edit but you really should merge your two accounts: unix.stackexchange.com/help/merging-accounts – Anthony Geoghegan Aug 16 '18 at 19:38
  • The most interesting parts are probably going to relate to PATH and LD_LIBRARY_PATH ... – Jeff Schaller Aug 16 '18 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.