I used this link to enable conda in my git bash in my Windows setup
However, whenever I open git bash from the context menu, it does not activate the base environment by default. How do I get it to activate base by default whenever I open the bash terminal in Windows
Add conda activate at the end of .bashrc file so that it becomes as follows:
. /c/Users/DEADARA/Miniconda3/etc/profile.d/conda.sh
conda activate
Related
Whenever I create a new Tmux session it's activated automatically with base. When I do conda deactivate then it shows that another environment is activated.
For example:
(base) user#something: conda deactivate
(env1) user#something:
when it used to not show anything.
When I run conda env list it shows:
# conda environments:
#
env1 /home/user/.conda/envs/env1
env2 /home/user/.conda/envs/env2
base /usr/local
So something tells me that the base is set incorrectly. How do I fix this behavior?
I am trying to create .sh and .cmd scripts that set up a conda environment. In the scripts, after creating the conda environment, I have additional commands to install some 'development mode' packages. However, the script exits after running the conda env create command (the environment is successfully created). Is there any way to ensure that the call to conda env create doesn't exit the script?
here is the code within the script:
# Clone repos to current directory
git clone https://github.com/int-brain-lab/ibllib.git --branch develop
git clone https://github.com/int-brain-lab/iblapps.git --branch develop
git clone https://github.com/int-brain-lab/analysis.git
git clone https://github.com/int-brain-lab/IBL-pipeline.git
# Create conda environment from the .yaml file and activate
conda env create -f iblenv.yaml python=3.8
source ~/anaconda3/etc/profile.d/conda.sh
conda activate iblenv
# Install repos in 'development mode'
conda-develop ./ibllib
conda-develop ./iblapps
conda-develop ./analysis
conda-develop ./IBL-pipeline
I believe issue is here:
source ~/anaconda3/etc/profile.d/conda.sh
if conda.sh contains exit command, it will stop executing of your shell script because source means that conda.sh will be executed in the current process.
You can try to add echo before and after "source" command to check that "conda env create" is not the latest command.
I am using PyCharm 2019.3.3 (Community Edition) on Windows 8. I wanted to integrate Git bash in the PyCharm terminal. I have set the shell path in the terminal application settings of PyCharm as
C:\Program Files\Git\bin\bash.exe
The problem occurs when I activate a venv virtual ennvironment, set up using
python -m venv env
by running
source env/Scripts/activate
I think env is active as I see two parenthesis, () and typing pip freeze displays all installed packages in env. But this is accompanied with an error message that displays in the terminal
bash: basename: command not found
This same message is logged after typing commands like ls, clear which doesn't work but pip freeze and pip --version work. And when I deactivate env, ls, clear and pip stopped working displaying the mentioned error message.
All this problems do not occur in the Git bash application for Windows irrespective of whether I am in env or global environment and all commands work properly. I know I can just use Git bash instead of the integrated terminal of PyCharm but just wanted an answer to this problem.
What seems to be the problem here? Am I setting up my shell path wrongly or is this problem specific to PyCharm?
I solved this issue by disabling "Activate Virtualenv" checkbox in File -> Settings -> Tools -> Terminal
Since, pycharm documents does not show any support for 'Git Bash', that is probably the reason for this weird behaviour.
Terminal Options in Pycharm
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