12

I'm using Anaconda on Windows x64. I'm trying to install some library using pip. However, the the command line isn't recognizing pip or any other scripts. The folder that they are all in is in both the user and system PATH variable. pip is there and works if I use the entire file path. Is there a way to fix this?

Abdulrahman Bres
  • 2,603
  • 1
  • 20
  • 39
johnidel127
  • 179
  • 1
  • 1
  • 8

7 Answers7

15

When creating your environment, you need to specify pip as a dependency:

conda create --name my-env pip
activate my-env
pip install ...

Installing a new environment with all default anaconda packages:

conda create --name my-env anaconda
DieterDP
  • 4,039
  • 2
  • 29
  • 38
  • Do you know how to install pip on Windows if one didn't specify pip as a dependency? – duhaime Aug 25 '21 at 17:14
  • See https://stackoverflow.com/questions/33680946/how-to-add-package-to-conda-environment-without-pip Note that its best not to gradually add packages to a conda environment though. Instead, add all dependencies to a conda environment and reinstall the environment from there. This helps to avoid package conflicts and ensures you have a shareable and reproducible environment. – DieterDP Aug 26 '21 at 10:17
14

Do this worked for me:

conda install pip

and try:

pip install package_name
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
AjayKhanna
  • 141
  • 1
  • 4
5

Make sure you have the following dir added to PATH:

C:\Python27\Scripts
mmenschig
  • 1,088
  • 14
  • 22
  • His Anaconda is installed in `C:\Anaconda3`, not `C:\Python27`. – asmeurer Mar 16 '15 at 16:10
  • I'm not sure how Anaconda is setup but I assume that there's some similarity to Python regarding the Scripts directory @asmeurer – mmenschig Mar 16 '15 at 21:08
  • This works to a point, but fails I think because an environment isn't setup with the packages pip needs to connect to Pypa. Using the Anaconda prompt and running pip install seems to be the easiest way to install packages in anaconda. I'm just starting to learn how to use anaconda and about environments. – Gerald Leese Feb 24 '19 at 19:13
2

I worked for me if I start cmd and do cd C:\Users\ComputerName\Python27\Scripts Then I typed in 'pip install "library"' and it worked! If you don't know how to access cmd just press Win+R and type in cmd!

Hope it helped!

CoolJWB
  • 69
  • 1
  • 2
  • 10
0

Try typing

python -m pip install --upgrade pip

in CMD

It worked for me.

Marcus
  • 437
  • 4
  • 9
0

I had it myself because of my username which uses this character "ï" which causes an encoding problem in the PATH variable. Therefore, scripts cannot be found by anaconda. I had to install Anaconda For everyone and not just the current user to solve this problem.

SeyoS
  • 661
  • 5
  • 22
0

Add script folder location to path, for individual user installation it will be "C:\Users\<user>\Anaconda3\Scripts" and for everyone installation it can be found in Program Files "C:\Program Files\Anaconda3\Scripts"

vikash vik
  • 686
  • 5
  • 10