Reputation: 6187
I want dependencies for a project to be installed into a virtual environment. I create it successfully, and activate it, but still installing dependencies results in them installed under /usr/local/bin64 instead of my virtual env:
[ec2-user@machine app]$ virtualenv environment
created virtual environment CPython3.7.10.final.0-64 in 392ms
creator CPython3Posix(dest=/home/ec2-user/app/environment, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ec2-user/.local/share/vi
rtualenv)
added seed packages: pip==21.0.1, setuptools==54.1.2, wheel==0.36.2
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
[ec2-user@machine app]$ source environment/bin/activate
(environment) [ec2-user@machine app]$ pip3 install -r requirements.txt
Collecting anyio==3.4.0
Using cached anyio-3.4.0-py3-none-any.whl (78 kB)
Collecting appdirs==1.4.4
Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting atomicwrites==1.4.0
Using cached atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
Collecting attrs==20.3.0
Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting boto3==1.20.14
...
I find packages end up here: /usr/local/lib64/python3.7/site-packages
But I expected them to be installed inside ~/app/environment
, where my virtual env was created and activated.
I checked the location of pip and pip3, seems correct:
(environment) [ec2-user@machine app]$ which pip
~/app/environment/bin/pip
(environment) [ec2-user@machine app]$ which pip3
~/app/environment/bin/pip3
What am I missing?
Upvotes: 1
Views: 41
Reputation: 7410
You are calling pip3
which is in the other environment. Try pip
. And you can validate with which pip
.
Upvotes: 1