I would like to install Anaconda on a remote server.
The server is running Ubuntu 12.04.
I only have access to this server via SSH.
How can I install Anaconda via the command line?
Something along the lines of:
wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
to get the installer for 64 bit linux followed by:
bash Anaconda3-2020.07-Linux-x86_64.sh
You can get the latest release from here
Please take a look at the Anaconda repo archive page and select an appropriate version that you'd like to install.
After that, just do:
# replace this `Anaconda3-version.num-Linux-x86_64.sh` with your choice
~$ wget -c https://repo.continuum.io/archive/Anaconda3-vers.num-Linux-x86_64.sh
~$ bash Anaconda3-version.num-Linux-x86_64.sh
Concrete Example:
As of this writing, Anaconda3-2020.07 is the latest version. So,
~$ wget -c https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
~$ bash Anaconda3-2020.07-Linux-x86_64.sh
P.S. Based on comments, this should also work in CentOS systems.
You can do as Prashant said or you can use bash scripts to automate the installation. Just simply copy and paste depending on the version of Python you want
If you are trying to it entirely in command line you use a bash script
python 2 anaconda install bash script:
# Go to home directory
cd ~
# You can change what anaconda version you want at
# https://repo.continuum.io/archive/
wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
bash Anaconda2-4.2.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda2-4.2.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc
# Refresh basically
source .bashrc
conda update conda
python 3 anaconda install bash script
# Go to home directory
cd ~
# You can change what anaconda version you want at
# https://repo.continuum.io/archive/
wget https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda3-4.2.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc
# Refresh basically
source .bashrc
conda update conda
Source: https://medium.com/#GalarnykMichael/install-python-on-ubuntu-anaconda-65623042cb5a
Download Anaconda for linux, place in your ubuntu system through WinScp, then
$ sudo bash Anaconda2-4.3.0-Linux-x86_64.sh
after this logout of your ssh session and then login, you will get base environment.
1 - Go to Anaconda Repository, find the installation for your OS and copy the address
2 - wget {paste}. Ex: https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
3 - Execute with: bash. Ex: bash Anaconda3-5.2.0-Linux-x86_64.sh
Run!
$ sudo bash Anaconda2-4.3.0-Linux-x86_64.sh
Video tutorial::
https://youtu.be/JP60kTsVJ8E
Just download the anaconda installer and execute it as it is a shell script. Follow the steps :
In the terminal type "wget https://repo.continuum.io/archive/Anaconda-2.3.0-Linux-x86_64.sh"
The file will be downloaded in current directory. Now execute the downloaded file by "bash ./Anaconda-2.3.0-Linux-x86_64.sh"
Restart the terminal. This is very important for python version provided by anaconda to be set to default for that user.
Note- Try using environment for using different version of python. Changing the default python version for root might result in non functioning of some functionalities like yum.
Related
I am trying to npm install for a project in my mac but for some reason it says python not found even though python3 command is working fine and I also set alias python to python3 in by ~/.zshrc and ~/.bash-profile and restarted several times but still the same issue.
Screenshot of the issue.
NOTE: See comments for the solution
The problem is that Python is required in the system path to operate this command. Solutions:
Install pyenv
Install either Python 2.7 or Python 3.x: pyenv install 2.7.18 or pyenv install 3.9.11 (for example)
If you have more than one python version, ensure one of them is set as global: pyenv global 3.9.11
Add pyenv to your system path
On Mac, put this in your ~/.bashrc or ~/.zshrc: export PATH=$(pyenv root)/shims:$PATH, then run source ~/.bashrc or source ~/.zshrc
For Windows, try npm config set python C:\Library\Python\Python310\python.exe (for example) via administrator
Run npm install again
I am new to shell scripting and what I basically want is to write a script that installs all the software needed for my project to work on a Windows machine without asking the user any additional input aside from running the script itself.
For instance, I want to check if python3 and conda are installed and if not install them without asking the user for additional input.
For conda I was able to figure out the next couple of lines:
if ! command -v conda &> /dev/null
then
echo "conda could not be found"
echo "installing conda..."
MINICONDA_INSTALLER_SCRIPT=Miniconda3-latest-Windows-x86_64.exe
curl --location -C - --output "$MINICONDA_INSTALLER_SCRIPT" "https://repo.continuum.io/miniconda/$MINICONDA_INSTALLER_SCRIPT"
start /wait "" ./$MINICONDA_INSTALLER_SCRIPT /InstallationType=JustMe /RegisterPython=0 /S /C=%UserProfile%\Miniconda3
fi
The code above does not work completely, but I am sure I will be able to figure it out. It is just proof of concept.
I want to have something similar for python3 as well. That is, the script should download and install python3 in silent mode with default settings. On Linux I would just use something amount the lines:
sudo apt-get install python3
but on Windows, I don't know how to do that. Is there a way to do that in the first place?
I'm using Windows 10 and recently installed Windows Subsystem for Linux.
Anaconda was already installed on my PC at that point.
When I try to run conda commands on Bash on Ubuntu on Windows I get the following error:
$ conda conda: command not found
Other related answers, such as this or this suggest adding
C:\Users\«user»\Anaconda3\Scripts
C:\Users\«user»\Anaconda3
to $PATH. But as you can see below, both are already included (I didn't add them manually):
$ echo $PATH | tr ':' '\n'
...
/mnt/c/Users/«user»/Anaconda3
/mnt/c/Users/«user»/Anaconda3/Scripts
/mnt/c/Users/«user»/Anaconda3/Library/bin
...
The following conda files are available in Anaconda3/Scripts:
conda.exe
conda-env.exe
conda-env-script.py
conda-script.py
conda-server.exe
conda-server-script.py
The commands work just fine in both PowerShell and cmd.
What am I missing?
[EDIT]: Corrected second URL and changed user to < user > in Anaconda3 paths above.
Try to run conda.exe instead of conda.
Windows assume .exe marks a file as executable, and ignores that extension when looking for the binary. Linux uses a flag, so any file can be an executable, and you need to provide the full name because there is no assumption on the extension.
Run conda init
.anaconda3/bin/conda init
.miniconda/bin/conda init
To add conda to Windows Subsystem Linux, this is the correct way:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
export PATH=$PATH:/miniconda3/bin
You will need to restart WSL for the env path to work.
my anaconda (4.5.4) works fine as long as I just use it via a linux terminal (bash shell). However, running conda commands in a bash script does not work at all.
The script test.sh containes these lines:
#!/bin/bash
conda --version
conda activate env
Now, running bash test.sh results in the error
test.sh: line 2: conda: command not found
test.sh: line 3: conda: command not found
As recommended for anaconda version > 4.4 my .bashrc does not contain
export PATH="/opt/anaconda/bin:$PATH",
but
. /opt/anaconda/etc/profile.d/conda.sh
Thank you.
I solved the problem thanks to #darthbith 's comment.
Since conda is a bash function and bash functions can not be propagated to independent shells (e.g. opened by executing a bash script), one has to add the line
source /opt/anaconda/etc/profile.d/conda.sh
to the bash script before calling conda commands. Otherwise bash will not know about conda.
If #randomwalker's method doesn't work for you, which it won't any time your script is run in a more basic shell such as sh, then you have two options.
Add this to your script: eval $(conda shell.bash hook)
Call your script with: bash -i <scriptname> so that it runs in your interactive environment.
Let's say you try to access user name with "miky" # "server" address.First when you login to your user ; learn conda path with "which conda" then probably you will get a path such as "/home/miky/anaconda3/bin/conda"
then put your conda commands as follow (in my example i use conda to install a mysql plugin forexample.): shh miky#server -t "/home/miky/anaconda3/bin/conda install -y -c anaconda mysql-connector-python" thats all.
do sudo ln -s /home/<user>/miniconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh and try again. This should activate conda for all users permenantly
source
I'm trying to install opencv using python2.7.
When I use brew install python. I got
Warning: python-2.7.11 already installed, it's just not linked
And then I run brew link python and brew install python again got
1 export PATH="/usr/local/mysql/bin:$PATH"
Warning: python-2.7.11 already installed
But which python still told me I'm using /usr/bin/python.
I changed my ~/.bash_profile to
1 export PATH="/usr/local/mysql/bin:$PATH"
2 #Setting PATH for Python 3.5
3 # The orginal version is saved in .bash_profile.pysave
4 PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
5 export PATH
6 # Homebrew
7 export PATH="/usr/local/bin:$PATH"
No thing happens. It seems that I should be using /usr/local/bin/python because opencv is installed by homebrew.
How to solve this?
Did you try closing your terminal session and then open a new one? ~/.bash_profile is only picked up when bash is executed as a login shell, which is the default for Terminal.app when you open a new terminal window. Or you can do source ~/.bash_profile if you do not want to close the terminal session for some reason.
Side note: You might want to add the following at the top of your ~/.bash_profile:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
So that your ~/.bashrc is also executed. Optionally you can also add:
if [ -f `brew --prefix`/etc/bash_completion ]; then
source `brew --prefix`/etc/bash_completion
fi
To enable bash completion for brew commands.
Recent versions of Homebrew and OSX have switched from putting python in /usr/local/bin to /usr/local/opt/python/libexec/bin
You want to do something like:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
To get the homebrew python.
I changed it to /usr/local/bin like following:
export PATH="/usr/local/python/libexec/bin:$PATH"
Works perfectly for me. That's what I want to use.