Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PIP Install: Cannot combine --user and --target

My goal is to install a package to a specific directory on my machine so I can package it up to be used with AWS Lambda.

Here is what I have tried:
pip install snowflake-connector-python -t .

pip install --system --target=C:\Users\path2folder --install-option=--install-scripts=C:\Users\path2folder --upgrade snowflake-connector-python

Both of these options have returned the following error message:
ERROR: Can not combine '--user' and '--target'

In order for the AWS Lambda function to work, I need to have my dependencies installed in a specific directory to create a .zip file for deployment. I have searched through Google and StackOverflow, but have not seen a thread that has answered this issue.

Update: This does not seem to be a problem on Mac. The issue described is on Windows 10.

like image 704
Dave Avatar asked Sep 07 '20 20:09

Dave


2 Answers

We encountered the same issue when running pip install --target ./py_pkg -r requirements.txt --upgrade with Microsoft store version of Python 3.9.

Adding --no-user to the end of it seems solves the issue. Maybe you can try that in your command and let us know if this solution works?

pip install --target ./py_pkg -r requirements.txt --upgrade --no-user

like image 107
Zhiwei Avatar answered Sep 18 '22 19:09

Zhiwei


We had the same issue just in a Python course: The error comes up if Python is installed as an app from the Microsoft app store. In our case it was resolved after re-installing Python by downloading and using the installation package directly from the Python website.

like image 27
Hans-Georg Fill Avatar answered Sep 16 '22 19:09

Hans-Georg Fill