I am having huge problems with my PATH
and LD_LIBRARY_PATH
since I have installed new libraries. Generally speaking: I can't export permanently my PATH
variables defined in my ~/.bashrc
file. As example: when I boot and I type which mpiexec
, I would expect the one linked to my mpich
library defined in my~/.bashrc
file, however, I get another one which is:
/usr/bin/mpiexec // vs expected output: /home/mpich/bin/mpiexec
So every time I need to manually type: PATH=/home/mpich/bin:$PATH ; export PATH
, and I can't live with this as I have multiple libraries.
What I did:
Modify the bashrc with all my libraries using:
sudo nano ~/.bashrc
, Output:export PATH=$PATH:/usr/local/cuda-10.1/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64
export CUDA_HOME=/usr/local/cuda-10.1
export PATH=$PATH:/snap/bin
export PATH=$PATH:/usr/bin
epxort PATH=$PATH:/bin
export PATH=$PATH:/home/mpich/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mpich/lib
export PATH=$PATH:/home/opt/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/opt/openmpi/lib
Edit the environment variables in
/etc/environment
Output:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/mpich/bin:/home/opt/openmpi/bin"
- type
$ source ~./bashrc
- reboot
However, none of the above allow me to retrieve my PATH
variables when booting.
So my question is : Where is the error relying and how could I export permanently my path variables defined in ~/.bashrc ? I am running on Ubuntu 18.04.
Any help would be more than appreciated as I have been spending hours on this problem. Thanks in advance
ls
aftercd
, typepwd
- you will likely see you are already in/home/joachim
(2)export PATH=/usr/local/cuda-10.1/bin
overwrites anything you assigned in/etc/environment
(3) in~/.bashrc
you add/usr/bin
to$PATH
but not/bin
so it's no surprise that/bin/ls
is not found – steeldriver Sep 19 '20 at 08:28ls
now works, but still, there are other path variables which are still not taken into account (see updated question). Thank you anyway for your fast answer – Joachim Bsh Sep 19 '20 at 09:01/usr/bin
then append/home/mpich/bin
, it is expected thatwhich mpiexec
will find the former first – steeldriver Sep 19 '20 at 12:28