If I create a new Conda environment, for example conda create --name Test, how can I launch Jupyter or QtConsole using the Test environment?
Do I need to manually launch it from the command line rather than using the shortcut?
Do I need to manually launch it from the command line rather than using the shortcut
That would be the easiest way to do it.
One alternative is creating a custom .bat which activate the Test environment then launch the QtConsole application.
Related
So, I guess this is done in a really simple way, but I do not have experience with it, so I do not understand what is the issue. Let's say I have a conda environment example_env and a Singularity image example.simg.
I can run the image:
singularity run --nv /mnt/appl/singularity_images/pytorch-19.03-py3.simg
Once I am in the Singularity container, I can write conda activate example_env, and it works for me without any problem.
Now, I want to switch from the interactive section to a script. So, instead of using singularity run and entering the interactive shell, I have tried singularity exec: singularity exec example.simg bash scripts/train.sh, where train.sh contains only one (just for now, of course) command: conda activate example_env.
However, now it does not work, and gives me the following error: CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run $ conda init <SHELL_NAME> If I try to follow the error message, and add the conda init command, it does not help.
What is wrong, and how can I run conda activate with singularity exec?
I don't think you run the echo commands as shown in this stackoverflow.
I think you should check out the following.
Activate conda environment on execution of Singularity container in Nextflow
I have Git for Windows and want to be able to start Jupyter Notebook in a directory of choosing using File Explorer. If I right click in a directory and select "Git Bash Here," a Bash shell opens. I already added my Anaconda directory (where my Python 3.7 is located) into the user path, and I can verify that Bash sees that in the path by "env|grep PATH". However, when I type "jupyter notebook" from the Bash prompt, it finds the script and it starts to run, but reports an "ImportError: DLL load failed: The specified module could not be found."
How do I set the Bash environment to start a Jupyter Notebook from the current directory where I have a Bash prompt?
I solve this problem with the command:
source "C:\Users\...\Anaconda3\Scripts\activate"
When you install Jupyter via anaconda it isn't added to the system's enviornment variables. Your system doesn't know about Jupyter. Only anaconda does because it is managing your packages and your versions for each project you create.
If you're using bash for windows I would think you'd have to install Jupyter notebooks to windows and add it to your environment variables to be able to see it in any directory.
Edit: Here's a picture of me running Jupyter from my windows command line and from the Anaconda prompt.
In your GitBash prompt type the following command
. Anaconda3/Scripts/activate
assuming you are in your home directory.
This will allow you to run jupyter from GitBash and also use UNIX commands from jupyter.
I've been trying all day to debug a code using Visual Studio Code without success. I have installed VSC on windows and I have installed bash (ubuntu) as well. I already put bash as a terminal default shell:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
The thing is when I run the debug, it tries to activate the env with activate myenv-name and I couldn't find how to change this instruction to source activate myenv-name.
Do you know how I can do this? any help will be appreciated. Thanks!
It's been a while since I asked this question and I got the answer finally. :)
It is simple we just have to create .bashrc file in our user folder there we can write whatever commands we need to run each time we start a terminal in vscode.
Here the command to activate a conda env:
source activate myenv_name
In case of bash: conda: command not found and you don't have admin permissions to change the paths use this command before source act...:
export PATH=$"/c/Users/UserName/AnacondaPath/Scripts":$PATH
Is it possible to start an ipython shell(in terminal) within a conda or virtualenv ?
The ipython shell should belongs to the respective environment.
I know a way to start jupyter notebook within the env, by creating a kernelspecs for the virtual env and then choosing the env kernel within the jupyter notebook.
here is the link : http://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs
But this only setup the jupyter notebook for the current environment. Is there a to do the same for ipython shell
The answer given by Grisha Levit almost solved the problem. So, i am writing the complete details of the answer, how to setup a ipython console within a specific environment.
1.) Activate the virtual env:
source activate <environment-name>
2.) From within the virtual env:
jupyter kernelspec install-self --user
3.) This will create a kernelspec for your virtual env and tell you where it is:
Installed kernelspec pythonX in home/username/.local/share/jupyter/kernels/pythonX
Where pythonX is the version of the python in the virtualenv.
4.) Copy the new kernelspec somewhere useful. Choose a kernel_name for your new kernel that is not python2 or python3 or one you've used before and then:
mkdir -p ~/.ipython/kernels
mv ~/.local/share/jupyter/kernels/pythonX ~/.ipython/kernels/<kernel_name>
5.) If you want to change the name of the kernel that IPython shows you, you need to edit ~/.ipython/kernels//kernel.json and change the JSON key called display_name to be a name that you like.
6.) Running jupter/ipython console within the virtualenv.
jupyter console --kernel <kernel-name>
7.) This will start the jupyter console/shell for the current virtualenv and you can also see kernel in the IPython notebook menu: Kernel -> Change kernel and be able so switch to it (you may need to refresh the page before it appears in the list). IPython will remember which kernel to use for that notebook from then on.
I know a way to start jupyter notebook within the env, by creating a kernelspecs for the virtual env and then choosing the env kernel within the jupyter notebook.
You just need to do the same thing, but using console instead of notebook.
For example:
ipython console --kernel python2
The Alt+f2 in ubuntu shows up Run Application prompt. I can type any command there and open an application through it. How can i do the same programmatically, i mean that i have a command that should be passed to Alt+F2 programmatically. By program i mean a shell script
Have a look at xdotool.
You can use gmrun, which can be installed from the Ubuntu repos. Just sudo apt-get install gmrun. man gmrun for more info.
It's not exactly the same as the "run application dialog", but there's no clean way to bring that up from a script that I know of.