0

I have miniconda (conda 4.5.4) installed on my windows 10 machine, and I'm trying to set up a python3 virtual env and a python2.7 virtual env so that I could use one version of the language in one virtual env. This is pretty straightforward to do on the anaconda prompt, but I'm trying to make this work on git bash which is the shell that I use the most.

I created a python 2 environment with the following command in the anaconda prompt: conda create -n py2.7_geo_visualization python=2.7

this installed smoothly on the anaconda prompt and activate py2.7_geo_visualization works as desired.

So, switching fromt the anaconda prompt to git bash... running activate py2.7_geo_visualization on git bash makes the shell return without the name of the virtualenv in parentheses next to the git bash command line. I get biney@LAPTOP-1IXXXXX MINGW64 ~ no matter what. And also I cannot use python 2, that command leaves git bash hanging (typing in python always leaves git bash hanging now, I added lines to my .bashrc and .bash_profile that were along the lines of alias python3="winpty.exe"

I tried creating a virtual env with conda via git bash, but I get the same problem; nothing shows up next to biney@LAPTOP-1IXXXXX MINGW64 ~

since activate does nothing, I don't know how to get a virtualenv up and running that isolates my two versions of python.

Edit:

Can someone tell me why a question asked in 2012 that has nothing to do with miniconda installation is a duplicate version of this question and how to actually apply the solution or can I just make a new question? I get that me asking a "duplicate question" isn't helpful and good content for stackoverflow, but I still don't have any understanding of how that question even begins to apply to mine. Especially after I already left multiple comments saying that I can't successfully run commands to find the directories that are mentioned in that question.

Byron Smith
  • 587
  • 10
  • 32
  • If that is the case... can't quite figure out the `source Scripts\activate` commands. I tried cd'ing to the location of my conda env `C:\Users\biby\Miniconda3\envs\py2.7_geo_visualization\` but that has done nothing – Byron Smith Jun 24 '18 at 23:29
  • @phd any suggestions? – Byron Smith Jun 24 '18 at 23:30
  • In git-bash all paths are different. Something like /c/users/bibi/… – phd Jun 24 '18 at 23:30
  • That doesn't quite narrow down my search... I have python installed via Miniconda so all env's created by Miniconda via `miniconda create -n ` go into my /c/users/biby/miniconda3/env/. I tried looking in the envs for the ones I created. each env directory has a Scripts directory, but that Scripts directory doesn't have an activate.bat file. I noticed that there's an activate.bat file in Miniconda3/Scripts/, I'm wondering if I should try running that instead. – Byron Smith Jun 24 '18 at 23:40
  • Miniconda3/Scripts/ was also already put into my PATH variable. I did that upon installation. But activate is still not recognized as a command/file. – Byron Smith Jun 24 '18 at 23:48
  • It's said at the links above: *Scripts/activate.bat does not work here because it is written in Batch, Windows cmd.exe language, and not Bash.* There are perhaps no `activate.bat` at all but `activate` which you shouldn't execute but source (read into the current shell). – phd Jun 25 '18 at 09:18
  • `source activate` runs and puts `(base) biney@LAPTOP-1IV39H2T MINGW64 ~/AppData/Local/conda/conda` next to my line in git bash. This doesn't allow me to activate any other conda virtual environment though. I am stuck with the base (python version 3.6) and can't change to python version 2.7. Trying to `activate py2.7` (name of the env) once I've run `source activate` does nothing. – Byron Smith Jun 25 '18 at 12:42
  • First, run `deactivate`, then activate a different virtualenv. – phd Jun 25 '18 at 12:44
  • It's marked as a duplicate because the moderators didn't see *relevant* differences. If course there are many irrelevant differences, starting with the year. I'll vote to leave it as closed. – arnt Jun 26 '18 at 09:54
  • This question could be closed and removed if possible. That link did end up having the solution albeit I just had to make a minor change in syntax. The question puts `source Scripts/activate`, but these commands were generating errors about `source` at the time. The change I made was just `source activate `. Also I'm still not fully clear on the PATH variable, but I assume it probably is relevant that I added the `Miniconda3/Scripts/` dir to it. – Byron Smith Jun 26 '18 at 17:47
  • So yeah it's a simple solution and not that different. But when I asked this question I had a far more naive understanding of miniconda package directories, virtualenvs, etc... so I had trouble seeing the change in syntax. The answer that I needed at the time was just `source activate `, it would've clicked obviously. If y'all didn't know that was the correct command or couldn't put that together based on the info I gave, I understand. But I did perceive people as being sarcastic and snide in trying to answer this question. I understand the frustration due to simplicity, but... – Byron Smith Jun 26 '18 at 17:50
  • The term "snide" comes to mind because, after providing the link to the other stack overflow question there was no further attempt to engage with me constructively to answer my question. No mention of "did you type something incorrectly in your command line? Review the answer to the post I linked... This should work." Then my question was flagged as a duplicate even though I stated that I lacked understanding and background knowledge, silencing me. I admittedly had a helpless response before trying to figure out what applied to my situation. – Byron Smith Jun 26 '18 at 18:07

0 Answers0