-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python virtualenv not activating in Windows 10 Cmder #1057
Comments
See here: #1056 I think we should do that automatically... |
Thanks @JanSchulz . I did the following (below) but I am still running into the same problem. Just want to confirm that the following procedure was correct: I made a file called "conda.lua" in the config folder with the contents as suggested in #1056 I then added the following line to /vendor/clink.lua:
Was this the correct approach? Any ideas why I still might be having issues getting conda to display? Thank you. |
Oups, sorry... No, don't change anything in vendor, only place a file in config. The conda example needs to be adjusted (conda is an alternative to virtualenv) . In some place it looks for an environment variable |
Gotcha! Sorry for the confusion. That worked. Thank you. Just changed the It did throw this though: I don't know much about LUA. Any reason you can think of off the top of your head as to why this message would get shown? If not no worries! You have given me enough information for me to go do some research and I can close the issue. Thank you for all of the help so far! |
@lpinner this worked thanks! No more error message. |
Hi! Cool this helped me, too on a Windows 7 64 bit machine. The name of active virtual python environment (virtual env) was missing in cmder (see screenshots below). This is how it looks in standard cmd (color is added in scrennshot - original is not colored): And thats how it looked in cmder before I aplied your fix: Looks great after fix: As I am not using conda or something specific I renamed/removed local clink_path_lua_file = clink.get_env('CMDER_ROOT')..'\\vendor\\clink-completions\\modules\\path.lua'
dofile(clink_path_lua_file)
function get_virtual_env(env_var)
env_path = clink.get_env(env_var)
if env_path then
basen = exports.basename(env_path)
return basen
end
return false
end
---
-- add python virutual env name
---
function conda_prompt_filter()
-- add in python virtual env name
local python_env = get_virtual_env('DEFAULT_ENV')
if python_env then
clink.prompt.value = string.gsub(clink.prompt.value, "λ", "["..python_env.."] λ")
end
end
---
-- add virtual env name
---
function venv_prompt_filter()
-- add in virtual env name
local venv = get_virtual_env('VIRTUAL_ENV')
if venv then
clink.prompt.value = string.gsub(clink.prompt.value, "λ", "["..venv.."] λ")
end
end Now everything works and looks nice! Thank you guys!!! |
So, what should we do here? I think cmder will get a lot of complains about missing environment names. I can guess a few ways to prevent that:
My preference would be the parsing (I think the problem with the garbled unicode path names makes parsing needed anyway). |
+1 for parsing |
Please try #1070 for a version which parses the original prompt. |
I cant get this to work for venv i placed the file.lua in C:\Program Files\cmder\config |
I can initialize a virtualenv environment using Cmder but when I run the following command:
env/Scripts/activate
Nothing happens (i.e. "(env)" doesn't show up in front of my path in the terminal as its supposed to).
When running the same in regualr cmd it works as intended.
Any thoughts? I was thinking maybe there is some Windows setting that might be preventing Cmder from running a batch file (activate.bat) or a file without an extension (activate). I ran Cmder as admin and it did not change anything though. I posted the full question and background here: http://superuser.com/questions/1108063/python-virtualenv-not-activating-in-windows-10-cmder
The text was updated successfully, but these errors were encountered: