I have referenced this question: How do I activate a virtualenv inside PyCharm's terminal?
As it mentions, PyCharm should support auto activate virtual env since 2016. But I fail to get it work.
Above is my setting page for the PyCharm Terminal. I have checked the 'Activate virtualenv'.
But every time I start a terminal in PyCharm, it didn't automatically activate the virtual env. I need to manually use command conda activate <environment_name> to activate the environment.
I am using a Conda Environment installed with homebrew.
May I ask, is there any parameters that I can add to the Shell path (/bin/zsh) to make it automatically activate specific virtual env? Or other ways to solve this problem?
I had it working. This has nothing to do with pycharm.
My issue was about anaconda HKEY_CURRENT_USER was still there even after uninstalling it.
1-You must check your PATH environment variable echo %PATH% in the command prompt and check for paths that do not exist anymore or check for the "&" sign and remove them.
2-The following may be this works for you:
Open the Registry Editor (press the Windows key, type Regedit and hit Enter).
Navigate to HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun and clear the values.
Also, check HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
I have solved this problem with an alternative method found in: https://stackoverflow.com/a/55658404/15416614
Although this question is originally asking about the Windows environment and it is in 4 years ago, there is an answer from 'Ethan Yanjia Li' that can still solve my current problem.
This seems to be a PyCharm bug that the 'Activate virtualenv' option is not working sometimes. It has been fixed before but reappears in some situations, according to: https://youtrack.jetbrains.com/issue/PY-23417.
Related
I am running Windows PowerShell inside or outside VS Code in Windows 10, and I am not able to activate or change the virtual environment. I have the full Anaconda installed on my system (this should probably pop up for Miniconda too).
I have already tried the following solutions following other answers here or solutions on the web:
Ensured PATH environment variable points to <anaconda_dir>/Scripts
Ran conda init prior to and after running conda activate <env_name>
Tried solutions provided on https://github.com/conda/conda/issues/9392
when i open anaconda prompt or use "conda" in cmd its says access is denied and window prompt
"
this app can't run on your pc to find a version for your pc check with the software publisher"
and right now i also cant open anaconda navigator as well
Noted: I have been using the anaconda for a while with no problem before, however i miss-clicked sign out option instead of shutdown from window10 and it seem that the privacy is changed somehow, so far i have try changing environment variable and manage app execution alias but both of them did not solve the issue. Please share your solution if you experience this before thank you
The solution I found for it is the worst possible: I simply reinstalled Anaconda.
You can also try just getting conda.exe from the compiled source and replace it on Scripts folder instead of reinstalling it.
Sometimes when I change my environment variables in Windows, and then use software the depends on those variables, they are not properly updated.
And good example is to change a variable, then open up Windows Command Line and echo the variable and see that it hasn't been changed, even though you properly changed it in the Environment Variables window.
Another example I'm dealing with right now:
I've been using Python 2.4.x for a while for a project, which uses the env var PYTHONPATH who's value has been:
C:\Python24;C:\Python24\lib
Today I installed Python 2.5.x for the project. I changed my PYTHONPATH to be:
C:\Python25;C:\Python25\lib
When I use Python 2.5 to run a script and do this:
import sys
print sys.path
It prints:
'C:\\PYTHON24', 'C:\\PYTHON24\\lib' (and some other Python 2.5 related default installation paths)
So clearly, the old PYTHONPATH environment variable changes aren't really sticking....
Does anyone know why this happens and how to fix it?
When you change an environment variable in the System Properties tab, the new value will propagate to the Windows Explorer, and any apps (such as cmd.exe) opened from the Windows Explorer (or the Run box, Start Menu, etc.) should see the new value.
However, if you're running a program such as an editor or python or some non-Microsoft program launcher, then change an environment variable, and then launch cmd.exe from that program (instead of Windows Explorer) you are likely to see the old value of the environment variable. The reason is that the running program ignored the notification from Windows saying that the environment has changed (not at all unusual), and since the launched process inherits the environment variables, the child process won't see the changes.
The workaround is to make sure you start your app from Windows Explorer or the Run box. Rebooting your machine will work also (if rebooting doesn't solve the problem, then something else is going on).
Anaconda was installed by Systems Team on my work computer.
For reasons beyond this topic, they installed in Program Files, which I think is non-optimal.
So I ask permission to remove the installation and reinstall it via standard procedures.
When I open Anaconda PowerShell prompt it is still pointing to the Program Files installation which I have removed.
I have also checked the Path environmental variable, and there is nothing looking like Anaconda is still there.
How can I get Anaconda PowerShell prompt to work again?
It should be noted that conda command does work in regular command prompt.
Thanks.
Initialize conda for use with Powershell via
conda init powershell
This command should be run in Anaconda Prompt.
Before following #Peter's solution, I was able to track the problem via a more rustic procedure.
Right click on Start Menu's Anaconda PowerShell Prompt, and select Open File Location.
Right click on the icon's Properties, select Shortcut tab > Target field.
Copy the command to a text editor, and noticed it was still using an old location.
Changing the command to point to the right location did fix the problem.
... but that is only the command from the Start Menu, the rest is done by what was suggested before.
Thanks for the help.
I have Anaconda installed on my computer but when I type a command in cmd I only get 'conda' is not recognized as an internal or external command,
operable program or batch file. What could be the problem? It's the same with pip.
I can see that it is installed in my settings.
So Anaconda should have added jupyter to your PATH automatically during the install if you selected that option as shown in the installation video, if you did not select it, you need to do this manually, here are the steps to do so:
1)go to mu cpmuter properties and click on ADVANCE SYSTEM SETTINGS
2)Select the Advanced tab.
3)Click the Environment Variables button.
4)Under System Variables, select Path, then click Edit.
You'll see a list of folders, as this example for my system shows something like:
C:\Program Files\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
You will notice that each of these file paths are separated by a semicolon ;
You can add additional folders that you want to include in searches. In this case, you need to add Anaconda to your path, it will be something like: C:\Users\myusername\Anaconda2
Add that to the list, make sure your spacing is correct
You'll need to restart the processes (e.g., command prompt) that use the system path to see the added folders.
-----------------------------------------------------------------------------## YOU CAN ALSO AVOID THIS MANUAL PROCESS ##
ANOTHER METHOD is reinstall this and while doing this make sure of thing that is shown in the scr shot below
while installing the anaconda the dialogue box appears giving two options
add anaconda to my path enviorment variable
register anaconda as my default python version
select both of this options though system will not recommend this but you have to mark
thankyou!!
all the best!!
Open your Anaconda Prompt instead of just your command prompt. Then type "conda list," you should get the correct output. I suspect that you did not add Anaconda to your PATH during installation and that's why your regular command prompt won't recognize the conda commands.
Find where you anaconda is installed. Usually, it is under %USERPROFILE%\AppData.... You can set path using SETX PATH on CMD. e.g. I have installed anaconda3. It was installed in its default path.
e.g.
SETX PATH “%USERPROFILE%\AppData\Local\Continuum\Anaconda3; %USERPROFILE%\AppData\Local\Continuum\Anaconda3\Scripts”
If you do not know where anaconda was installed, you can open "Anaconda prompt" app. You can see the environment path to your anaconda [You can find "Anaconda prompt" using Search Windows.