source /opt/anaconda3/bin/activate failed - anaconda3

anaconda version: 4.10.1.
anaconda is installed with root in /opt/anaconda3.
another user mingming tries to source /opt/anaconda3/bin/activate and shell never return until CTRL + C. mingming has rwx access to all files and directories in /opt/anaconda3. I am trying to install anaconda with root and make all other users can use it to create their own environment.
I found out that conda init alternate PATH in an endless loop, but why this is happening?

Related

Use conda command when anaconda path is not in home directory

I know normally I can just do . ~/anaconda3/etc/profile.d/conda.sh to use conda command if anaconda directory is directly under home/; but I need to put my anaconda in another folder which is shared across the servers, so my conda path is now /home/user/sharedfodler/anaconda3 instead. Now if I do . ~/anaconda3/etc/profile.d/conda.sh then try to use conda command, I get the following error:
/bin/sh: 34: /home/user/anaconda3/bin/conda: not found
it seems the system doesn't recognize anaconda that isn't directly installed under home directory. What should I do in this case?

How to lock root privileged VS code to Ubuntu Launcher?

I am using VSCODE for obvious purpose and I am running it via root permissions on Ubuntu using a command
sudo code --user-data-dir="~/.vscode-root"
Problem-
My Ubuntu Launcher has a VSCODE icon but that VSCODE is not a root user and each time I want to run it as a root user, I have to run the above command.
How can I fix the VSCODE with root privileges in my Ubuntu Launcher for quick access?

opening jupyter notebook in anaconda

When I tried to install Anaconda into my computer, the destination folder for my installation was "C:\Users\Lara Nguyen\Anaconda3". When I clicked "Next", there was a pop-up saying that "Error:'Destination folder' contains 1 space. This can cause problems with several Conda packages, and is thus disabled. Please install to a path without a space". After the installation, opened cmd and typed "Jupyter Notebook" but there was an error message saying that:"jupyter"is not recognised as an internal or external command, operable command or batch file.
Is there anyway I can fix this problem?
Looking at your path I am assuming you are using windows (I mention this so that other linux user do not refer this answer)
First of all it's clearly mentioned in the Anaconda installation documents that it is recommended to install to a path which does not have spaces
If you installed it correctly, did you register the anaconda path to the environment variable? If not then do that
The paths that you have to register will be something like this:
C:User\username\Anaconda3
C:User\username\Anaconda3\Scripts
C:User\username\Anaconda3\Library
Now run the anaconda prompt (not cmd) and just type the conda commmand
After typing the conda command if you did not get any error then you have successfully installed jupyter as well (You can cross check this by going to following location : C:User\username\Anaconda3\Scripts and searching for jupyter-script.py file)
now in anaconda prompt itself run the command jupyter notebook
if it still throws you error then I would strongly recommend you to reinstall Anaconda3 and follow the above steps correctly

How to set a default environment for Anaconda / Jupyter?

I have installed Anaconda for my Machine Learning course. I'm using it as IPython (Jupyter) notebook, in which we have lessons. OS is Ubuntu 14.04 LTS. Basically, I always run it from Terminal with:
jupyter notebook
I have created new environment called su_env from root environment (exact copy) with one package added. Now, I'm wondering: how can I set environment su_env as default one? I have dozen of notebooks so it's annoying to set up each time for every notebook the environment, in "web" GUI of Jupyter.
EDIT: I'm interested in a solution where you don't have to set environment before running notebook. My logic is that, somehow, automagically, jupyter sets root environment on its own while starting up. Because of that, I'm wondering is it possible to set some config file or something so jupyter sets su_env instead of root. Also, if you know that's not possible (and why), I would like to know that.
First activate the conda environment from the command line, then launch the notebook server.
For example:
$ source activate env_name
$ jupyter notebook
Note: This might only work with environments that were created from within Jupyter Notebook, not environments that were created using conda create on the command line.
In your ~/.bashrc, include the line:
alias jupyter="source activate su_env; jupyter"
This will condense the two commands into one, and you will activate su env whenever you call jupyter notebook or lab or whatever
Edit your bashrc and add source activate su_env then that env will always be active. To switch back to to root (or any other env) source activate env_name
You can use this on conda prompt:
conda activate env_name
jupyter notebook
source activate env_name gives me an error: 'source' is not recognized as an internal or external command, operable program, or batch file.

How do I install the Matlab MCR in Ubuntu 14.04 without "killing" Unity?

Background: I have created an Ubuntu VirtualBox from LAPP stack and added the Ubuntu desktop (Unity: sudo apt-get install ubuntu-desktop). Now I am attempting to install the MCR without loosing Unity.
Download MCR zip and extract to MCR_SOURCE
Go to my folder that contains the files: cd /media/sf_shared/MCR_ SOURCE
Change installer_input.txt file:
destinationFolder=/opt/MCR
agreeToLicense=yes
outputFile=/opt/install.log
mode=silent
product.MATLAB
product.MATLAB_Builder_JA
# Note: To find out the required toolboxes >> start Matlab >> run your code and find out which toolboxes were used with: license('inuse')
Install MCR: sudo ./install -inputFile /media/sf_shared/MCR_SOURCE/installer_input.txt >> success
Restart Ubuntu >> test whether Ubuntu’s Unity still exists >> everything is fine
Attention the next step will “ kill ” your Ubuntu desktop configuration!!! (i.e. copy your hardisk, anything you must do to recover quickly) – now configure: sudo gedit /etc/environment
LD_LIBRARY_PATH="/opt/MCR/v84/runtime/glnxa64:/opt/MCR/v84/bin/glnxa64:/opt/MCR/v84/sys/os/glnxa64:${LD_LIBRARY_PATH}"
XAPPLRESDIR="/opt/MCR/v84/X11/app-defaults"
# Note: X11/app-defaults folder has not been created during installation
Restart Ubuntu >> Unity is gone, recovery attempts such as deleting the above lines do not recover Unity; reinstalling the Ubuntu desktop does not help either.
I have tried an alternative route with exporting the variables, which also "kills" Unity. By the way this affects all users.
Any ideas?
It is not necessary to register these environment variables in /etc/environment, which means that the Unity sidebar will not be affected.
Instead register the environment variables temporarily either as local user or via sudo -i:
export LD_LIBRARY_PATH="/opt/MCR/v84/runtime/glnxa64:/opt/MCR/v84/bin/glnxa64:/opt/MCR/v84/sys/os/glnxa64:${LD_LIBRARY_PATH}"
export XAPPLRESDIR="/opt/MCR/v84/X11/app-defaults"
Now it is possible to run Matlab Apps without "killing" Ubuntu's desktop. For instance to run the Java compiled makesqr.m file.
java -classpath "/opt/MCR/v84/toolbox/javabuilder/jar/javabuilder.jar:/media/sf_shared/for_testing/makesqr.jar" makesqr.Class1 5
The Java package makesqr was created using Matlab's JavaBuilder tutorial. This was done on my Windows 7 machine, which runs Matlab R2014b.
Please ensure that the owner and permissions of the /opt/MCR and /media/sf_shared/for_testing folders are set correctly (see here for details).