I am trying to install Ruby on a remote server using rbenv.
However, when I run the command rbenv install 2.7.2, I get the error below:
ruby-build: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec)
I have rbenv and other dependencies for the Ruby programming language properly installed.
After a few research and trials, I was able to solve it.
Here's how I solved it:
The issue was that the rbenv installer needed a directory to store temporary files while it is downloading and installing ruby, however, the /tmp directory which is the default directory for storing temporary files wasn't accessible by my current user.
I tried to change permissions for the /tmp directory to allow it become accessible to my current user, however, I was unsuccessful.
All I had to do was to create a new tmp directory in the home directory of my user:
mkdir ~/tmp
Next, I opened the .bashrc file in the home directory of my user:
sudo nano ~/.bashrc
Next, I added the line below to the bottom of the file and saved:
export TMPDIR="$HOME/tmp"
Finally, I restarted my terminal or ran the command below to load the newly added paths into my current shell/terminal session:
exec "$SHELL"
Now, I could run the command rbenv install 2.7.2 and it worked fine.
Resources: TMPDIR=/tmp cannot hold executables (partition possibly mounted with noexec)
Adding to the OP's answer, you don't need to create a new tmp folder. Only adding to the path should work as well.
Related
I did a fresh install of Ubuntu 20.04 LTS (Focal Fossa), installed Apache, PHP, MySQL and PHP Composer seemingly without issue. However, I still cannot get laravel -V to give me a version number.
I have looked at a multitude of YouTube videos and tried my interpretation of the recommendations found here on Stack Overflow. How can I fix it?
Here's the output on my shell $PATH.
You must add PHP Composer binaries folder to your $PATH if you'd like to call the binaries globally.
A) Make sure you have the latest Laravel installer:
composer global require laravel/installer
B) Add composer bin folder to your $PATH:
Edit your .bashrc file: gedit $HOME/.bashrc
Add the following line: export PATH="$PATH:$HOME/.config/composer/vendor/bin"
C) Use the source command to force Ubuntu to reload your .bashrc file:
source $HOME/.bashrc
D) Try to output Laravel installer's version:
laravel -V
Additional explanations as requested:
To execute a command from the Linux terminal, you need to tell Linux where the program is located.
For example, you could have launched Laravel installer using the full path: $HOME/.config/composer/vendor/bin/laravel -V
But instead, you wanted to be able to call the laravel -V command directly because you don't want to type the full path every time.
Since you are on Ubuntu, the default shell program is Bash. You need to tell Bash where to look when you type a command. In this case, you want Bash to look in the $HOME/.config/composer/vendor/bin/ folder.
The configuration file for Bash is a hidden file called .bashrc located in the user home folder. Bash stores the list of special folders in a variable called $PATH. To add a new folder, we simply added it to the $PATH variable.
If you type echo $PATH in your terminal, Bash will output the content of the $PATH variable and you will see a list of folders.
Now you may ask: "Why did I have to do this? I usually don't have to mess with my Bash configuration". Yes, this is because you usually install Ubuntu packages and they are configured to work out of the box. In this case, you installed a composer package in your home directory and it's therefore up to you to configure it the way you want.
You may need to do source $HOME/.bashrc every time you open u a new terminal windows and then do laravel -v
I am having a problem about linuxbrew.
bash: /lustre7/home/lustre4/user1/applications/bin/cut: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
I tried to uninstall linuxbrew using instructions at its website, but somehow it didn't work (because of sudo requirements).
there is linuxbrew directory but I can't remove when I type rm -r linuxbrew it says;
-bash: /lustre7/home/lustre4/user1/applications/bin/rm: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
When I tried to install homebrew it says your CPU is not supported. (I tried this before and it worked, but now it is not working.)
I want to solve this problem but I couldn't find any solution. I am not able to run sudo and yum commands because I am not root. I am a user at a linux cluster.
OK. I finally was able to solve this issue.
I am wring in case someone else may have the same issue.
First, this was related to a bash problem. I recently installed a tool that put some variables to both bashrc and bash_profile and altered path of bin directory.
I wasn't able to use system commands such as rm, ls, cat etc. and I wasn't able to run system ruby. Paths of all commands and ruby were in my bin directory under my application directory.
What I did is;
I edited my bash_profile by cancelling the new path that caused conflict between bash_profile and bashrc. This enabled me run system commands.
I uninstalled linuxbrew as described in its website.
I removed linuxbrew from my home directory, and cancelled its path in bash_profile (comment out).
I installed homebrew again and put its path to my bashrc.
Now it is working.
I could uninstall linuxbrew using the procedure I described in here:
How to completely uninstall brew and re-install brew in ubuntu 19.04
-> In short, I just replaced install.sh by uninstall.sh and it worked...
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
I previously had Conda running smoothly on Mojave, but I've found that the upgrade to Catalina moves the "anaconda3" folder to your Desktop > Relocated Items > Security > anaconda3. It seems Catalina's security settings may not allow applications to install directly under the user directory anymore.
I tried the suggestion here, written below:
Hi, I might have a solution
Copy the folder anaconda3 located in Relocated Items to /Users/myname/
Open Terminal
Enter: export PATH=''/Users/myname/anaconda3/bin:$PATH"
Enter: conda init zsh
It worked! Good luck!
But this doesn't work for me. After conda init zsh I get:
-bash: /Users/USER/anaconda3/bin/conda: /anaconda3/bin/python: bad interpreter: No such file or directory
How can I get Conda up and running again without losing all my virtual environments? Thanks!
Update
I got Conda to work following #Ted Shaowang's suggestion. This means that conda env list shows all the virtual environments created via Conda.
However I am still experiencing an issue with virtualenv as since I changed the default anaconda3 file locations, python cannot be found.
The python executable located at .virtualenvs/env/bin/python cannot be found. Do I need to make further changes in order for python to work from virtualenv too?
I have the exact same problem and this works for me:
After you move anaconda from "Relocated Items" to ~/anaconda3, edit the first line of ~/anaconda3/bin/conda file from #!/anaconda3/bin/python to #!/Users/USERNAME/anaconda3/bin/python to reflect the change.
I would probably abstain from using the above solution. That ~/anaconda3/bin directory has lots of runnables (not just the conda one) that would need to be altered in this manual way. For example, unless you make the same change you cannot run jupyter notebook either, neither from base nor from other envs you might have.
My tip: Try getting a requirements file for your virtual envs, and do a fresh installation. You could use pipreqs to get the requirements used for individual projects: https://www.idiotinside.com/2015/05/10/python-auto-generate-requirements-txt/
No solution will be completely working without fixing the baked-in hard-coded prefix entries in files. There's a longer description and a recommended fix at https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/
Technically this is reinstalling anaconda, however, I restored all my conda envs so, hopefully this is an acceptable solution!
Here is how I got it working on Catalina as of a few minutes ago (now using z-shell):
- Verified the existence of "Relocated Items" directory on my desktop and the "anaconda3" directory and its contents inside
- Navigated into the envs directory under "anaconda3" and left the finder window open (see screenshot)
THEN:
opened new Terminal (z-shell)
ran (this installed to /usr/local/anaconda3):
brew cask install anaconda
after installation was successful I opened my ~/.zshrc file (for my z-shell aliases) and added the following line:
export PATH="/usr/local/anaconda3/bin:$PATH"
saved my ~/.zshrc file, then reloaded with:
source ~/.zshrc
to verify conda command works now, I ran:
conda env list
for me, this showed a base env and that was it
then open Finder to the new envs location:
open /usr/local/anaconda3/envs/.
I dragged (moved) all my old envs into the new envs folder, and then ran:
conda env list
And all my old envs are back! :)
updated my PyCharm interpreter / env paths to reflect the new locations of these envs (had to restart PyCharm after, but now it works!)
DONE
Unsure whether this is considered a comment or at least a temporary answer, but I would refrain from attempting to fix any Catalina compatibility issues with Anaconda for now. See this GitHub issue.
I have the same problem, and this work for me :
My solution:
Copy your anaconda3 from Relocated Items folder
Paste in User/YourUserName
Open conda file in anaconda3/bin with the editor and edit the first line #!/anaconda3/bin/python to #!/Users/YourUserName/anaconda3/bin/python
Save it and run conda file
Open Terminal
Run this : export PATH=''/Users/YourUserName/anaconda3/bin:$PATH"
Run conda init zsh
I had incurred the same issue, and the following solution worked for me, and this is the easiest solution:
Instead of messing around copying the anaconda3 file from relocated items into User/USERNAME directory, better would be just to reinstall anaconda navigator's latest version from its official website : https://www.anaconda.com/distribution/#macos
While installation, it will ask you some permissions which are a result of new Apple Security Policies, just grant them, and it works just the way it should after this fresh installation!
This is what worked for me.
These are my header files (Catalina 10.15):
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
Run sudo find /Library -name stdio.h to see where yours are located.
Mojave 10.14 header files:
$ sudo find /Library -name stdio.h
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
As can be seen the SDKs are now split into MACOSX10.14 and 10.15 unlike in Mojave.
TLDR
So, these were my SDK folders on Catalina:
Rename MacOSX.sdk to MacOSX_orig.sdk
Right click on MacOSX10.14.sdk
Duplicate
Rename duplicate folder to MacOSX.sdk
Your folder structure should now look like this:
Like this we are basically using the previous version's OSX sdk as sysroot. Hope this helps.
For example, I'm trying to install pipenv using the following commands:
$ pip3 install --user pipenv
$ cd ~/Documents/myproject
$ pipenv install requests
zsh: command not found: pipenv
It seems that the issue can be resolved if I run sudo ln -s ~/.local/bin/pipenv /usr/bin. Is this a safe thing to do? I've also been having this issue with several other packages, like tensorboard and xflux. Is there something wrong with my system that makes it such that I need to manually create a symlink every time? How can I change things so that packages can install normally without me having to do this every time?
The problem you are having is that the tools you are installing are being installed in non-standard locations and are not being included in your PATH. One way to resolve this would be to include the paths in your PATH environment variable. In order for these programs to be in your path every time you login, do this (assuming you are using zsh as your shell):
1) Open ~/.zshrc using vim or any other editor:
vim ~/.zshrc
2) Append the following to this file:
export PATH=$PATH:/path/to/dir/containing/pipenv
Remember to replace /path/to/dir/containing/pipenv with the appropriate path.
3) Source your ~/.zshrc so that the path is included in your current session:
source ~/.zshrc
4) Now everytime you login, the paths should be available in your environment and you won't need to create symlinks.
I use v0.6, but certain packages do not function with v0.6 (such as Interact.jl). How can I install v0.5? I am running Ubuntu 16.04.
First we have to download the latest Julia version from https://julialang.org/downloads/
I used the “Generic Linux Binaries for x86” version. The choice between x86 and ARM depends on the processor of your machine. Also choose between 32 bit and 64 bit versions based on the operating system and processor you have on your machine.
After download, you will get a compressed tar.gz archive having name similar to “julia-0.6.2-linux-x86_64.tar.gz”. As the “julia-0.6.2-linux-x86_64.tar.gz” name suggests that I downloaded the Julia version 0.6.2 which is latest at the time of writing this.
The names may differ. Adapt the names accordingly.
Remember these are binaries, these don't need to be installed as they can be directly used from the directory they are extracted.
I am assuming that the downloaded file is in your ~/Downloads directory of Ubuntu.
Open the terminal and navigate to the directory where the downloaded tar.gz file is stored, in present case the Downloads directory.
The terminal when just opened will show:
x#xpc:~$
where x should be replaced by your username and xpc should be replaced by your computer name.
Navigate to the Downloads directory using cd Downloads and then press Enter to get following terminal:
x#xpc:~/Downloads $
Extract the tar.gz file using the command
tar -zxvf julia-0.6.2-linux-x86_64.tar.gz
Now a directory with extracted contents will be generated in the same parent directory as of the compressed archive with a name similar to julia-xxxxxxxxxx where xxxxxxxxxx may be a combination of alphabets and numerals.
This is the final directory you need to run the latest Julia version, no installation is needed.
To run Julia, you can directly run using the julia file in location julia-xxxxxxxxxx/bin/julia as discussed below.
Navigate to the bin directory in the extracted directory using
cd /Downloads/julia-xxxxxxxxxx/bin
The terminal will now be like:
x#xpc:~/Downloads/julia-xxxxxxxxxx/bin $
Now run the command ./julia to run julia on the terminal as shown below.
The terminal will now change to julia as presented below. I know the representation is little different here as this is all I can manage to copy from the terminal to present it to you.
julia>
But the problem is that I have to navigate to the directory every time to run Julia.
Many people have discussed on the internet about defining the path and alias through very complex procedures and as I am not a hardcore computer geek, it was really difficult for me to understand.
I came to know about making a soft link.
So I decided to make a soft link to the Julia to run it directly from anywhere with a short command without navigating to the directory containing it.
I always try to do things neatly, so I decided to keep the extracted directory named julia-xxxxxxxxxx in the /opt directory of my system as most of my important programs reside in that.
You need root permissions to copy a file into the /opt directory, so I used the command sudo su and then provided password to get the super user privileges:
x#xpc:~$ sudo su
[sudo] password for x:
root#xpc:/home/x#
Now navigate to the directory presently containing the extracted directory:
root#xpc:/home/x# cd /Downloads/
root#xpc:/home/x/Downloads#
Copy the directory using:
root#xpc:/home/x/Downloads# cp -r julia-xxxxxxxxxx /opt
After the directory is copied to the destination, now we will make the soft link in a directory which is in the system path so that the soft-link can be called from any location to run Julia.
To find out the directories in the system PATH use echo $PATH, you will get a list of paths of directories separated by colon(:) such as /usr/local/bin. You can use any of them. I used /usr/local/bin for the soft link.
Navigate to the chosen folder.
root#xpc:/home/x# cd /usr/local/bin
The terminal will become
root#xpc:/home/x/usr/local/bin#
Create the soft link using
root#xpc:/home/x/usr/local/bin# sudo ln -s /opt/julia-xxxxxxxxxx/bin/julia julia
Now return to the normal user terminal using the keyboard combination Ctrl+D at the empty terminal root#xpc:/home/x/usr/local/bin#.
The terminal prompt will become:
x#xpc:~$
Type the newly made soft link i.e. julia in the terminal as shown below
x#xpc:~$ julia
This is where the magic happens and you get this:
julia>
The instructions can be used for any version of Julia in Ubuntu.
Source
Firstly, you should really read the post that Reza Afzalan linked. It gives you everything you need to know about how to install. If you prefer a list:
Go to the Julia download page.
Download the Generic Linux Binary for your OS (probably 64-bit for Ubuntu 16).
Install it.
Find where the installed Julia binary executables are stored on your machine.
Symlink Julia v0.5 and Julia v0.6 to different aliases, e.g. julia5 and julia6. You can store the symlinks in a directory like /usr/local/bin.
Open julia5.
Start downloading your packages with Pkg.add.
It's very easy, here's how to install it on Linux in 8 steps:
1- go to Julia downloads page
2- Choose you version (32bit or 64bit) from Generic Linux Binaries, and then download it.
3- extract .tar.gz file in home or any place you would like to install Julia on it.
4- run > gksudo gedit /etc/environment on your terminal to setup envirnment path.
5- edit file :/Path_To_extracted_File/bin in my case it was like this:
":/home/okasha/julia-d386e40c17/bin"
6- Save edits and close the file.
7- Restart your machine.
8- Open your terminal again and run > julia -version
you shoud get "julia version 0.6.2" for Example according to your installed julia version.
Run > julia to open julia session.
Reference
Just type this
sudo apt install julia