8

I am trying to run below commands but it's not working on my windows machine.

C:\Users\XXX\Desktop\python-7>pip install chalice -t .
ERROR: Can not combine '--user' and '--target'

C:\Users\XXX\Desktop\python-7>pip install --user --install-option="--prefix=" chalice -t .
ERROR: Can not combine '--user' and '--target'

Can someone please let me know if there is any alternative to get the module in the same directory ?

UPDATE

C:\Users\XXX\Desktop\python-7>pip install --target=C:\Users\XXX\Desktop\python-7 chalice
ERROR: Can not combine '--user' and '--target'
sinoroc
  • 18,409
  • 2
  • 39
  • 70
Naxi
  • 1,504
  • 5
  • 33
  • 72
  • why are you using `pip install chalice -t`, It is working by simply running `pip install chalice` – Ahmad Anis May 27 '20 at 08:14
  • @AhmadAnis I am trying to get the module in the same directory so that I can zip it up along with the code – Naxi May 27 '20 at 08:17
  • Then it would be `pip install --target=d:\somewhere\other\than\the\default chalice` check this answer https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip – Ahmad Anis May 27 '20 at 08:20
  • 1
    gives me the same error. – Naxi May 27 '20 at 08:24
  • then just install it using `pip install chalice` and locate it and make its copy and save it to your desired destination https://stackoverflow.com/questions/29980798/where-does-pip-install-its-packages – Ahmad Anis May 27 '20 at 09:24
  • 1
    yep. Did that. I was curious to why this is happening. Thanks ! – Naxi May 27 '20 at 09:52
  • @Naxi did you figure out what was wrong? Having the same issue here – Janaka Bandara Aug 12 '20 at 03:16

3 Answers3

5

add --no-user at the end of the command and it should work

Andrea Laiena
  • 51
  • 1
  • 2
4

This happens with the Python version distributed on the Windows AppStore.

I believe it's because that version installs the basic executables under C:\Program Files\WindowsApps, a secured location that users cannot modify; pip is then aliased to actually run as something like pip --user C:\Users\<your_user>\AppData\Local\Packages\PythonSoftwareFoundation.Python.<version>_<id>\LocalCache\local-packages\Python<version>, so users will install packages to a writeable folder.

Hence, as soon as you try to add --target, pip breaks.

Giacomo Lacava
  • 1,784
  • 13
  • 25
  • Thanks, Fastest for me, uninstall the Python version distributed on the Windows AppStore, then download and install the version from python.org – The Anh Nguyen Oct 22 '21 at 10:11
0

You can simply use:

C:\Users\XXX\Desktop\python-7>pip install chalice