Emiliano Tonizzo
Emiliano Tonizzo

Reputation: 103

Add conda to my environment variables or path?

I am having trouble adding conda to my environment variables on windows. I installed anaconda 3 though I didn't installed python, so neither pip or pip3 is working in my prompt. I viewed a few post online but I didn't find anything regarding how to add conda to my environment variables.

I tried to create a PYTHONPATH variable which contained every single folder in Anaconda 3 though it didn't worked.

My anaconda prompt isn't working too. :(

so...How do I add conda and pip to my environment variables or path ?

Upvotes: 7

Views: 50483

Answers (4)

Aerinmund Fagelson
Aerinmund Fagelson

Reputation: 162

Not sure whether this is appropriate in the 'Answers' section (since for me it is a question as much as an answer). But for Windows OS, upon installing Anaconda (or in my case, miniconda) it specifically says that adding to the PATH variable is NOT recommended (version 23.9, installed in Nov 2023).

Not recommended to

For this reason, I have been holding off doing so and trying to use the custom Anaconda PowerShell Prompt which comes included in the install. However I am not sure how necessary this caution is. Does anyone else know any further info on this?

Upvotes: 1

RajK
RajK

Reputation: 39

The path where Anaconda3 is present on your windows system will not work. C:\Users\pcuser\Anaconda3

Try this: Open conda prompt and the following

conda list

gives the list of packages. try uninstalling any one package

conda uninstall <any package>

It will prompt the package path where the package is installed. It will look something like this:

c:\users\appdata\local\anaconda3\scripts\

Add this path to my PATH environment-variable. It works from git bash or cmd.

Upvotes: 0

ractiv
ractiv

Reputation: 762

You can access to conda and pip directly in their directory :

  • On Windows : %ANACONDA_INSTALL_DIR%\Scripts, you will find conda.exe and pip.exe
  • On Linux : $ANACONDA_INSTALL_DIR/bin, there are conda and pip executable files.

Where $ANACONDA_INSTALL_DIR is the directory of your Anaconda installation.

To add Anaconda to your path, you can add this folder to your PATH. For Linux, you can add this line to yout .bashrc file

export PATH=$ANACONDA_INSTALL_DIR/bin:$PATH

As said @BcK, reinstalling Anaconda and choosing to add Anaconda to your path is also a way to do this. This option makes a backup of your .bashrc file and add the export line.

EDIT

To open a terminal with the conda environment activated on Windows, I usually create a desktop shortcut with the following target :

%windir%\System32\cmd.exe "/K" %ANACONDA_INSTALL_DIR%\Scripts\activate.bat %ANACONDA_INSTALL_DIR%

Upvotes: 11

Emiliano Tonizzo
Emiliano Tonizzo

Reputation: 103

Thanks guys for helping me out. I solved the problem reinstalling anaconda (several times :[ ), cleaning every log and resetting the path variables via set path= in the windows power shell (since I got some problems reinstalling anaconda adding the folder to PATH[specifically "unable to load menus" or something like that])

Upvotes: 0

Related Questions